Evaluation Parameters
To compute the iou 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 bounding box is compared against each ground truth box.
- For each comparison, the IoU is calculated as:
- The maximum IoU value across all comparisons is returned as the final score.
Interpretation of Scores
- ≥ 0.7 – Strong spatial alignment.
- 0.4 – 0.7 – Moderate overlap; may require refinement.
- < 0.4 – Poor alignment; predicted box diverges from reference.
Suggested Test Case Types
Use IoU when evaluating:- Layout-aware predictions, such as bounding boxes in OCR or form extraction.
- Visual document understanding, where spatial positioning is essential.
- Object or text region detection in image or PDF-based tasks.