Evaluation Parameters
To compute the spatial_match metric, the following parameters must be provided:actual_output
: A single predicted bounding box in the format.expected_output
: A list of lists of ground truth boxes, each also in the format.
How Is It Calculated?
- The predicted box is compared against each reference box.
- The IoU is calculated for each pair:
- The highest IoU score among all comparisons is selected as the final score.
- If this score is greater than or equal to a predefined threshold (0.5), the metric returns 100% (pass). Otherwise, it returns 0% (fail).
Interpretation of Scores
- 1.0 – Strong spatial match; high alignment.
- 0.0 – Low spatial match; poor alignment.
Suggested Test Case Types
Use Spatial Match when evaluating:- Document layout tasks requiring accurate box alignment.
- OCR or form field extraction where exact box positioning matters.
- Visual QA and multi-box alignment tasks that benefit from flexible but spatially aware comparisons.