Inner-MPDIoU Loss for PCB Defect Detection
- The paper introduces Inner-MPDIoU Loss as an innovative boundary-based loss that enhances tiny object localization by focusing on an adjustable inner region and penalizing corner drift.
- It modifies IoU loss by computing the overlap on a scaled auxiliary ground-truth box, thereby improving performance in high-density, small-object detection tasks.
- Empirical results on the PKU-Market-PCB dataset show improved recall (+0.41 pp) and mAP0.5:0.95 (+2.83 pp), validating the method's precision in defect detection.
Inner-MPDIoU Loss is a boundary-based loss function developed to improve the localization accuracy of tiny objects in object detection tasks, particularly in printed circuit board (PCB) defect detection. It modifies traditional IoU-based losses by focusing the overlap computation on a scale-adjustable inner region of the ground-truth bounding box and incorporating penalties for drift in both box center and corner alignment, normalized for scale invariance. The method is introduced and evaluated in “Multi-Scale PCB Defect Detection with YOLOv8 Network Improved via Pruning and Lightweight Network” (Pingzhen et al., 23 Jul 2025) to address challenges in high-density, small-object detection scenarios.
1. Mathematical Formulation
The Inner-MPDIoU loss is constructed through several key steps, utilizing both the predicted bounding box and the ground-truth box represented by their edges. It introduces an auxiliary ground-truth box , generated by scaling about its center by ratio . The steps are:
- Auxiliary Box Construction:
Here, is the center, and are width and height.
- Intersection Area:
- Area Calculations:
- Union:
0
- Corner-Point Drift Penalty:
1
These terms measure discrepancies at the top-left and bottom-right corners.
- Image-Scale Normalization:
2
- Inner-MPDIoU Metric:
3
- Loss Function:
4
This formulation encourages not only overlap, but also precise matching in box location and aspect under a scale-invariant normalization.
2. Intuitive Rationale and Components
Each component of Inner-MPDIoU serves a specific purpose for robust performance on tiny and dense targets:
- The auxiliary box 5 focuses the metric on a controllable region of the ground-truth box via 6, allowing finer control over localization emphasis. For 7, the loss prioritizes the core; for 8, it relaxes localization to a larger region, compensating for slight labeling uncertainty or missing center alignment.
- The intersection-over-union between 9 and 0 directs optimization to achieve high overlap specifically in the scaled region.
- The corner distance penalties (1) penalize misalignments in both position and aspect, targeting failures that standard IoU or DIoU loss cannot fully capture.
- Normalization by 2 renders penalty strength consistent regardless of image scale.
A plausible implication is that this construction is more sensitive to the kinds of small misalignments that are critical for defect detection in high-resolution, high-density PCB imagery.
3. Comparison with Related IoU-based Losses
Inner-MPDIoU is distinct from several established IoU-family losses:
| Loss | Overlap Term | Drift/Aspect Penalty |
|---|---|---|
| IoU | Yes (IoU) | None |
| GIoU | Yes | Enclosing box area |
| DIoU | Yes | Center-point distance |
| CIoU | Yes | Center + aspect penalty |
| MPDIoU | Yes | Multiple key-point drifts |
| Inner-MPDIoU | Yes (aux. IoU) | Two corners, img normalized |
Standard IoU focuses solely on area. GIoU, DIoU, and CIoU incrementally introduce penalties for enclosure, center, and aspect, but do not control for error concentration within a specific region of the box. MPDIoU generalizes center drift to multiple corners, but still lacks tunable focus. Inner-MPDIoU uniquely concentrates the overlap metric on an adjustable inner (or slightly expanded) region, and applies a pair of corner penalties tailored for high-density, tiny-object contexts (Pingzhen et al., 23 Jul 2025).
4. Hyperparameters and Control
The primary hyperparameter of Inner-MPDIoU is the inner-region ratio 3:
- Valid range: 4
- 5 leaves the auxiliary box the same as ground-truth.
- 6 restricts the focus, exerting greater pressure on core alignment—effective for remedying box overshoot.
- 7 introduces tolerance, helpful if predicted boxes are systematically off-center.
In the referenced work, no additional term weighting is introduced; implicit equal contribution is made by IoU and the corner-penalty components. Tuning 8 is typically performed on a small validation subset. No explicit balance hyperparameter is required between the loss' two terms.
5. Implementation Considerations
Integrating Inner-MPDIoU into object detection frameworks such as YOLOv8 involves minimal modification to the bounding box regression loss:
- Replace CIoU or similar loss with the Inner-MPDIoU loss function.
- For each forward pass and for each positive sample, compute auxiliary box coordinates, overlap and union areas, the two corner distances, normalization by 9, and form the final loss.
- The computational overhead is negligible—element-wise min/max and squared distance operations account for <1% increase in FLOPs.
A PyTorch-style function is provided in the primary reference:
2
No modifications are needed elsewhere in the network pipeline. The additional cost is compatible with real-time requirements in industrial applications.
6. Empirical Performance and Impact
In ablation studies on the PKU-Market-PCB dataset, Inner-MPDIoU yields superior localization metrics, especially for small targets:
| Stage | P (%) | R (%) | mAP₀.₅ (%) | mAP₀.₅:₀.₉₅ (%) |
|---|---|---|---|---|
| A+B+C (no loss) | 98.25 | 98.85 | 99.06 | 63.51 |
| +Inner-MPDIoU | 98.39 | 99.26 | 99.20 | 66.34 |
A net gain of +0.41 pp in recall and +2.83 pp mAP₀.₅:₀.₉₅ (over 4% relative) is achieved (Pingzhen et al., 23 Jul 2025). Qualitatively, on challenging backgrounds or for very small defect regions (e.g., 1–2 px missing-hole/spur), Inner-MPDIoU facilitates tighter bounding, mitigates overextension, and reduces missed tiny objects. Application within a YOLOv8-based detector demonstrates improvements without requiring additional model complexity or computational resources.
7. Application Scope and Limitations
Inner-MPDIoU is especially well-suited for domains where precise delineation of small, high-density, or high-value regions is central, such as PCB defect detection. The tunable focus via 0 provides flexibility across data regimes, allowing calibration for varying levels of annotation confidence or object granularity.
A plausible implication is that while Inner-MPDIoU demonstrates improvements in PCB defect benchmarks, the utility of the inner-region penalty may depend on the degree of annotation quality, object density, and specific small-object localization challenges present in other domains. Since only two corner-points are penalized (rather than all four as in some variants), certain forms of skew or rotational error may not be fully penalized unless 1 is appropriately chosen.
Overall, Inner-MPDIoU characterized by its scale-controlled overlap focus and multi-point corner penalties, provides an effective and low-overhead approach for improving tiny-object localization in contemporary object detection frameworks (Pingzhen et al., 23 Jul 2025).