Simple Algorithm
Deep Learning · Emergence · 26 min

Real-Time & Anchor-Free Detectors

The YOLO family, keypoint and center-based detectors, and the speed–accuracy frontier.

The first YOLO looked at an image once and returned its boxes at 45 frames per second. Since then real-time detectors have taken on anchors, shed them again and finally shed non-maximum suppression, and much of the accuracy they gained came from a question that sounds like bookkeeping: during training, which predictions are told that they are responsible for which object?

What you’ll learn

  • Describe YOLO's grid formulation and loss, and derive how regressing ww, w\sqrt w or log⁡w\log w weighs the errors of large and small boxes.
  • Follow YOLOv2 and YOLOv3's priors, scales and parametrizations, and sort out who built the later YOLO versions.
  • Prove when an anchor grid leaves an object with no anchor above an IoU threshold, and connect it to the measured best possible recall of real detectors.
  • Explain detection from corners (CornerNet), center heatmaps (CenterNet) and points with centerness (FCOS), and decode a heatmap without IoU-based NMS.
  • Weigh the evidence that label assignment, not anchors, separates detectors; explain NMS-free training; and measure detector speed honestly.

The YOLO family

YOLO (Redmon, Divvala, Girshick & Farhadi, 2016) treats detection as one regression from pixels to a fixed tensor. The image is divided into an S×SS\times S grid, and the cell that contains an object's center is responsible for it. Each cell predicts BB boxes (x,y,w,h)(x,y,w,h), each with a confidence trained toward Pr⁡(object)⋅IoU(prediction,truth)\Pr(\text{object})\cdot\mathrm{IoU}(\text{prediction},\text{truth}), and one set of CC class probabilities Pr⁡(classi∣object)\Pr(\text{class}_i\mid\text{object}) shared by its boxes. With S=7S=7, B=2B=2 and C=20C=20 the output is 7×7×(5B+C)=7×7×307\times7\times(5B+C)=7\times7\times30: 98 boxes per image, each scored at test time by Pr⁡(classi∣object)Pr⁡(object) IoU\Pr(\text{class}_i\mid\text{object})\Pr(\text{object})\,\mathrm{IoU}.

The loss is a sum of squared errors with two weights: λcoord=5\lambda_{\text{coord}}=5 on box coordinates and λnoobj=0.5\lambda_{\text{noobj}}=0.5 on the confidences of boxes that contain no object, which would otherwise pull most confidences to zero and swamp the few cells with objects. Of the BB predictors in a cell, the one whose current box has the highest IoU with the object is made responsible, so predictors specialize in sizes and shapes. Widths and heights enter through their square roots, a choice the paper says "partially" addresses the fact that the same error matters more for a small box. How partially is a short calculation.

DerivationHow a box loss weighs size
  1. IoU=min⁡(w,w^)max⁡(w,w^)=11+ε,1−IoU=ε+O(ε2)\mathrm{IoU}=\frac{\min(w,\hat w)}{\max(w,\hat w)}=\frac1{1+\varepsilon},\qquad 1-\mathrm{IoU}=\varepsilon+\order{\varepsilon^2}

    Let the true width be ww and the predicted width w^=w(1+ε)\hat w=w(1+\varepsilon), a relative error ε≥0\varepsilon\ge0, with center and height exact. The IoU then depends on ε\varepsilon alone, the same for a 10-pixel box as for a 300-pixel one:

  2. (w^−w)2=w2ε2(\hat w-w)^2=w^2\varepsilon^2

    A plain squared error charges the same relative error in proportion to the square of the box size, so large boxes dominate the loss:

  3. (w^−w)2=w(1+ε−1)2=w ε24+O(wε3)\big(\sqrt{\hat w}-\sqrt w\big)^2=w\big(\sqrt{1+\varepsilon}-1\big)^2=\frac{w\,\varepsilon^2}{4}+\order{w\varepsilon^3}

    Square roots reduce the dependence to the first power of the size:

  4. (log⁡w^−log⁡w)2=log⁡2(1+ε)=ε2+O(ε3)(\log\hat w-\log w)^2=\log^2(1+\varepsilon)=\varepsilon^2+\order{\varepsilon^3}

    Log-space targets, as in Faster R-CNN and in YOLOv2's bw=pwetwb_w=p_we^{t_w}, remove it, matching the scale invariance of IoU itself. Losses built on IoU, such as GIoU, go one step further and optimize the overlap directly.

YOLO ran at 45 frames per second (a smaller Fast YOLO at 155) with 63.4% mAP on PASCAL VOC 2007, against 70.0% at 0.5 frames per second for Fast R-CNN. Its errors differed in kind: localization errors outnumbered all others combined, while Fast R-CNN was almost three times as likely to fire on background. With two boxes and one class per cell, YOLO struggled with small objects in groups, such as flocks of birds.

YOLOv2 (Redmon & Farhadi, 2017) kept the single pass and adopted anchors. It dropped the fully connected layers and shrank the input to 416×416416\times416, so the stride-32 output is 13×1313\times13, an odd size with a single center cell for the many large objects centered in photos. Instead of hand-picking anchor shapes it ran k-means on the training boxes with the distance d=1−IoU(box,centroid)d=1-\mathrm{IoU}(\text{box},\text{centroid}), because Euclidean distance on (w,h)(w,h) lets large boxes dominate: 5 centroids matched the average IoU of 9 hand-picked anchors (61.0 vs. 60.9). Box centers stay inside their cell through a sigmoid, bx=σ(tx)+cxb_x=\sigma(t_x)+c_x, which stabilized early training. Anchors alone lowered mAP slightly, from 69.5 to 69.2, but raised recall from 81% to 88%; with all its changes YOLOv2 reached 76.8% mAP at 67 frames per second.

Predict before you look

How many boxes does YOLOv2 predict for a 416×416416\times416 image, with 5 priors at every cell of its stride-32 output?

Show the answer

845

416/32=13416/32=13, so 13×13×5=84513\times13\times5=845 boxes, almost nine times YOLOv1's 98. YOLOv3 at the same size predicts at strides 32, 16 and 8 with 3 priors each: (132+262+522)×3=10,647(13^2+26^2+52^2)\times3=10{,}647 boxes, every one of which NMS must consider.

YOLOv3 (Redmon & Farhadi, 2018) predicted at three scales through an FPN-like upsampling path, with 3 of 9 k-means priors per scale, and replaced the softmax by independent logistic classifiers, since labels such as "woman" and "person" overlap. It also shows why the metric matters: at 608×608608\times608 it reached 57.9 AP50_{50} on COCO, close to the 59.1 of RetinaNet with a ResNet-101 FPN, but 33.0 AP averaged over IoU thresholds 0.50–0.95, against 39.1. Its boxes found the objects but were not tightly aligned. YOLOv3 was the last version by Redmon and Farhadi; the name passed to other groups:

VersionAuthorsWhat changed
YOLOv4 (2020)Bochkovskiy, Wang & Liaoa systematic test of training-only "freebies" and cheap inference-time "specials": CSPDarknet53 backbone, Mosaic augmentation, CIoU box loss; 43.5% COCO AP at about 65 frames per second on a V100
YOLOv5 (2020), YOLOv8 (2023)Ultralyticssoftware releases without accompanying papers; YOLOv8 has an anchor-free head
YOLOX (2021)Ge, Liu, Wang, Li & Sunanchor-free, separate classification and regression heads, SimOTA label assignment
YOLOv7 (CVPR 2023)Wang, Bochkovskiy & Liaoarchitecture changes and "trainable" freebies, trained on COCO from scratch
YOLOv10 (NeurIPS 2024)Wang et al.NMS-free training with consistent dual label assignments
Version numbers mark releases by different groups, not one line of descent. Successive versions changed architecture, training recipe (long schedules, Mosaic and MixUp augmentation), resolution and evaluation code at once, so the gain of a single idea is rarely isolated; ablation roadmaps such as YOLOX's, in the fourth step, are the informative comparisons.

Where anchors leave gaps

An anchor-based detector can only learn to find an object if some anchor is labeled positive for it, which requires an IoU above a threshold τ\tau (0.5 in RetinaNet, 0.7 in Faster R-CNN's proposal network). Anchors sit on a grid of stride SS at a few discrete sizes, so some objects fall between them. How far between can be computed exactly.

DerivationProof
  1. IoU=(a−∣δx∣)(a−∣δy∣)2a2−(a−∣δx∣)(a−∣δy∣)\mathrm{IoU}=\frac{(a-|\delta_x|)(a-|\delta_y|)}{2a^2-(a-|\delta_x|)(a-|\delta_y|)}

    Two squares of side aa whose centers differ by (δx,δy)(\delta_x,\delta_y), with ∣δx∣,∣δy∣≤a|\delta_x|,|\delta_y|\le a, intersect in an (a−∣δx∣)×(a−∣δy∣)(a-|\delta_x|)\times(a-|\delta_y|) rectangle. Since I/(2a2−I)I/(2a^2-I) increases with the intersection II, the IoU decreases in both offsets:

  2. u2−u≥τ  ⟺  u≥2τ1+τ  ⟺  1−S2a≥2τ1+τ\frac{u}{2-u}\ge\tau\iff u\ge\frac{2\tau}{1+\tau}\iff1-\frac{S}{2a}\ge\sqrt{\frac{2\tau}{1+\tau}}

    The nearest anchor center is at most S/2S/2 away in each coordinate, with equality at a cell corner. Put ∣δx∣=∣δy∣=S/2|\delta_x|=|\delta_y|=S/2 and solve u/(2−u)≥τu/(2-u)\ge\tau:

  3. max⁡anchorsIoU ≥ (2−1/(2n))2=2−1/n□\max_{\text{anchors}}\mathrm{IoU}\ \ge\ \big(2^{-1/(2n)}\big)^2=2^{-1/n}\qquad\square

    For (b), a square of side ss centered inside one of side a≥sa\ge s gives IoU s2/a2s^2/a^2, which falls as the ratio a/sa/s grows. Between anchor sides aja_j and aj21/na_j2^{1/n} the best ratio is worst at the geometric midpoint s=aj21/(2n)s=a_j2^{1/(2n)}, where it equals 21/(2n)2^{1/(2n)} on both sides:

Position and scale errors compound, and real objects are not square, so the true worst cases are worse. Two consequences follow. Small objects need fine strides: on RetinaNet's finest level (S=8S=8, smallest anchor 32 pixels, so a=4Sa=4S) a same-size object is safe at any position (worst IoU 0.62), but a 16-pixel object reaches only (16/32)2=0.25(16/32)^2=0.25 even when perfectly centered, and nothing below about 22.6 pixels can reach 0.5 with a 32-pixel anchor. And coarse scale spacing alone can push objects to the threshold, which is why RetinaNet places three scales per octave, {20,21/3,22/3}\{2^0,2^{1/3},2^{2/3}\}, times three aspect ratios: in its ablation, 9 anchors per location reached 34.0 AP against 30.3 for one square anchor, with no gain beyond 6–9.

The gaps are measurable. Tian et al. (2019) counted the best possible recall, the fraction of COCO objects assigned to at least one anchor or location during training. RetinaNet's anchors with IoU ≥0.5\ge0.5 alone cover 86.8% of objects; adding "low-quality" matches down to IoU 0.4 gives 90.9%, and assigning every object its best anchor whatever the IoU gives 99.2%. Faster R-CNN's proposal network uses the same remedy: each object's best-overlapping anchor is positive even below 0.7. An anchor-free detector that assigns every location inside a box covered 95.6% from one stride-16 level and 98.4% with a feature pyramid.

Corners, centers and points

Anchor-free detectors replace box templates with keypoints, or with every location of a feature map.

CornerNet (Law & Deng, 2018) detects a box as a pair of keypoints. For each class one heatmap marks top-left corners and another bottom-right corners; each detected corner also outputs an embedding, trained so that the two corners of one object have similar embeddings (a "pull" loss) and corners of different objects dissimilar ones (a "push" loss), and corners are paired by their embeddings. A corner often lies outside the object (think of a ball), so a corner pooling layer takes, at each location, the maximum of one feature map over everything to its right plus the maximum of another over everything below, the directions in which the object's top and left edges appear. As the authors note, O(wh)\order{wh} corner positions encode O(w2h2)\order{w^2h^2} possible boxes. CornerNet reached 42.2% COCO AP.

CenterNet, "Objects as Points" (Zhou, Wang & Krähenbühl, 2019), keeps only the center. At output stride R=4R=4 the network predicts one heatmap per class, in which each object is a Gaussian exp⁡(−∥p−p~∥2/2σp2)\exp\big(-\norm{\mathbf p-\tilde{\mathbf p}}^2/2\sigma_p^2\big) around its downsampled center p~\tilde{\mathbf p} with a size-adaptive σp\sigma_p, and at every location a width and height and a sub-cell offset: C+4C+4 output channels. The heatmap Y^\hat Y is trained against these targets YY with a variant of the focal loss, the size and offset with L1L_1 losses at the centers only:

Lk=−1N∑x,y,c{(1−Y^xyc)αlog⁡Y^xyc,Yxyc=1(1−Yxyc)β Y^xycαlog⁡(1−Y^xyc),otherwise\loss_k=-\frac1N\sum_{x,y,c}\begin{cases}(1-\hat Y_{xyc})^{\alpha}\log\hat Y_{xyc}, & Y_{xyc}=1\\[2pt](1-Y_{xyc})^{\beta}\,\hat Y_{xyc}^{\alpha}\log\big(1-\hat Y_{xyc}\big), & \text{otherwise}\end{cases}
NN is the number of objects, α=2\alpha=2 and β=4\beta=4, following CornerNet. Far from any center Y≈0Y\approx0 and the factor (1−Y)β≈1(1-Y)^\beta\approx1; next to a center the penalty for predicting a high value fades, because a peak one cell off still gives a usable box.
python
import torch
import torch.nn.functional as F

def decode_centers(heat, size, offset, k=100):
    """heat: (C, H, W) center heatmap in [0, 1]; size, offset: (2, H, W). Boxes in output-grid units."""
    C, H, W = heat.shape
    is_peak = heat == F.max_pool2d(heat[None], kernel_size=3, stride=1, padding=1)[0]
    scores, idx = (heat * is_peak).flatten().topk(k)    # local maxima only: no IoU-based NMS
    cls, pos = idx // (H * W), idx % (H * W)
    y, x = pos // W, pos % W
    cx, cy = x + offset[0, y, x], y + offset[1, y, x]   # sub-cell offsets undo the stride's rounding
    w, h = size[0, y, x], size[1, y, x]
    boxes = torch.stack([cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2], dim=1)
    return boxes, scores, cls                            # multiply boxes by the stride R for pixels

A peak is any heatmap value at least as large as its 8 neighbors, found with one 3×33\times3 max pooling, and the 100 highest are kept (a score threshold then drops weak ones). Each object's target is a single Gaussian bump, so a trained heatmap usually has one peak per object: the authors call peak extraction a sufficient alternative to NMS, although a plateau of equal values or a second bump can still yield a duplicate. CenterNet ran at 142 frames per second with 28.1% COCO AP on a ResNet-18 and at 52 with 37.4% on DLA-34. (Its best result, 45.1% with an Hourglass-104 network, used flipped and multi-scale testing, whose results are merged with NMS. A keypoint-triplet detector by Duan et al., from the same month, is also called CenterNet.)

FCOS (Tian et al., 2019) predicts at every location of a feature pyramid. A location inside a true box is positive and regresses the four distances (l∗,t∗,r∗,b∗)(l^*,t^*,r^*,b^*) from itself to the box's sides. Each level P3P_3 to P7P_7 (strides 8 to 128) handles one range of sizes: a location on level ii stays positive only if mi−1≤max⁡(l∗,t∗,r∗,b∗)≤mim_{i-1}\le\max(l^*,t^*,r^*,b^*)\le m_i, with m2,…,m7=0,64,128,256,512,∞m_2,\dots,m_7=0,64,128,256,512,\infty, and a location still inside two boxes takes the smaller. Locations far from an object's center produce poor boxes, so a one-layer branch predicts the centerness:

centerness∗=min⁡(l∗,r∗)max⁡(l∗,r∗)⋅min⁡(t∗,b∗)max⁡(t∗,b∗)\text{centerness}^*=\sqrt{\frac{\min(l^*,r^*)}{\max(l^*,r^*)}\cdot\frac{\min(t^*,b^*)}{\max(t^*,b^*)}}
It is 1 at the box center and falls to 0 at the edges, and it is trained with binary cross-entropy. At test time it multiplies the class score, so off-center boxes rank low and the NMS that FCOS still uses removes them. A location a quarter of the way across a box, at mid-height, has l∗/r∗=1/3l^*/r^*=1/3 and centerness 1/3≈0.58\sqrt{1/3}\approx0.58.

Is the anchor what matters, then? ATSS (Zhang et al., 2020) took RetinaNet with one square anchor per location, which scored 32.5 AP on COCO minival against FCOS's 37.8, and gave it FCOS's general improvements one at a time: group normalization in the heads, a GIoU loss, positives restricted to locations inside the box, the centerness branch and a learnable scale per level. That reached 37.0. Two differences remained, and crossing them shows which one matters:

Positives chosen byRegress from the anchor boxRegress from the point
IoU with the anchor (RetinaNet's rule)37.036.9
inside the box and in the level's size range (FCOS's rule)37.837.8
COCO minival AP (Zhang et al., 2020). Regressing from a box or from a point makes no difference; how positive and negative samples are defined makes all of it.

ATSS then made the definition adaptive. For each object it takes the k=9k=9 anchors whose centers are closest to the object's center on each of the LL pyramid levels, computes their IoUs with the object, and makes positive the candidates whose IoU is at least the mean plus one standard deviation of these kLkL values and whose centers lie inside the box. Were the IoUs normally distributed, 1−Φ(1)≈16%1-\Phi(1)\approx16\% of candidates would pass; the authors measured about 0.2kL0.2kL positives per object whatever its size, where fixed IoU or size rules give large objects many more. At no inference cost it lifted RetinaNet to 39.3 AP and FCOS to 39.2.

NMS-free training and honest speed

Later rules let the network's own predictions decide. OTA (Ge et al., 2021) treats assignment as optimal transport over the whole image: objects supply labels, predictions demand them, the unit cost of a pair is a weighted sum of its classification and regression losses, and the cheapest transport plan, found with Sinkhorn–Knopp iterations, is the assignment. Its approximation in YOLOX, SimOTA, gives each object its kk lowest-cost predictions within a central region, with kk estimated per object. YOLOX's roadmap measured every change on COCO with one backbone (Darknet-53, 640×640640\times640):

ChangeAPGain
YOLOv3 baseline38.5—
separate classification and regression heads39.6+1.1
strong augmentation (Mosaic, MixUp)42.0+2.4
anchor-free, one positive per object42.9+0.9
multiple positives (the central 3×33\times3 locations)45.0+2.1
SimOTA assignment47.3+2.3
end-to-end, NMS-free (optional)46.5−0.8
Ge et al. (2021). Dropping the anchors gained 0.9 AP; changing which predictions count as positives gained 4.4. The NMS-free variant cost 0.8 AP and some speed, so it was left out of the final models.

Every rule so far is one-to-many: several predictions per object are trained as positives, which gives rich supervision and, at test time, duplicates that NMS must remove. A one-to-one rule, such as DETR's Hungarian matching, trains a single positive per object, so a well-trained model emits no duplicates, but each object supplies only one positive training signal. YOLOv10 (Wang et al., 2024) trains two heads on the same features, one with each kind of assignment, and keeps only the one-to-one head at inference. Both rank predictions by a matching metric m(α,β)=s⋅pα⋅IoUβm(\alpha,\beta)=s\cdot p^{\alpha}\cdot\mathrm{IoU}^{\beta}, where pp is the class score and s∈{0,1}s\in\{0,1\} says whether the prediction's location lies inside the object, and one line of algebra keeps the two heads consistent:

DETR-style detectors were NMS-free from the start but slow. RT-DETR (Zhao et al., 2024) made them real-time: its hybrid encoder applies attention only within the coarsest feature level and fuses scales with convolutions, and an uncertainty-minimal query selection initializes the decoder from the encoder features most likely to be objects. It reached 53.1% COCO AP at 108 frames per second (ResNet-50 backbone, T4 GPU, TensorRT at FP16), and its speed can be tuned by running fewer decoder layers, without retraining. By the YOLOv10 authors' end-to-end measurements, YOLOv10-S was 1.8 times faster than RT-DETR-R18 at similar AP.

Every such number describes a whole system: model, input resolution, batch size, numerical precision, software runtime, hardware, and the processing around the network. Three findings show how much that matters:

  • Resolution and proposals. Re-implementing Faster R-CNN, R-FCN and SSD with many backbones in one framework, Huang et al. (2017) found that halving the input resolution cut inference time by 27.4% on average and accuracy by 15.88% (relative), mostly on small objects, and that Faster R-CNN with an Inception-ResNet backbone kept 96% of its accuracy with 50 proposals instead of 300, at a third of the running time.
  • Post-processing. On a T4 GPU, Zhao et al. (2024) timed NMS for YOLOv8 at 1.06 to 2.46 ms depending on its two thresholds, and the setting with the best AP (confidence 0.001, IoU 0.7) was among the slowest; in their tests anchor-based YOLOs produced about three times as many boxes as anchor-free ones and paid more for NMS. Many real-time papers report model latency without NMS, and YOLOX's tables say so.
  • Fixed costs. A fixed saving matters more at high frame rates: removing 10 ms from a pipeline running at 5 frames per second gains 0.26 frames per second, from one at 30 frames per second 12.9 (Bolya et al., 2019).
Check your understanding

Fast NMS (Bolya et al., 2019) parallelizes NMS: it computes all pairwise IoUs of the score-sorted boxes and discards every box that overlaps any higher-scoring box above the threshold, whether or not that box was itself discarded. Take the boxes of Detection, Segmentation & Video: scores 0.9, 0.8, 0.7, 0.6 for AA, BB, CC, DD, with IoU(A,B)=IoU(B,C)=0.54\mathrm{IoU}(A,B)=\mathrm{IoU}(B,C)=0.54, IoU(A,C)=0.25\mathrm{IoU}(A,C)=0.25 and DD apart. What does Fast NMS keep at threshold 0.5?

  1. AA, CC and DD, exactly like greedy NMS
  2. AA and DD
  3. AA only
  4. All four boxes
Show the answer

B. AA and DD

BB overlaps the higher-scoring AA, and CC overlaps the higher-scoring BB, so both go, although greedy NMS would keep CC because BB had already been removed. In general a box that greedy NMS removes overlaps a kept higher-scoring box, hence also some higher-scoring box, so Fast NMS keeps a subset of what greedy NMS keeps. Its authors measured a loss of 0.1 to 0.3 mAP for 12 to 15 ms saved per image.

An honest speed claim therefore states the hardware and software runtime, the batch size (1 for latency), the precision (FP32, FP16 or INT8), the input resolution, what is included (preprocessing, NMS, data transfer), and the accuracy measured under exactly those settings, as the median of many runs after a warm-up. Efficient ConvNets explains why FLOP counts cannot stand in for any of this.

Key takeaways

  • YOLO casts detection as one regression on an S×SS\times S grid (7×7×307\times7\times30 outputs, 45 frames per second); YOLOv2 added k-means priors under the distance 1−IoU1-\mathrm{IoU}, sigmoid-bounded centers and log-space sizes (845 boxes at 416×416416\times416); YOLOv3 predicted at three scales. Later YOLO versions come from different groups.
  • For a fixed relative error, a squared-error loss grows like w2w^2, YOLOv1's square-root loss like ww, and a log-space loss not at all, matching the scale invariance of IoU.
  • Anchors leave provable gaps: a same-size object at a cell corner needs anchors of at least 2.72S2.72S to reach IoU 0.5, and one anchor scale per octave can leave IoU at exactly 0.5; on COCO, IoU ≥0.5\ge0.5 matching alone covers only 86.8% of objects.
  • Anchor-free detectors pair corner keypoints by embeddings (CornerNet), take the peaks of a Gaussian center heatmap with a 3×33\times3 max pooling instead of IoU-based NMS (CenterNet), or regress side distances at every location weighted by centerness (FCOS). ATSS showed that the definition of positive samples, not the anchor, separates detectors.
  • Adaptive and prediction-aware assignment (ATSS, SimOTA) gained more AP than removing anchors; one-to-one assignment makes detectors NMS-free (DETR, RT-DETR, YOLOv10's consistent dual assignments). Speed must be reported end to end, with hardware, batch size, precision, resolution and NMS stated.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

A detector makes the same relative error ε\varepsilon in the width of every box. How does each loss grow with the true width ww, to leading order in ε\varepsilon?

  1. (w^−w)2(\hat w-w)^2 grows like ww, (w^−w)2(\sqrt{\hat w}-\sqrt w)^2 like w\sqrt w, and (log⁡w^−log⁡w)2(\log\hat w-\log w)^2 like log⁡w\log w
  2. All three grow like w2w^2; only the constants differ
  3. (w^−w)2(\hat w-w)^2 grows like w2w^2, (w^−w)2(\sqrt{\hat w}-\sqrt w)^2 like ww, and (log⁡w^−log⁡w)2(\log\hat w-\log w)^2 not at all
  4. None depends on ww, since IoU does not
Show the answer

C. (w^−w)2(\hat w-w)^2 grows like w2w^2, (w^−w)2(\sqrt{\hat w}-\sqrt w)^2 like ww, and (log⁡w^−log⁡w)2(\log\hat w-\log w)^2 not at all

With w^=w(1+ε)\hat w=w(1+\varepsilon): w2ε2w^2\varepsilon^2, then wε2/4w\varepsilon^2/4, then ε2\varepsilon^2. IoU depends on ε\varepsilon alone, so only the log-space loss treats a 10-pixel and a 300-pixel box alike; YOLOv1's square roots reduced the bias toward large boxes without removing it.

Question 2

A detector places square anchors whose sides double from one size to the next (one scale per octave). An object, perfectly centered on an anchor position, has a side halfway (geometrically) between two anchor sides. What is the best IoU any anchor achieves?

  1. 0.71
  2. 0.25
  3. 0.79
  4. 0.50
Show the answer

D. 0.50

The object's side is 2\sqrt2 times the smaller anchor's and 1/21/\sqrt2 times the larger one's, so either concentric pair has IoU (1/2)2=0.5(1/\sqrt2)^2=0.5: exactly RetinaNet's threshold, before any position error. Three scales per octave raise the worst case to 2−1/3≈0.792^{-1/3}\approx0.79.

Question 3

What did ATSS's controlled comparison of RetinaNet (one anchor per location) and FCOS show?

  1. Anchor boxes themselves cost about 5 AP
  2. Once general improvements were shared, the remaining gap came from how positive and negative samples are defined; regressing from an anchor box or from a point made no difference
  3. FCOS's centerness branch alone explained the whole gap
  4. Anchor-free detectors are faster at equal accuracy
Show the answer

B. Once general improvements were shared, the remaining gap came from how positive and negative samples are defined; regressing from an anchor box or from a point made no difference

Group normalization, the GIoU loss, positives inside the box, centerness and per-level scales took RetinaNet from 32.5 to 37.0 AP. With the sample definition crossed between the two detectors, a box start and a point start gave 37.0 and 36.9 under the IoU rule and 37.8 and 37.8 under FCOS's rule.

Question 4

Two detectors on the same GPU report model latencies of 4.0 ms and 4.5 ms, measured without post-processing. The faster one is anchor-based and outputs about three times as many boxes before NMS. What follows about their end-to-end speed?

  1. The anchor-based detector is faster end to end, since NMS is negligible
  2. The anchor-free detector is faster in every setting
  3. Nothing yet: NMS must be timed too, and its cost grows with the number of candidate boxes and depends on the thresholds
  4. Only their FLOP counts can settle it
Show the answer

C. Nothing yet: NMS must be timed too, and its cost grows with the number of candidate boxes and depends on the thresholds

On a T4 GPU, NMS alone took 1.06 to 2.46 ms for one YOLO model depending on its thresholds, more than the 0.5 ms gap here, and it grows with the number of boxes. End-to-end latency at the operating thresholds, on the target hardware, decides.

Further reading

  • J. Redmon, S. Divvala, R. Girshick & A. Farhadi, "You only look once: Unified, real-time object detection," CVPR (2016).
  • J. Redmon & A. Farhadi, "YOLO9000: Better, faster, stronger," CVPR (2017).
  • Z. Tian, C. Shen, H. Chen & T. He, "FCOS: Fully convolutional one-stage object detection," ICCV (2019).
  • S. Zhang, C. Chi, Y. Yao, Z. Lei & S. Z. Li, "Bridging the gap between anchor-based and anchor-free detection via adaptive training sample selection," CVPR (2020).
  • Y. Zhao, W. Lv, S. Xu, J. Wei, G. Wang, Q. Dang, Y. Liu & J. Chen, "DETRs beat YOLOs on real-time object detection," CVPR (2024).