cs-chan / Total-Text-Dataset

Total Text Dataset. It consists of 1555 images with more than 3 different text orientations: Horizontal, Multi-Oriented, and Curved, one of a kind.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

about DetEval.py evaluation speed boosting.

princewang1994 opened this issue · comments

Hi, I found that the evaluation in this code run extremely slowly and most time-consuming operation in your code is area/area_of_intersection/iou. These functions are based on mask counting, which depends highly on the size of images(some big-size images can be bottleck of computing).
I have replaced mask counting operation with polygon coordinate computing(which uses shapely, a geometry lib written in python) so that it highly boosts the evaluatoin process.
Can I make a PR? Hope for your replying, thx.

Oh yes you are most welcome, thanks for wanting to contribute! And I assume that you have already tested out your code? In particular, does the library provides an exact solution instead of approximation when it comes to calculating the area of intersection?

I have compared the result of mask counting method and polygon based method, their result have a bit difference(1 to 3 pixels in computing iou between 2 polygons with area about 10000 pixels) because mask counting based implement discretize the coordinates to pixels. In fact, I think the polygon based method produce more precise result.

Yup that makes sense. Also, less than 1 percent of differences is probably negligible in practice.

Thx for your replying, I will make a pull request soon! 😆