File size: 464 Bytes
6ef31de |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from model.vision.grit_src.image_dense_captions import image_caption_api
import cv2
class DenseCaptioner():
def __init__(self, device):
self.device = device
def __call__(self, imgs):
dense_captions = []
for img in imgs:
cv2_img = cv2.merge([img[2], img[1], img[0]]) # BGR
caption = image_caption_api(cv2_img, device=self.device)
dense_captions.append(caption)
return dense_captions
|