Algorithm Search⌘K

Problemcore

Object detection

Also called object localization and classification.

Find every object of the known classes in an image and return for each a class, a bounding box and a confidence score.

Object detection is the problem of finding every object of a fixed set of classes in an image and saying, for each one, its class, a bounding box around it, and a confidence score. It adds where to the what of object recognition, and the number of objects is not known in advance: an image can hold no object of interest or a hundred. A detection is correct when its box overlaps a true box of the same class by enough intersection over union, and a detector is judged by detection mean average precision over a test set.

In plain words

You give the computer a street photo and a list of things to look for, such as people, cars and bicycles. It must draw a tight rectangle around each one it finds, write the name of the thing on the rectangle, and say how sure it is.

This is harder than saying "there is a car in this photo". The computer must also count the cars, find small ones far away, and separate two people who stand close together. It must not draw two rectangles on one car. A rectangle that is a little off is still accepted, but only when it covers most of the true object. Methods look at many candidate rectangles, give each a score for each kind of thing, and then remove the doubles.

Definition

Fix a set of classes C={1,…,K}C = \{1, \ldots, K\}. The input is a digital image II. The output is a finite set of detections

{(ci,bi,si):i=1,…,m},ci∈C,si∈R,\{(c_i, b_i, s_i) : i = 1, \ldots, m\}, \qquad c_i \in C, \quad s_i \in \mathbb{R},

where bi=(x1,y1,x2,y2)b_i = (x_1, y_1, x_2, y_2) is an axis-aligned box in image coordinates and mm is chosen by the method.

The ground truth is a set of annotated boxes (c,g)(c, g) for the same image, drawn by people. A detection (ci,bi,si)(c_i, b_i, s_i) is a true positive when it is matched to a ground-truth box gg of class cic_i with IoU(bi,g)\mathrm{IoU}(b_i, g) above a threshold τ\tau, and each ground-truth box can be matched by at most one detection: the detections are matched in order of decreasing score, so a second detection of the same object is a false positive. PASCAL VOC uses τ=0.5\tau = 0.5; COCO averages over τ∈{0.5,0.55,…,0.95}\tau \in \{0.5, 0.55, \ldots, 0.95\}. From the matches, the precision and recall at each score cut give the average precision of each class, and their mean over the classes is the score of the detector. There is no exact correct output, only a better or worse one under this metric.

Variants

  • Single-class detection. One class, such as faces or pedestrians. Face detection with the Viola-Jones detector and pedestrian detection with the Dalal-Triggs detector are the classic cases.
  • Multi-class detection. Many classes at once, as in PASCAL VOC (20 classes) and COCO (80 classes).
  • Instance segmentation. A mask in place of a box for each object; see instance segmentation.
  • Oriented boxes. Rotated rectangles, common for aerial images and text.
  • 3D detection. Boxes in 3D space from depth or lidar data.
  • Open-vocabulary detection. Classes given at test time by words, not fixed at training time.
  • Video detection. Detection in each frame, with the help of the frames around it.

Examples

  • Two pedestrians. In a street photo, a detector returns (person, (40, 60, 90, 200), 0.97), (person, (120, 70, 165, 195), 0.91) and (person, (42, 58, 93, 205), 0.62). The third box covers the first person again; non-maximum suppression removes it, and if it stayed it would count as a false positive.
  • A missed small car. A car of 15 by 10 pixels far down the road gives no detection; it lowers the recall.
  • A loose box. A box that covers a whole dog but is twice its size has an IoU of about 0.5 with the true box; under VOC it may or may not count, and under COCO it fails at all thresholds above 0.5.
  • A non-example. Saying only "this image contains a dog" is image classification, not detection; a box around the dog with no class is object proposal generation.

Known algorithms

