gender_kernel.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:esper 作者: scanner-research 项目源码 文件源码
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)]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号