fasterRCNN.py 文件源码

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

项目:deel 作者: uei 项目源码 文件源码
def draw_rois(out,im_scale, rois,bbox,cls):
    CV_AA = 16
    print bbox.shape
    for i in range(len(rois)):
        n,x1,y1,x2,y2 = rois[i]
        canvas = out.copy()
        cv.rectangle(canvas, (x1, y1), (x2, y2), (255, 0, 0), 1, CV_AA)

        cls_id=np.argmax(cls[i])
        if cls[i][cls_id]>0.1 and cls_id != 0:
            x1 = int(x1)
            x2 = int(x2)
            y1 = int(x1)
            y2 = int(y2)
            ret, baseline = cv.getTextSize(
                CLASSES[cls_id], cv.FONT_HERSHEY_SIMPLEX, 0.8, 1)
            cv.rectangle(out, (x1, y2 - ret[1] - baseline),
                         (x1 + ret[0], y2), (0, 0, 255), -1)
            cv.putText(out, CLASSES[cls_id], (x1, y2 - baseline),
                       cv.FONT_HERSHEY_SIMPLEX, 0.8, (255, 255, 255), 1, CV_AA)
        for j in range(0,84,4):
            x1,y1,x2,y2 = bbox[i][j:j+4]
            cv.rectangle(canvas, (x1, y1), (x2, y2), (255, 255, 0), 1, CV_AA)
        cv.imshow("res",canvas)
        cv.waitKey(0)       

    return out
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号