AlgorithmTimeSpacePropertiesCode
Non-maximum suppression for detectionsΘ(n^2) worstΘ(n) extradeterministicexactofflineiterative1 language
Dalal-Triggs pedestrian detectorO(m d + k^2) worst · averageO(m + d) extradeterministicexactofflineiterative1 language
DETRO(N C + N M^2) worstO(N M) extradeterministicnot exactofflineiterative1 language
Fast R-CNNO(R c (m + H)^2 + K R^2) worstO(c H^2 + R K) extradeterministicnot exactofflineiterative1 language
Faster R-CNNO(A log A + N P + K P^2) worstO(A + P K) extradeterministicnot exactofflineiterative1 language
Generalized Hough transformO(e m + W H) worstO(W H + m) extradeterministicexact1 language
Histogram of oriented gradientsO(W H + W H B / c^2) worst · average · bestO(W H + W H B / c^2) extradeterministicexactheuristicnot rotation invariantnot scale invariant1 language
R-CNNO(P S^2 + P C d + C P^2) worstO(S^2 + P (d + C)) extradeterministicnot exactofflineiterative1 language
Single shot multibox detectorO(C D^2) worstO(C D) extradeterministicnot exactofflineiterative1 language
Soft-NMSΘ(n^2) worstΘ(n) extradeterministicexactofflineiterative1 language
YOLOO(C S^4 B^2) worstO(S^2 B C) extradeterministicnot exactofflineiterative1 language

Bounds

There is no worst-case lower bound on the quality of a detector; methods are compared by average precision on a benchmark, and the numbers depend on the data set, the metric and the year. The search space has a simple size: an image of W×HW \times H pixels has Θ(W2H2)\Theta(W^2 H^2) axis-aligned boxes with integer corners, so no method scores them all. A sliding window with stride ss at aspect ratio fixed and scales spaced by a factor ρ>1\rho > 1 visits about ∑kWH/(s2ρ2k)=O(WH/s2)\sum_k WH / (s^2 \rho^{2k}) = O(WH/s^2) windows, a geometric series dominated by the finest level; at each window the classifier costs the size of its feature vector. Greedy non-maximum suppression on nn boxes costs O(n2)O(n^2) IoU computations in the worst case.

Reductions

  • To classification. Each candidate box is classified as one of the KK classes or as background, so detection reduces to classification of windows or regions plus non-maximum suppression. This is the reduction of sliding-window and proposal-based detectors.
  • To keypoint or centre estimation. Some detectors predict the centre of each object as a peak of a heat map, then its size; this reduces detection to finding the maxima of a map, as the implicit shape model does with votes.
  • From instance segmentation. The bounding box of each mask of an instance segmentation is a detection, so a solution of that harder problem gives one of this problem.

Applications

Pedestrian, car and traffic sign detection for driver assistance and autonomous driving; face detection in cameras and phones; counting people, animals or cells; video surveillance; robot grasping; retail shelf analysis; document layout analysis; and as the first step of tracking, pose estimation and face recognition.

References

  1. Richard Szeliski, Computer Vision, Algorithms and Applications, second edition, Springer, 2022, Chapter 6, Recognition: Section 6.3 (object detection, with face detection, pedestrian detection and general object detection)
  2. Mark Everingham, Luc Van Gool, Christopher K. I. Williams, John Winn and Andrew Zisserman, The PASCAL Visual Object Classes (VOC) challenge, International Journal of Computer Vision 88(2), 2010, 303-338, The detection task: a bounding box with a confidence for each object, a match when the overlap of the boxes exceeds 50 percent, duplicates counted as false positives, and average precision
  3. Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar and C. Lawrence Zitnick, Microsoft COCO: common objects in context, ECCV 2014, The data set of 80 object categories with instance annotations; the detection metric averaged over IoU thresholds is given on the evaluation page of the data set
  4. Pedro F. Felzenszwalb, Ross B. Girshick, David McAllester and Deva Ramanan, Object detection with discriminatively trained part-based models, IEEE Transactions on Pattern Analysis and Machine Intelligence 32(9), 2010, 1627-1645, Section 1 and Section 7 (detection as scoring windows of a feature pyramid, bounding-box prediction and non-maximum suppression)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a contract.yaml