Problem: Repeating same computation when calling one-to-one match.
Especially slow when each individual GT/submission file has large number of bounding boxes (>100). The first 2 conditions of the one_to_one_match only need to be computed once.
How to reproduce:
Prepare a gt.zip in which each .txt file contains large number of bounding boxes.
Similarly, the subm.zip can also contains large number of bounding boxes.
Run python script.py -g="gt.zip" -s="subm.zip" [--E2E] [-t 4]
Explanation & Solutions: the one_to_one_match is called n_gt * n_sumb times.
The first condition relies only on the row (always sum all second axis) while the second condition relies only on the col (always sum the first axis). All of which can just be computed once and reuse for all the n_gt * n_sumb iterations.
We can immediately filter out the indices that doesn't meet the first & second condition and iterate through those that still possible for one-to-one match (and check with the third condition)
Problem: Repeating same computation when calling one-to-one match.
Especially slow when each individual GT/submission file has large number of bounding boxes (>100). The first 2 conditions of the
one_to_one_match
only need to be computed once.How to reproduce:
gt.zip
in which each.txt
file contains large number of bounding boxes.subm.zip
can also contains large number of bounding boxes.python script.py -g="gt.zip" -s="subm.zip" [--E2E] [-t 4]
Output (average bbox per gt/subm: 100~):
After optimization:
Explanation & Solutions: the
one_to_one_match
is calledn_gt * n_sumb
times.The first condition relies only on the row (always sum all second axis) while the second condition relies only on the col (always sum the first axis). All of which can just be computed once and reuse for all the
n_gt * n_sumb
iterations.We can immediately filter out the indices that doesn't meet the first & second condition and iterate through those that still possible for one-to-one match (and check with the third condition)