Paper · 2024-01-19 · cs.CV
Focaler-IoU: More Focused Intersection over Union Loss
Focaler-IoU maps IoU through a clipped linear ramp between two cut-offs d and u, then adds the gap between raw and mapped IoU to a base IoU-family box loss, so training focuses on chosen easy or hard boxes. Author-reported: Focaler-SIoU beats SIoU by +0.3 AP50 and +0.3 mAP50:95 on VOC with YOLOv8s, and by +1.9 AP50 and +0.5 mAP50:95 on AI-TOD with YOLOv5s.
Bounding-box regression lossObject detectionFocal lossloss-functionobject-detectionbounding-box-regression
arXivPDFCodeMarkdown9 min read
AI-compiled by claude-haiku-5-5 on 2026-11-12, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
An object detector learns by comparing each box it predicts with the true box. The comparison score used here is IoU: the overlap of the two boxes divided by the area they cover together. The paper argues that training should pay attention to the right mix of boxes. Some boxes are easy, already close to the truth, and some are hard, such as very small objects. Which mix deserves the most attention depends on the detection task.
Focaler-IoU changes how the overlap score is read. Overlap below a lower cut-off counts as zero, overlap above an upper cut-off counts as full, and the range in between is stretched to run from zero to one. Moving the two cut-offs moves the band of overlap values that drives the training signal, a little like choosing which band of a dial the learner listens to.
The change is added on top of an existing IoU-based box loss rather than replacing it. The authors test it with one such loss, SIoU, on two detectors and two datasets, and report small gains.
TL;DR
Focaler-IoU replaces the raw IoU in a box loss with a clipped linear ramp of IoU between cut-offs d and u, and adds the difference IoU − IoU^focaler to the base loss eq. 14 eq. 16. Only Focaler-SIoU is tested, on YOLOv8s (VOC) and YOLOv5s (AI-TOD), with gains of +0.3 to +1.9 AP50 tab. 1 tab. 2. The paper gives no values for d and u used in the experiments. The official repository holds one line of code, with defaults d = 0.00 and u = 0.95 focaleriou.py. Use it when your box loss is IoU-based and your data has many tiny or hard boxes.
Problem
IoU-based box losses have a known weakness: when a predicted box does not overlap the true box, the gradient vanishes, so the loss gives no direction to move §I-A. Earlier IoU-family losses add geometric terms, but the abstract states they ignore how easy and hard samples are distributed in regression [abstract]. The paper argues that the best emphasis differs by task. Where simple samples dominate, focusing on them helps. Where difficult samples form a high share, focusing on difficult samples is needed §III-A. Extremely small targets count as difficult because they are hard to localise precisely §III-A.
Assumption: the implementer must know, or choose, which regime the task is in. The paper gives no rule or statistic for measuring the share of difficult samples §III-A.
Method
Focaler-IoU keeps the standard IoU value and passes it through a piecewise linear map with two cut-offs d and u eq. 14 §III-B. The mapped value replaces IoU inside a correction term that is added to a base box loss. The paper defines this for GIoU, DIoU, CIoU, EIoU and SIoU eq. 16 to eq. 20 §III-B. The base losses are those metrics in Related Work, reproduced below §II.
Setting d = 0 and u = 1 makes IoU^focaler equal to IoU, so the correction term vanishes and the base loss is unchanged (derived from eq. 14 and eq. 16). The paper's experiments use only Focaler-SIoU §IV-A §IV-B.
Equation numbers below are counted from the LaTeX source, because only the source was available (see Pitfalls).
Background: IoU and its extensions §II
The IoU between predicted box B and ground-truth box B^gt §II-A:
IoU = \frac{|B \cap B^{gt}|}{|B \cup B^{gt}|} eq. 1 §II-A
GIoU, which adds a penalty based on the smallest enclosing box C §II-B:
GIoU = IoU - \frac{|C - B \cap B^{gt}|}{|C|} eq. 2 §II-B
DIoU, which adds the normalised squared distance between the box centres b and b^gt, where c is the diagonal of the smallest enclosing box and ρ is the Euclidean distance §II-C:
DIoU = IoU - \frac{\rho^{2}(b, b^{gt})}{c^{2}} eq. 3 §II-C
CIoU, which adds an aspect-ratio term αv §II-C:
CIoU = IoU - \frac{\rho^{2}(b, b^{gt})}{c^{2}} - \alpha v eq. 4 §II-C
\alpha = \frac{v}{(1 - IoU) + v} eq. 5 §II-C
v = \frac{4}{\pi^{2}} \left( \arctan\frac{w^{gt}}{h^{gt}} - \arctan\frac{w}{h} \right)^{2} eq. 6 §II-C
Here w and h are the width and height of the predicted box, and w^gt and h^gt those of the ground-truth box §II-C.
EIoU, which replaces the aspect term with separate width and height terms, normalised by the enclosing box sides w^c and h^c §II-D:
EIoU = IoU - \frac{\rho^{2}(b, b^{gt})}{c^{2}} - \frac{\rho^{2}(w, w^{gt})}{(w^{c})^{2}} - \frac{\rho^{2}(h, h^{gt})}{(h^{c})^{2}} eq. 7 §II-D
SIoU, which adds an angle term Δ and a shape term Ω §II-E:
SIoU = IoU - \frac{\Delta + \Omega}{2} eq. 8 §II-E
\Lambda = \sin\left( 2 \sin^{-1} \frac{\min(|x_c^{gt} - x_c|, |y_c^{gt} - y_c|)}{\sqrt{(x_c^{gt} - x_c)^{2} + (y_c^{gt} - y_c)^{2}} + \epsilon} \right) eq. 9 §II-E
\Delta = \sum_{t = w, h} \left(1 - e^{-\gamma \rho_t}\right), \quad \gamma = 2 - \Lambda eq. 10 §II-E
\rho_x = \left( \frac{x_c - x_c^{gt}}{w^{c}} \right)^{2}, \quad \rho_y = \left( \frac{y_c - y_c^{gt}}{h^{c}} \right)^{2} eq. 11 §II-E
\Omega = \sum_{t = w, h} \left(1 - e^{-\omega_t}\right)^{\theta}, \quad \theta = 4 eq. 12 §II-E
\omega_w = \frac{|w - w^{gt}|}{\max(w, w^{gt})}, \quad \omega_h = \frac{|h - h^{gt}|}{\max(h, h^{gt})} eq. 13 §II-E
Focaler-IoU mapping and loss §III-B
The Focaler-IoU mapping is piecewise: 0 below d, a linear ramp between d and u, and 1 above u eq. 14 §III-B. The paper requires [d, u] ⊂ [0, 1] §III-B.
IoU^{focaler} = \begin{cases} 0, & IoU < d \\ \dfrac{IoU - d}{u - d}, & d \ll IoU \ll u \\ 1, & IoU > u \end{cases} eq. 14 §III-B
The stand-alone Focaler-IoU loss eq. 15 §III-B:
L_{\text{Focaler-IoU}} = 1 - IoU^{focaler} eq. 15 §III-B
The Focaler versions of the base losses add the correction IoU − IoU^focaler eq. 16 to eq. 20 §III-B:
L_{Focaler\text{-}GIoU} = L_{GIoU} + IoU - IoU^{Focaler} eq. 16 §III-B
L_{Focaler\text{-}DIoU} = L_{DIoU} + IoU - IoU^{Focaler} eq. 17 §III-B
L_{Focaler\text{-}CIoU} = L_{CIoU} + IoU - IoU^{Focaler} eq. 18 §III-B
L_{Focaler\text{-}EIoU} = L_{EIoU} + IoU - IoU^{Focaler} eq. 19 §III-B
L_{Focaler\text{-}SIoU} = L_{SIoU} + IoU - IoU^{Focaler} eq. 20 §III-B
The paper does not write out L_GIoU, L_DIoU, L_CIoU, L_EIoU or L_SIoU as functions of their metric. Take them from the sources the paper cites.
The following pseudocode implements the mapping and the correction in our own words. It is not in the paper, and the paper contains no algorithm block.
# Focaler-IoU mapping, clipped linear ramp [eq. 14]
# Requires d < u, both in [0, 1] [§III-B]
def focaler_iou(iou, d, u):
# Linear ramp from d to u, clipped to [0, 1] [eq. 14]
ramp = (iou - d) / (u - d)
return min(max(ramp, 0.0), 1.0)# Stand-alone Focaler-IoU loss [eq. 15]
def focaler_iou_loss(iou, d, u):
# One minus the mapped IoU [eq. 15]
return 1.0 - focaler_iou(iou, d, u)# Correction term added to a base loss [eq. 16] to [eq. 20]
def focaler_correction(iou, d, u):
# Raw IoU minus mapped IoU, using the un-mapped IoU [eq. 16]
return iou - focaler_iou(iou, d, u)# Focaler version of any base IoU-family loss [eq. 16] to [eq. 20]
def focaler_loss(base_loss, iou, d, u):
# Base loss L_X plus the correction, e.g. L_Focaler-SIoU [eq. 20]
return base_loss + focaler_correction(iou, d, u)Hyperparameters
| Name | Value | Where | Notes |
|---|---|---|---|
| d (lower cut-off) | not stated for the experiments; code default 0.00 | §III-B focaleriou.py | Paper gives no value. Default from the code comment. |
| u (upper cut-off) | not stated for the experiments; code default 0.95 | §III-B focaleriou.py | Paper gives no value. Default from the code comment. Not among the values in fig. 1. |
| Constraint on d, u | [d, u] ⊂ [0, 1]; d < u needed for the division | §III-B eq. 14 | d < u is implied by the formula, not stated in the paper. |
| Base loss in experiments | SIoU | §IV-A §IV-B | Only Focaler-SIoU is tested. |
| SIoU γ | γ = 2 − Λ | eq. 10 | Stated in the paper. |
| SIoU θ | 4 | eq. 12 | Stated in the paper. |
| SIoU ε | not stated | eq. 9 | Small constant in the Λ denominator; value not given. |
| Detector, VOC experiment | YOLOv8s | §IV-A tab. 1 | YOLOv7-tiny is named in §IV-A but has no results. |
| Detector, AI-TOD experiment | YOLOv5s | §IV-B tab. 2 | |
| VOC training set | VOC2007 and VOC2012 train and val, 16551 images | §IV-A | |
| VOC test set | VOC2007 test, 4952 images | §IV-A | |
| AI-TOD dataset | remote sensing; average target size 12.8 px | §IV-B | Image counts and split not stated. |
| Optimiser, learning rate, epochs, batch size, input size, augmentation, hardware | not stated | §IV | |
| Number of runs, variance | not stated | §IV | Results are single reported numbers. |
Results
Author-reported. Setup: VOC and AI-TOD object detection, YOLOv8s and YOLOv5s detectors, SIoU as the baseline §IV. Hardware is not stated. The deltas in the tables are the authors' own, and they match the differences of the reported values.
| Setting | Metric | Baseline (SIoU) | This paper (Focaler-SIoU) | Source |
|---|---|---|---|---|
| YOLOv8s, VOC (train VOC07+12, test VOC07) | AP50 | 69.5 | 69.8 (+0.3) | tab. 1 §IV-A |
| YOLOv8s, VOC (train VOC07+12, test VOC07) | mAP50:95 | 48.3 | 48.6 (+0.3) | tab. 1 §IV-A |
| YOLOv5s, AI-TOD | AP50 | 42.7 | 44.6 (+1.9) | tab. 2 §IV-B |
| YOLOv5s, AI-TOD | mAP50:95 | 18.1 | 18.6 (+0.5) | tab. 2 §IV-B |
The paper reports no results for Focaler-GIoU, DIoU, CIoU or EIoU, and none for YOLOv7-tiny §IV-A.
Paper vs code
Official code: https://github.com/malagoutou/Focaler-IoU, at commit d4dfc34a8945a1d37d3131efd24c9cbe0b396733. The arXiv abstract links it. The repository holds one Python line and a README focaleriou.py README.md. Only the mapping can be checked against it:
- The code computes
((iou - d) / (u - d)).clamp(0, 1)focaleriou.py. For d < u this equals eq. 14, because clamping gives 0 below d and 1 above u. - The defaults d = 0.00 and u = 0.95 appear only in the code comment focaleriou.py. The paper gives no values §III-B. Its figure shows u in {1.0, 0.9, 0.8} and d in {0.0, 0.1, 0.2} fig. 1, so the code default u = 0.95 is not one of the illustrated values.
- Not in the repository: the combined losses eq. 16 to eq. 20, the base GIoU, DIoU, CIoU, EIoU and SIoU losses, the detector integration, and the training configuration. The experiments cannot be checked against code.
- The line overwrites
iouin place focaleriou.py. If the surrounding loss code readsiouafterwards for the "+ IoU" term of eq. 16 to eq. 20, the correction would become zero. The snippet does not show the caller, so check it.
No discrepancy between the mapping in the code and eq. 14 was found.
Pitfalls
- Gradient of the correction. Inside the ramp, the derivative of IoU − IoU^focaler with respect to IoU is 1 − 1/(u − d). Outside the ramp it is 1 (derived from eq. 14 and eq. 16). The paper does not say whether IoU is detached (stop-gradient) in the correction. Choose one and record it.
- Boundary cases. The middle case of eq. 14 is typeset with ≪ rather than ≤. At IoU = d the ramp gives 0 and at IoU = u it gives 1, so the choice of boundary does not change the value.
- d < u. The formula divides by u − d. The paper only requires [d, u] ⊂ [0, 1] §III-B. Reject d ≥ u.
- No tuned values. The paper gives no d or u for its experiments. The code default u = 0.95 is not one of the figure values fig. 1. Treat d and u as hyperparameters to tune, not as settled values.
- Base losses undefined in the paper. L_GIoU, L_DIoU, L_CIoU, L_EIoU and L_SIoU are used in eq. 16 to eq. 20 but never written out. Implement them from the cited sources.
- GIoU penalty as typeset. eq. 2 reads |C − B∩B^gt| / |C|, which subtracts the intersection from C. Implement the penalty from the GIoU source the paper cites (bibliography entry [9]), not from this typeset form.
- Constant ε in SIoU. eq. 9 contains a small constant typeset as ∈ (most likely ε). Its value is not stated, and it is needed to avoid division by zero.
- ρ notation. eq. 10 sums over ρ_t for t = w, h, but eq. 11 defines ρ_x and ρ_y. Read ρ_t as the per-axis terms of eq. 11. This is our reading, not the paper's.
- ρ for widths. §II-C defines ρ as the Euclidean distance. eq. 7 applies it to scalar widths and heights, and the paper does not say what it means there.
- Capitalisation. eq. 14 and eq. 15 write IoU^focaler, and eq. 16 to eq. 20 write IoU^Focaler. Treat them as the same quantity.
- Naming. The paper calls the same box both "predicted" (B) and "anchor box" in different places §II-A §II-C. Use one name in code.
- Only SIoU tested. The five Focaler variants §III-B are not compared against their base losses on any dataset. Gains for GIoU, DIoU, CIoU and EIoU are unverified.
- Small effects, no variance. The gains are +0.3 AP50 and +0.3 mAP50:95 on VOC tab. 1, and +1.9 and +0.5 on AI-TOD tab. 2. The number of runs and any variance are not stated. Repeat runs before relying on the VOC gain.
- AI-TOD details missing. The dataset's image count, split and class list are not stated §IV-B. The 12.8 px average target size §IV-B is the only size figure.
- Figure cues. fig. 1 shows the mapping curves for difficult samples (panel a, varying u) and simple samples (panel b, varying d), in the paper's labels §III-A fig. 1. The paper gives no value of d or u for either panel's experiments.
- Source numbering. Section, equation, table and figure numbers were counted from the LaTeX source, because only the source was available. Section numbers use IEEEtran's Roman and letter style, for example §III-B. The compiled PDF was not checked, so a reader may see different numbers.
Lineage
- Builds on: IoU eq. 1 (bibliography entry [8]); GIoU eq. 2 (entry [9]); DIoU and CIoU eq. 3 to eq. 6 (entry [10]); EIoU eq. 7 (entry [12]); SIoU eq. 8 to eq. 13 (arXiv:2205.12740, entry [11]). Focal Loss and Libra R-CNN motivate the easy-versus-hard framing §I-B.
- Compared against: the SIoU baseline on both experiments tab. 1 tab. 2.
- Superseded by: not stated.
Source and license
Adapted from “Focaler-IoU: More Focused Intersection over Union Loss” by Hao Zhang, Shuaijie Zhang (arXiv:2401.10525), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/malagoutou/Focaler-IoU at commit d4dfc34a8945 (none (no LICENSE file in repository)). Any quoted code is shown under that license.