What is object detection?
Object detection is the computer vision task of finding every object of interest in an image and returning a bounding box, a class label and a confidence score for each one. It combines classification, which says what is in the image, with localization, which says where.
Detection runs in self-driving perception, pedestrian and traffic-sign recognition, retail shelf monitoring, medical imaging for finding nodules or lesions, and photo search. Most detectors share the same parts: a CNN or transformer backbone, a set of candidate boxes such as anchors, a head that scores and refines each candidate, and non-maximum suppression to remove duplicates.
Key ideas
- A detector outputs a box, a class label and a confidence score for each object.
- Anchors are reference boxes at fixed positions, sizes and aspect ratios.
- The network predicts offsets from each anchor, scaled by its size, instead of raw coordinates.
- IoU, the overlap area divided by the union area, measures how well two boxes match.
- Non-maximum suppression keeps the highest-scoring box and removes overlapping duplicates.
- Single-stage detectors are faster, and two-stage detectors refine region proposals in a second step.
Common questions
What is the difference between object detection and image segmentation?
Detection draws a rectangle around each object. Segmentation labels every pixel, so it captures exact shapes. Instance segmentation combines the two: Mask R-CNN adds a mask branch to a Faster R-CNN detector and outputs a pixel mask inside each box.
How do you train an object detector on a custom dataset?
Start from a detector pretrained on COCO and fine-tune it on your own labeled images, keeping the backbone and replacing the class head. Each image needs a box and class for every object, usually stored in COCO JSON or YOLO text format. Transfer learning lets a few hundred labeled images per class give usable results for many tasks.
Why are small objects hard to detect?
A CNN backbone downsamples the image by 16 or 32 times, so a 20×20-pixel object covers only one or two cells of the final feature map. Feature Pyramid Networks (Lin et al., 2017) fix much of this by detecting from several resolutions at once. Higher input resolution and tiling large images also help.
What is DETR?
DETR (Carion et al., 2020) is a transformer detector that predicts a fixed-size set of boxes directly. During training, Hungarian matching pairs each ground-truth object with one prediction, so the model learns to avoid duplicates. It needs no anchors and no NMS.
Related explainers
- Convolutional Neural Networks — How CNNs see and understand images
- Image Segmentation — Classify every pixel in an image — from semantic regions to individual object instances
- Pooling & Downsampling — Reduce spatial dimensions while preserving the most important features in feature maps
- Transfer Learning — Standing on the shoulders of pretrained giants
- Model Evaluation & Metrics — Precision, recall, F1, ROC curves, and regression metrics
- Data Augmentation — Artificially expand training data with transformed copies to reduce overfitting
References
- Ren, He, Girshick & Sun (2015), "Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks"
- Redmon et al. (2016), "You Only Look Once: Unified, Real-Time Object Detection", CVPR
- Lin et al. (2017), "Focal Loss for Dense Object Detection" (RetinaNet)
- Carion et al. (2020), "End-to-End Object Detection with Transformers" (DETR)
- Rezatofighi et al. (2019), "Generalized Intersection over Union", CVPR
Last updated