whai362 / pan_pp.pytorch

Official implementations of PSENet, PAN and PAN++.
Apache License 2.0
439 stars 90 forks source link

Speed Improvement of Pixel Aggregation #115

Open Zerohertz opened 1 year ago

Zerohertz commented 1 year ago

Dear Mr. Wang

Processing Time of pan_pp.det_head.get_results() [ms] (Used data: ICDAR2015 [dataset])

It was confirmed that pixel aggregation (pa.pyx) is dominant during the post-processing process for images with variously distributed strings. Therefore, I modified the cython code to improve speed and parallel processing. The result is a 4.629% improvement based on the ic15 dataset, but a huge speedup can be expected if there are numerous labels. (Based on the dataset I used (documents), it's about 100 ms shorter.)

Also modified the input of cv2.resize to solve the error below.

    label = cv2.resize(label, (img_size[1], img_size[0]),
    score = cv2.resize(score, (img_size[1], img_size[0]),
cv2.error: OpenCV(4.7.0) :-1: error: (-5:Bad argument) in function 'resize'
> Overload resolution failed:
>  - Can't parse 'dsize'. Sequence item with index 0 has a wrong type
>  - Can't parse 'dsize'. Sequence item with index 0 has a wrong type

Sincerely, Hyogeun Oh