pan_pp.pytorch icon indicating copy to clipboard operation
pan_pp.pytorch copied to clipboard

How to do visualization using PAN?

Open aswa123 opened this issue 3 years ago • 3 comments

aswa123 avatar Nov 14 '21 08:11 aswa123

@aswa123 you can visualize using opencv cv2.polylines() function in test.py file.

with torch.no_grad():
        outputs = model(**data)

bboxes = outputs['bboxes']
img_name=os.path.basename(image_path)
filename, file_extension = os.path.splitext(img_name)
for i, bbox in enumerate(bboxes):
      poly = np.array(bbox).astype(np.int32).reshape((-1))
      poly = poly.reshape(-1, 2)
     cv2.polylines(ori_img, [poly.reshape((-1, 1, 2))], True, color=(0, 0, 255), thickness=2)
result_name='res_%s.jpg' % filename
cv2.imwrite(os.path.join(result_path,result_name), ori_img)

bharatsubedi avatar Nov 16 '21 09:11 bharatsubedi

@bharatsubedi Thank you very much for your attention. sorry to bother you but where I need to place this code in test.py file

aswa123 avatar Nov 22 '21 03:11 aswa123

@aswa123您可以在 test.py 文件中使用 opencv cv2.polylines() 函数进行可视化。

with torch.no_grad():
        outputs = model(**data)

bboxes = outputs['bboxes']
img_name=os.path.basename(image_path)
filename, file_extension = os.path.splitext(img_name)
for i, bbox in enumerate(bboxes):
      poly = np.array(bbox).astype(np.int32).reshape((-1))
      poly = poly.reshape(-1, 2)
     cv2.polylines(ori_img, [poly.reshape((-1, 1, 2))], True, color=(0, 0, 255), thickness=2)
result_name='res_%s.jpg' % filename
cv2.imwrite(os.path.join(result_path,result_name), ori_img)

did you prepare a code for testing with single images? I also want to test with a single image. Could you please share your code? Thank you !

lrfighting avatar Mar 26 '22 14:03 lrfighting