def execute(self, columns):
global i
[img, bboxes] = columns
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
[h, w] = img.shape[:2]
bboxes = parsers.bboxes(bboxes, self.protobufs)
imgs = [img[int(h*bbox.y1):int(h*bbox.y2), int(w*bbox.x1):int(w*bbox.x2)]
for bbox in bboxes]
for img in imgs:
cv2.imwrite('/app/tmp/{:05d}.jpg'.format(i), img)
i += 1
genders = self.rc.get_gender_batch(imgs)
outputs = [struct.pack('=cf', label, score) for [label, score] in genders]
assert(len(outputs) == len(imgs))
return [''.join(outputs)]
评论列表
文章目录