wikillm

Concept · 3 papers · updated 2026-11-01

Bounding-box regression loss

The loss that trains a detector's predicted box against its target box, built on IoU with optional penalty terms. Three wiki cards: Inner-IoU swaps the IoU term for the IoU of scaled auxiliary boxes; Edge YOLO uses plain CIoU; a loss survey gives the GIoU formula. Use a penalised IoU loss by default. The Inner-IoU ratio needs tuning, and its gains are single runs.

object-detectionloss-function

Markdown7 min read

AI-compiled overview, updated 2026-11-01, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

Overview

A box regression loss scores how far a predicted box is from its target box, and its gradient moves the prediction during training. The common base is one minus the intersection over union (IoU) of the two boxes [arxiv:2307.02694 §5.1.3]. Later losses keep that term and add penalties for things IoU ignores: boxes that do not overlap, centre distance, aspect ratio, and shape or angle 2311.02877 §1 2311.02877 §2.2.

The invariant all variants share is that the loss is zero only when the predicted and target boxes coincide, and that it decreases as the overlap grows 2311.02877 eq. 1-2.

Variants

Penalised IoU losses (GIoU, DIoU, CIoU, EIoU, SIoU)

These keep the IoU term and add a penalty computed on the full boxes. The penalties cover non-overlapping boxes, centre distance and aspect ratio, width and height, or angle, distance and shape 2311.02877 §1 [arxiv:2311.02877 §2.2]. The Inner-IoU card uses CIoU and SIoU as its baselines [arxiv:2311.02877 §4.2]. Neither the Inner-IoU card nor the survey card gives a DIoU or EIoU penalty formula, only the names 2311.02877 eq. 23-27 [arxiv:2307.02694 §5.1.3].

GIoU's penalty is given in the survey: the part of the smallest box enclosing both boxes that the union does not cover, divided by that enclosing area 2307.02694 §5.1.4. The survey lists DIoU and CIoU as detection losses but gives no formula for them 2307.02694 §5.1.4 [arxiv:2307.02694 tab. 2].

Inner-IoU: IoU of scaled auxiliary boxes

Inner-IoU replaces the IoU term of a penalised loss with the IoU of two auxiliary boxes. Each auxiliary box has the same centre as its original box, with width and height multiplied by one shared ratio 2311.02877 §3.2 2311.02877 eq. 15-18. The penalty terms stay on the full boxes 2311.02877 eq. 23-27. The method adds no new loss term 2311.02877 §1. Card: Inner-IoU.

The reason given for the ratio is a gradient analysis on one box of size 10 and auxiliary boxes of sizes 8 and 12 2311.02877 §3.1. For high-IoU samples the smaller auxiliary box gives a larger gradient than the real box, so a ratio below 1 is argued to speed up their regression. For low-IoU samples the larger auxiliary box gives the larger gradient, so a ratio above 1 is argued to help them 2311.02877 §3.1. The paper's general range for the ratio is about 0.5 to 1.5 2311.02877 §3.2.

Plain CIoU in an edge YOLO detector

Edge YOLO uses CIoU as its box term, in a single-stage YOLOv4-style detector for in-vehicle hardware 2205.14942 §III-B 2205.14942 eq. 5. The total loss is a plain sum of a class term, a confidence term and the CIoU term, with no weight on any of them 2205.14942 eq. 2. Card: Edge YOLO.

The paper reports no ablation of its loss. Its speed and accuracy results compare whole detectors, so they cannot show what the box term contributes 2205.14942 §IV. Use it as an example of CIoU in a YOLO-style pipeline, not as evidence that CIoU beats another box loss.

When to use which

SituationUseWhy
Default, no time to tune a lossA penalised IoU loss such as CIoU or SIoUThese are the baselines the Inner-IoU paper compares against 2311.02877 tab. 1 2311.02877 tab. 2. No ratio to choose.
Single-stage YOLO-style detector on edge hardwarePlain CIoU, as Edge YOLO doesThe paper uses CIoU in an unweighted loss sum 2205.14942 eq. 2 2205.14942 eq. 5. It gives no ablation, so there is no evidence here that CIoU beats another box loss 2205.14942 §IV.
Need a reference formula for GIoUThe survey's GIoU definitionThe survey gives it with the IoU loss 2307.02694 §5.1.3 2307.02694 §5.1.4. It is a survey with no experiments of its own 2307.02694 §1, so it gives no measured gains.
Most training boxes already overlap well, and you can afford a sweepInner variant with ratio below 1The paper's gradient argument covers high-IoU samples 2311.02877 §3.1. Its VOC runs used 0.70 to 0.80 2311.02877 tab. 1.
Many boxes overlap poorly, or the objects are very small and the ratio is free to tuneInner variant with ratio above 1The paper's argument covers low-IoU samples 2311.02877 §3.1. Its AI-TOD runs used 1.10 to 1.15 on objects averaging 12.8 px 2311.02877 §4.2 2311.02877 tab. 2. The paper does not tie the ratio to object size, so the size link is the paper's data, not its argument.
Loss other than CIoU or SIoU, such as GIoU, DIoU or EIoUTest before relying on itThe method is written for these losses 2311.02877 eq. 23-27, but the paper's experiments use only CIoU and SIoU 2311.02877 §4.2.
Tight training budgetPenalised IoU loss firstEach ratio is a separate training run. The paper's VOC runs used 150 epochs 2311.02877 §4.2. The paper reports no extra runtime cost for the inner boxes, and does not measure it 2311.02877 §4.2.

