Yuliang-Liu / Curve-Text-Detector

This repository provides train&test code, dataset, det.&rec. annotation, evaluation script, annotation tool, and ranking.
642 stars 156 forks source link

Bug in evaluation code #28

Closed neouyghur closed 5 years ago

neouyghur commented 5 years ago

In voc_eval_polygon.py line 148 to 163 you have not applied offset as you did from171 to 175. Do you think it is a bug?

 # go down dets and mark TPs and FPs
    nd = len(image_ids)
    tp = np.zeros(nd)
    fp = np.zeros(nd)
    for d in range(nd):
        R = class_recs[image_ids[d]]
        bb = BB[d] # mask rcnn
        det_bbox = bb[:]
        pts = [(det_bbox[j], det_bbox[j+1]) for j in xrange(0,len(bb),2)]
        try:
            pdet = Polygon(pts)
        except Exception as e:
            print(e)
            continue
        if not pdet.is_valid: 
            print('predicted polygon has intersecting sides.')
            # print(pts, image_ids[d])
            continue

I can't evaluate my results without changing the part. I changed it like that


 # go down dets and mark TPs and FPs
    nd = len(image_ids)
    tp = np.zeros(nd)
    fp = np.zeros(nd)
    for d in range(nd):
        R = class_recs[image_ids[d]]
        bb = BB[d] # mask rcnn
        det_bbox = bb[:]
        pts = [(det_bbox[j] + det_bbox[0], det_bbox[j+1] + det_bbox[1]) for j in xrange(0,len(bb),2)]
        pts = pts[2:]
        try:
            pdet = Polygon(pts)
        except Exception as e:
            print(e)
            continue
        if not pdet.is_valid: 
            import ipdb; ipdb.set_trace()
            print('predicted polygon has intersecting sides.')
            # print(pts, image_ids[d])
            continue
Yuliang-Liu commented 5 years ago

Hi neouyghur,

It's not a bug. Line 148 to 163 are for detection results, and the result format should be final coordinates x1,y1,x2,y2,...,xn,yn (see Readme.md under tools/ctw1500_evaluation/). Therefore there is not need to apply offset. Line 171 to 175 are for GT processing.

If you have any confusion, please feel free to let me know. Thanks for your attention.

Regards, yl

neouyghur commented 5 years ago

Hi @Yuliang-Liu I changed the demo.py for extracting curve bounding boxes of a different dataset. I set the output format as your input format. According to your comment, the output format is different from the input format. Is that correct? In this case, the code does not have a bug. However, using different formats for the same purpose in the same project will cause misunderstanding.

Thanks for your replying.

Yuliang-Liu commented 5 years ago

That's right. The output format is different from the input format.

Thanks for the comment. I will update Readme to make this clearer.