clovaai / wsolevaluation

Evaluating Weakly Supervised Object Localization Methods Right (CVPR 2020)
MIT License
332 stars 55 forks source link

slow cv2.findContours #52

Closed sbelharbi closed 3 years ago

sbelharbi commented 3 years ago

hi, cv2.findContours is extremely slow depending on the quality of the cam (from .00005s to .001s). this brings the validation time from 2mins to 12mins easily. things get worse when the cam is bad (way too many contours per threshold: >1000/threshold).

https://github.com/clovaai/wsolevaluation/blob/e00842f8e9d86588d45f8e3e30c237abb364bba4/evaluation.py#L140

is there a way to speed it up whout breaking the evaluation protocol? i really appreciate your help. thanks

sbelharbi commented 3 years ago

current workaround: reduce the number of thresholds but only for the validation set. it gives a good-enough estimate of the performance for model selection.

please let me know if there is a way to speedup cv2.findContours. closing. thanks

coallaoh commented 3 years ago

Another workaround is parallelisation. The evaluation function is "embarrassingly parallel" with respect to the image instances and the threshold levels. The current code doesn't support this, but there are many good parallel computing libraries in python.

sbelharbi commented 3 years ago

thanks yes, parallelism is good way. i'll check it out.
for now, reducing the number of thresholds to 1/3 of original gives approximately the same performance on validation while largely reducing the computation time.

thanks