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 . The input is a digital image . The output is a finite set of detections
where is an axis-aligned box in image coordinates and is chosen by the method.
The ground truth is a set of annotated boxes for the same image, drawn by people. A detection is a true positive when it is matched to a ground-truth box of class with above a threshold , 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 ; COCO averages over . 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
- Sliding windows. Sliding-window detection scores a fixed-size window at every position and scale of an image pyramid, then applies non-maximum suppression. The Viola-Jones detector (boosted Haar-like features on an integral image), the Dalal-Triggs detector (HOG and a linear support vector machine) and the deformable part model are of this kind.
- Voting. The implicit shape model lets local features vote for object centres in a generalized Hough space.
- Proposals and classification. Selective search and other object proposal methods give a few thousand candidate boxes; R-CNN classifies each with features of a convolutional network, Fast R-CNN shares the network over the image with RoI pooling, and Faster R-CNN learns the proposals too, from anchor boxes.
- One-stage detectors. YOLO and the single shot multibox detector predict classes and box offsets directly on a dense grid; focal loss handles the many easy background positions. A feature pyramid network helps all of these with objects of different sizes.
- Set prediction. DETR predicts a fixed-size set of boxes with a transformer and a one-to-one matching loss, and needs no non-maximum suppression.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| Non-maximum suppression for detections | Θ(n^2) worst | Θ(n) extra | deterministicexactofflineiterative | 1 language |
| Dalal-Triggs pedestrian detector | O(m d + k^2) worst · average | O(m + d) extra | deterministicexactofflineiterative | 1 language |
| DETR | O(N C + N M^2) worst | O(N M) extra | deterministicnot exactofflineiterative | 1 language |
| Fast R-CNN | O(R c (m + H)^2 + K R^2) worst | O(c H^2 + R K) extra | deterministicnot exactofflineiterative | 1 language |
| Faster R-CNN | O(A log A + N P + K P^2) worst | O(A + P K) extra | deterministicnot exactofflineiterative | 1 language |
| Generalized Hough transform | O(e m + W H) worst | O(W H + m) extra | deterministicexact | 1 language |
| Histogram of oriented gradients | O(W H + W H B / c^2) worst · average · best | O(W H + W H B / c^2) extra | deterministicexactheuristicnot rotation invariantnot scale invariant | 1 language |
| R-CNN | O(P S^2 + P C d + C P^2) worst | O(S^2 + P (d + C)) extra | deterministicnot exactofflineiterative | 1 language |
| Single shot multibox detector | O(C D^2) worst | O(C D) extra | deterministicnot exactofflineiterative | 1 language |
| Soft-NMS | Θ(n^2) worst | Θ(n) extra | deterministicexactofflineiterative | 1 language |
| YOLO | O(C S^4 B^2) worst | O(S^2 B C) extra | deterministicnot exactofflineiterative | 1 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 pixels has axis-aligned boxes with integer corners, so no method scores them all. A sliding window with stride at aspect ratio fixed and scales spaced by a factor visits about 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 boxes costs IoU computations in the worst case.
Reductions
- To classification. Each candidate box is classified as one of the 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
- 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)
- 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
- 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
- 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.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag YKE1TW Edit this page History Report an error Markdown