论文:https://arxiv.org/abs/2004.04940
代码:https://github.com/wangyuxin87/ContourNet
源代码中有生成可视化结果的代码,查看issue时看到还是有些朋友不会设置,这里举个例子说明一下。
如果要生成可是化结果,可以在/ContourNet/maskrcnn_benchmark/data/datasets/evaluation/word/word_eval.py Line480左右
的地方做如下两处修改,一个是输入图像的路径,一个是输出图像的路径。
注意:输出路径需要自己创建好,代码中没有创建。
# visualization
if cfg.DATASETS.Test_Visual:
im_write = cv2.imread( # 'path to ic15 test image (must same to paths_catalog.py configured)'
'/mnt/ContourNet/datasets/ic15/ic15_test_images/' + im_w_name)[
:, :, ::-1]
for i in keep:
box = esd[i]
# print(box)
# assert 1<0
box = np.array(box['seg_rorect'])
box = np.around(box).astype(np.int32)
cv2.polylines(im_write[:, :, ::-1], [box.astype(np.int32).reshape((-1, 1, 2))], True,
color=(0, 255, 0), thickness=2) # 0,255,255 y 0,255,0 g
cv2.imwrite('/mnt/ContourNet/datasets/ic15/ic15_test_result/' + im_w_name, im_write[:, :, ::-1]) # 'path to visualization'
else: