Summary
Decode boxes from a declared reference, then suppress overlaps against selected score leaders. NMS removes predictions; it does not cluster object identities.
Problem
An anchor has center , size and predicted deltas . Decode its center and size.
Separately, three same-class detections use corner coordinates :
| Box | Coordinates | Score |
|---|---|---|
| A | [0,0,10,10] | 0.94 |
| B | [2,0,12,10] | 0.82 |
| C | [20,0,30,10] | 0.76 |
Use continuous-coordinate area and strict suppression at . Which original indices survive?
Encoding the offsets
The decoder transforms anchor box and predicted deltas into a final box:
The decoded center is and size . Exponentiation gives positive sizes mathematically; implementations still need scale/clamp, overflow and invalid-box policies.
NMS
After score filtering, process the declared class groups:
- Sort descending by score; break ties by original input index in this example.
- Keep the leader; suppress remaining boxes whose IoU with it exceeds .
- Repeat using only remaining candidates.
- Stop at exhaustion or the declared output limit.
A/B intersection is and union is . Thus : keep A, suppress B, then keep disjoint C.
Learning objective
A suppressed box cannot suppress its neighbours
Derivation
Does B’s overlap with C matter after A has already removed B?
Change 1: Different Objects Overlap
New task. Crowded scenes lose true objects.
Picture and change. Compare class-aware suppression, Soft-NMS or another justified duplicate policy using recall and false positives.
Check. Overlap is not proof of one object.
Use when. Crowding causes suppression errors.
Change 2: Default Anchor Sizes Miss the Data
New task. Object scales differ from reference shapes.
Picture and change. Choose training-only shapes/matching or an anchor-free head; recheck decode and small-object coverage.
Check. Anchor-free need not mean NMS-free.
Use when. Reference geometry mismatches the task.
Failure: Three Thresholds Are Treated as One
Training matches label examples; inference NMS filters predictions; evaluation matches predictions to truth. Their IoU thresholds have different meanings and require separate decisions.
Transfer Check
Does NMS average retained and suppressed boxes?
Reasoned Answer
No. Greedy NMS retains original selected boxes. Weighted fusion is another operation.
Anchors
references can emit four offsets, class outputs and, in some heads, objectness. Then is a specific output convention, not universal. Specify logits/probabilities, score combination, coordinate transforms and area policy.
Anchor matching at training time
Illustrative matches: IoU above 0.7 positive, below 0.3 background, intermediate ignored. Specify boundaries, forced matches and ties for the actual detector. Hard-negative mining selects difficult negatives; focal loss reduces easy-example weight under its definition.
Variants
| Method | Change |
|---|---|
| Soft-NMS | Decay/reorder scores rather than hard removal; evaluate crowded scenes |
| Class-aware | Separate classes; shared-object/category policy still matters |
| Weighted fusion | Combine coordinates under explicit ensemble/grouping assumptions |
Naive pairwise NMS costs worst-case; sorting/top-K costs are separate. Lower thresholds suppress more against a fixed leader, not necessarily fewer total greedy survivors. For a separate counterexample, use descending scores A, B, C, D:
| Box | Coordinates |
|---|---|
| A | [0,0,10,10] |
| B | [4,0,14,10] |
| C | [4,-3,14,7] |
| D | [4,3,14,13] |
| Threshold | Survivors |
|---|---|
| 0.50 | A, B |
| 0.30 | A, C, D |
What replaced anchors and NMS
Set-prediction designs such as DETR use training-time one-to-one matching and a specified slot budget. Learned references and duplicate policies differ across versions; do not infer production prevalence or universal quality.
Common pitfalls
Define empty/invalid boxes, ties, strict inequalities, class mode, filtering and output limits before comparing implementations.