Papers
Topics
Authors
Recent
Assistant
AI Research Assistant
Well-researched responses based on relevant abstracts and paper content.
Custom Instructions Pro
Preferences or requirements that you'd like Emergent Mind to consider when generating responses.
GPT-5.1
GPT-5.1 130 tok/s
Gemini 3.0 Pro 29 tok/s Pro
Gemini 2.5 Flash 145 tok/s Pro
Kimi K2 191 tok/s Pro
Claude Sonnet 4.5 34 tok/s Pro
2000 character limit reached

Inner-MPDIoU Loss for PCB Defect Detection

Updated 16 November 2025
  • 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 BB and the ground-truth box BgtB^{gt} represented by their edges. It introduces an auxiliary ground-truth box BtB^t, generated by scaling BgtB^{gt} about its center by ratio r[0.5,1.5]r \in [0.5, 1.5]. The steps are:

  1. Auxiliary Box Construction:

blt=xgtWgtr brt=xgt+Wgtr btt=ygtHgtr bbt=ygt+Hgtr\begin{align*} b_l^t &= x^{gt} - W^{gt} \cdot r \ b_r^t &= x^{gt} + W^{gt} \cdot r \ b_t^t &= y^{gt} - H^{gt} \cdot r \ b_b^t &= y^{gt} + H^{gt} \cdot r \end{align*}

Here, (xgt,ygt)(x^{gt}, y^{gt}) is the center, and Wgt,HgtW^{gt}, H^{gt} are width and height.

  1. Intersection Area:

I=max(0,min(br,brt)max(bl,blt))max(0,min(bb,bbt)max(bt,btt))I = \max(0, \min(b_r, b_r^t)-\max(b_l, b_l^t)) \cdot \max(0, \min(b_b, b_b^t)-\max(b_t, b_t^t))

  1. Area Calculations:

At=4r2WgtHgt A=(brbl)(bbbt)A^t = 4r^2 W^{gt} H^{gt} \ A = (b_r - b_l) \cdot (b_b - b_t)

  1. Union:

U=A+AtIU = A + A^t - I

  1. Corner-Point Drift Penalty:

d1=(bltbl)2+(bttbt)2 d2=(brtbr)2+(bbtbb)2d_1 = (b_l^t - b_l)^2 + (b_t^t - b_t)^2 \ d_2 = (b_r^t - b_r)^2 + (b_b^t - b_b)^2

These terms measure discrepancies at the top-left and bottom-right corners.

  1. Image-Scale Normalization:

ρ2=Wimg2+Himg2\rho^2 = W_{img}^2 + H_{img}^2

  1. Inner-MPDIoU Metric:

InnerMPDIoU=IUd1+d2ρ2\text{InnerMPDIoU} = \frac{I}{U} - \frac{d_1 + d_2}{\rho^2}

  1. Loss Function:

LInner-MPDIoU=1InnerMPDIoU\mathcal{L}_{\text{Inner-MPDIoU}} = 1 - \text{InnerMPDIoU}

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 BtB^t focuses the metric on a controllable region of the ground-truth box via rr, allowing finer control over localization emphasis. For r<1r < 1, the loss prioritizes the core; for r>1r > 1, it relaxes localization to a larger region, compensating for slight labeling uncertainty or missing center alignment.
  • The intersection-over-union between BB and BtB^t directs optimization to achieve high overlap specifically in the scaled region.
  • The corner distance penalties (d1,d2d_1, d_2) penalize misalignments in both position and aspect, targeting failures that standard IoU or DIoU loss cannot fully capture.
  • Normalization by ρ2\rho^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.

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 rr:

  • Valid range: 0.5r1.50.5 \leq r \leq 1.5
  • r1.0r \approx 1.0 leaves the auxiliary box the same as ground-truth.
  • r<1.0r < 1.0 restricts the focus, exerting greater pressure on core alignment—effective for remedying box overshoot.
  • r>1.0r > 1.0 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 rr 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 ρ2\rho^2, 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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def inner_mpdiou_loss(pred_boxes, gt_boxes, img_wh, ratio):
    # pred_boxes, gt_boxes: (N,4) in (l, t, r, b) format
    W_img, H_img = img_wh
    rho2 = W_img*W_img + H_img*H_img

    # 1) auxiliary inner GT box
    x_gt = (gt_boxes[:,0]+gt_boxes[:,2]) * 0.5
    y_gt = (gt_boxes[:,1]+gt_boxes[:,3]) * 0.5
    W_gt = gt_boxes[:,2] - gt_boxes[:,0]
    H_gt = gt_boxes[:,3] - gt_boxes[:,1]
    lt = torch.stack([x_gt - W_gt*ratio,
                      y_gt - H_gt*ratio], dim=1)
    rb = torch.stack([x_gt + W_gt*ratio,
                      y_gt + H_gt*ratio], dim=1)

    # 2) intersection with pred_boxes
    lt_min = torch.max(pred_boxes[:,:2], lt)
    rb_min = torch.min(pred_boxes[:,2:], rb)
    wh_int = (rb_min - lt_min).clamp(min=0)
    I = wh_int[:,0] * wh_int[:,1]

    # 3) areas
    A_pred = (pred_boxes[:,2]-pred_boxes[:,0]) * (pred_boxes[:,3]-pred_boxes[:,1])
    A_aux  = (rb[:,0]-lt[:,0]) * (rb[:,1]-lt[:,1])
    U = A_pred + A_aux - I + 1e-7

    # 4) corner‐point distances
    d1 = (lt[:,0] - pred_boxes[:,0])**2 + (lt[:,1] - pred_boxes[:,1])**2
    d2 = (rb[:,0] - pred_boxes[:,2])**2 + (rb[:,1] - pred_boxes[:,3])**2

    # 5) Inner-MPDIoU metric
    inner_mpdiou = (I / U) - ((d1 + d2) / rho2)

    # 6) loss
    loss = 1.0 - inner_mpdiou.clamp(min=-1.0, max=1.0)
    return loss.mean()

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 rr 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 rr 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).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)
Forward Email Streamline Icon: https://streamlinehq.com

Follow Topic

Get notified by email when new papers are published related to Inner-MPDIoU Loss.