trainer.py 文件源码

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

项目:ssd_tensorflow 作者: seann999 项目源码 文件源码
def draw_matches2(I, pos, neg, true_labels, true_locs):
    I = np.copy(I) * 255.0
    index = 0

    for o in range(len(layer_boxes)):
        for y in range(c.out_shapes[o][2]):
            for x in range(c.out_shapes[o][1]):
                for i in range(layer_boxes[o]):
                    if pos[index] > 0:
                        d = c.defaults[o][x][y][i]
                        coords = default2cornerbox(d, true_locs[index])
                        draw_rect(I, coords, (0, 255, 0))
                        coords = center2cornerbox(d)
                        draw_rect(I, coords, (0, 0, 255))
                        cv2.putText(I, i2name[true_labels[index]],
                                    (int(coords[0] * image_size), int((coords[1] + coords[3]) * image_size)),
                                    cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255))
                    elif neg[index] > 0:
                        pass
                        #d = defaults[o][x][y][i]
                        #coords = default2global(d, pred_locs[index])
                        #draw_rect(I, coords, (255, 0, 0))
                        #cv2.putText(I, coco.i2name[true_labels[index]],
                        #            (int(coords[0] * image_size), int((coords[1] + coords[3]) * image_size)),
                        #            cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 0, 0))

                    index += 1

    I = cv2.cvtColor(I.astype(np.uint8), cv2.COLOR_RGB2BGR)
    cv2.imshow("matches2", I)
    cv2.waitKey(1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号