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

Too many bboxes detection during testing

Open bharatsubedi opened this issue 4 years ago • 6 comments

Thanks for your work. when I tried to test PAN++ with poly type network produce too many polygon points. which is not similar to total text ground truth file. could you please let me know how can I generate like total text ground truth polygon? res_img425

bharatsubedi avatar Sep 14 '21 04:09 bharatsubedi

hey, can you help me with, how to do visualization using pan?

Thanks

aswa123 avatar Oct 23 '21 11:10 aswa123

@aswa123 you can visualize using opencv fillpoly function.

with torch.no_grad():
        outputs = model(**data)
    if cfg.report_speed:
        report_speed(outputs, speed_meters)
    bboxes = outputs['bboxes']
    img_name=os.path.basename(image_path)
    filename, file_extension = os.path.splitext(img_name)
    with open(os.path.join(result_path,filename+'.txt'), 'w') as f:
        for i, bbox in enumerate(bboxes):        
            poly = np.array(bbox).astype(np.int32).reshape((-1))
            strResult = '\t'.join([str(p) for p in poly]) + '\r\n'
            f.write(strResult)
            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 08 '21 07:11 bharatsubedi

Thank you so much @bharatsubedi

may I know where should I add this code? OR can you send me your .py file for visualization?

because I am new in this field.

Thank you in advance.

aswa123 avatar Nov 09 '21 15:11 aswa123

Thank you so much @bharatsubedi

may I know where should I add this code? OR can you send me your .py file for visualization?

because I am new in this field.

Thank you in advance.

Did you receive the .py file? I also need it now. Thank you !

lrfighting avatar Jan 20 '22 06:01 lrfighting

use this block of code in test.py file

bharatsubedi avatar Jan 25 '22 04:01 bharatsubedi

image_path

ok! thank you!

lrfighting avatar Jan 26 '22 09:01 lrfighting