pan_pp.pytorch
pan_pp.pytorch copied to clipboard
How to do visualization using PAN?
@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 Thank you very much for your attention. sorry to bother you but where I need to place this code in test.py file
@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 !