Performs a binary evaluation of the spatial alignment between a predicted bounding box and one or more reference boxes using the best Intersection over Union (IoU) score. Returns a pass/fail signal based on a threshold, making it ideal for layout-sensitive validation tasks.
The Spatial Match metric is part of the Deterministic Metric options in Galtea. It determines whether a predicted bounding box sufficiently overlaps with any of the reference boxes by computing the Intersection over Union (IOU) and applying a threshold. This binary variant of the IOU metric is particularly useful when an exact spatial match is not required, but a minimum quality of alignment must be enforced.
The predicted box is compared against each reference box.
The IoU is calculated for each pair:IoU=Area of UnionArea of Intersection
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).
This approach accommodates situations where reference answers span multiple boxes (e.g., one box per word), and only the best alignment needs to be evaluated.