Two cautions apply to the inner variant. First, the paper gives no rule for choosing the ratio, and its tables show several values on the test set 2311.02877 §4.2. Second, the reported gains come from one run per row, with no variance reported 2311.02877 §4.2. A 0.6-point gain cannot be judged from the paper alone. Use a held-out split to pick the ratio, and run several seeds before claiming a gain.

Implementation sketch

The pseudocode below follows the description in the paper. It does not reproduce any released code. Its inputs are (x_centre, y_centre, width, height) boxes, which the paper does not state explicitly [arxiv:2311.02877 eq. 15-18].

Pseudocode
# Inner IoU of a predicted and a target box  [arxiv:2311.02877 eq. 15-21]
# pred, target: (x_centre, y_centre, width, height); ratio > 0

def inner_iou(pred, target, ratio):
    # Auxiliary boxes: same centre, sides multiplied by ratio  [eq. 15-18]
    aux_pred = scale_about_centre(pred, ratio)
    aux_target = scale_about_centre(target, ratio)

    # Overlap area of the two auxiliary boxes  [eq. 19]
    inter = overlap_area(aux_pred, aux_target)

    # Union from the scaled areas: ratio^2 times the sum, minus overlap
    # [eq. 20]
    union = ratio**2 * (area(pred) + area(target)) - inter

    # Inner IoU  [eq. 21]
    return inter / union
Pseudocode
# Penalised loss with the inner IoU term  [arxiv:2311.02877 eq. 22-27]
# base_penalty: a penalty computed on the full boxes, e.g. CIoU or SIoU

def inner_penalised_loss(pred, target, ratio, base_penalty):
    # IoU term is replaced by the inner IoU  [eq. 22]
    iou_term = 1 - inner_iou(pred, target, ratio)

    # Penalty stays on the full, unscaled boxes  [eq. 23-27]
    return iou_term + base_penalty(pred, target)
Pseudocode
# GIoU loss for two boxes  [arxiv:2307.02694 §5.1.3-§5.1.4]
# pred, target: boxes; the survey does not fix the box format

def giou_loss(pred, target):
    # Intersection and union areas  [§5.1.3]
    inter = overlap_area(pred, target)
    union = area(pred) + area(target) - inter
    iou = inter / union

    # Smallest box enclosing both boxes  [§5.1.4]
    enclosing = enclosing_area(pred, target)

    # 1 - IoU + (enclosing area not covered by the union) / enclosing area
    # [§5.1.4]
    return 1 - iou + (enclosing - union) / enclosing

Where the variants differ: the penalty function is the part that changes between CIoU, SIoU, GIoU and the other penalised losses. The paper's SIoU penalty has an angle term, a distance term and a shape term, and it has a shape exponent theta set to 4 in its experiments 2311.02877 eq. 9-14 2311.02877 eq. 13. The paper gives the range for theta as 2 to 6 2311.02877 §1. Edge YOLO's CIoU penalty is a centre-distance term over an enclosing-box size c, plus alpha times an aspect-ratio term v, with alpha set from v and the IoU 2205.14942 eq. 5-7.

Edge cases the paper does not discuss:

  • With a ratio below 1, two boxes that overlap a little can have auxiliary boxes that do not overlap. The inner IoU is then zero, and the IoU term gives no gradient 2311.02877 eq. 15-19. The penalty term still gives a gradient for CIoU and SIoU.
  • The union must stay positive, which requires a ratio above zero and boxes with positive width and height 2311.02877 eq. 20-21.
  • Edge YOLO does not define the enclosing-box size c in its text, so an implementation has to choose it 2205.14942 eq. 5.

Contradictions

Within the Edge YOLO paper, the box loss is named CIoU in its method section 2205.14942 eq. 5, but its experiments section says DIoU 2205.14942 §IV-B. Its loss equation is an unweighted sum 2205.14942 eq. 2, while the card records that the released config sets a box-term normalizer of 0.07 2205.14942 eq. 2. The repository has no loss source to check this against, so the weight behind the paper's results is not settled.

Within the Inner-IoU paper, the text says the VOC gains are above 0.5 points in AP50 and mAP50:95 2311.02877 §4.2. The AI-TOD table shows one ratio (1.10) lowering mAP50:95 by 0.17 points 2311.02877 tab. 2. The paper's own numbers are therefore mixed across datasets.

The survey gives no numeric results, so it does not conflict with the two experimental papers 2307.02694 §1.

Papers

  • Edge YOLO, arXiv:2205.14942: a YOLOv4-style edge detector whose box term is CIoU in an unweighted loss sum.
  • Loss Functions and Metrics in Deep Learning, arXiv:2307.02694: a survey of losses and metrics; gives the IoU and GIoU formulas for detection.
  • Inner-IoU, arXiv:2311.02877: auxiliary-box IoU term with a ratio in place of the plain IoU term, tested with CIoU and SIoU on VOC and AI-TOD.

Source and license

Compiled from the papers listed on this page, all published under CC BY, CC BY-SA or CC0, with citations. See each paper's page for its authors and license.