Datasets:
ArXiv:
License:
Refactor evaluation script: Optimal instance matching and dynamic GT connected components
#4
by Arvind69 - opened
Description:
This PR introduces several improvements to rexrank_eval.py to ensure more accurate instance matching and expand compatibility with datasets outside of ReXGroundingCT.
Motivation:
The previous implementation utilized a greedy matching approach for prediction and ground truth (GT) instances, which could lead to sub-optimal pairings. Additionally, it assumed that GT instances were pre-labeled. While this holds true for ReXGroundingCT, other datasets might not have pre-labeled GTs. This PR addresses both limitations.
Summary of Changes:
- Optimal Instance Matching (Hungarian Algorithm): Replaced the greedy matching approach with the Hungarian matching algorithm (
scipy.optimize.linear_sum_assignment). This ensures that the global pairing between GT and prediction components yields a more accurate and higher mean-matched dice score. - Optimized Dice Score Computation: Instead of calculating dice scores on the fly during the while-loop, the script now pre-computes and stores the dice score values for overlapping instances in a score matrix prior to assignment. This avoids redundant calculations.
- Dynamic GT Connected Components: Added a
gt_instances_labeledflag toevaluate_finding. If a dataset's GT instances are not pre-labeled (distinct integers), the script will now run connected component filtering (cc_filter) on the ground truth to label them on the fly.
Please let me know if you would like any adjustments to the implementation!