What Is Object Detection? Bounding Boxes, YOLO and Two-Stage Models
Object detection is a computer vision task that both identifies what objects are in an image or video and locates where they are, returning a bounding box, a class label, and a confidence score for each detected object. Unlike image classification, which assigns one label to the whole image, object detection handles several objects at once and marks their positions. It is used in surveillance, autonomous driving, medical imaging, and retail inventory.
Object detection vs image classification
The difference matters because the two tasks answer different questions.
- Image classification answers "what is in this image?" with a single label, such as "dog."
- Object detection answers "which objects are present and where?" by drawing a box around each dog, person, or car and labeling it.
Each detection carries three pieces of information:
| Output | Meaning |
|---|---|
| Bounding box | Coordinates that frame the object |
| Class label | The category, such as car or person |
| Confidence score | How likely the model considers the detection |
The bounding box is usually stored as corner coordinates or as a center point with width and height, normalized or in pixels depending on the model.
How a modern detector works
Many detectors are neural networks organized into three stages.
- Backbone: a convolutional network or vision transformer that turns the image into feature maps.
- Neck: a component such as a feature pyramid network that merges features across scales so both small and large objects are represented.
- Head: the part that predicts class scores and box coordinates at many positions.
Because neighboring positions can fire on the same object, the raw output contains many overlapping boxes. Pipelines drop low-scoring boxes and run non-maximum suppression (NMS), which keeps one box per object. End-to-end detectors such as DETR are trained to emit one prediction per object and can skip this step.
One-stage vs two-stage detectors
Detector designs differ mainly in how candidates are found.
| Factor | Two-stage (e.g. Faster R-CNN) | One-stage (e.g. YOLO) |
|---|---|---|
| Process | Proposes regions, then classifies them | Predicts boxes and classes in one pass |
| Speed | Usually slower | Usually faster, suited to real time |
| Accuracy | Often strong on precise localization | Competitive, with lighter variants |
| Typical use | Accuracy-focused work | Video, cameras, edge devices |
Two-stage models first propose regions that may contain an object, then classify and refine each one. One-stage models predict all boxes and classes in a single forward pass.
Why YOLO became widely used
YOLO, short for You Only Look Once, was introduced in 2015 as a one-stage detector. It reframes detection as a single regression problem from image pixels to box coordinates and class probabilities. The original model divided the image into a grid, where each cell predicted boxes and class probabilities, and ran fast enough for real-time video.
The family has since expanded through many versions, including smaller variants that run on limited hardware. This makes it common in projects where inference speed matters, such as cameras and edge AI devices.
Where object detection is used
- Autonomous driving: identifying cars, pedestrians, and traffic signs.
- Security and retail: counting people, monitoring areas, and checking stock on shelves.
- Medical imaging: locating regions of interest for further review.
- Robotics and tracking: as a base for object tracking and scene understanding.
It also serves as a foundation for more complex tasks such as instance segmentation, pose estimation, and object tracking, which need accurate localization as an intermediate step.
Limits and practical notes
Detectors can miss objects or raise false boxes, especially in poor lighting, with unusual angles, or when an object is partly hidden. Small objects and crowded scenes remain harder than large, clear ones. They also depend on data labeling, since training needs boxes drawn around example objects, and the quality of those labels affects results.
How it relates to other concepts
Object detection sits within computer vision and mostly builds on convolutional neural networks, with newer models using vision transformers. The boxes and labels it predicts are produced by trained models, and smaller versions are often deployed on edge devices for real-time use.
FAQ
What is a bounding box?
A bounding box is a rectangle that frames an object in an image, usually defined by coordinates. Together with a class label and confidence score, it forms one detection.
Is object detection the same as image classification?
No. Classification assigns one label to the whole image, while detection finds several objects and gives the location of each one with a box.
What does non-maximum suppression do?
NMS removes overlapping boxes that refer to the same object, keeping the box with the higher score so each object is represented once.
What is the difference between one-stage and two-stage detection?
Two-stage models propose regions and then classify them, while one-stage models such as YOLO predict boxes and classes in a single pass, generally trading some precision for speed.
Can object detection run on a camera or small device?
Yes. Lightweight one-stage models are designed to run in real time on cameras and edge hardware, although very small models may give up some accuracy compared with larger ones.
Key takeaways
Object detection identifies both what is in an image and where it is, returning a box, a label, and a confidence score for each object. Modern detectors use a backbone, neck, and head, with NMS to remove duplicate boxes. Two-stage models tend to favor accuracy, while one-stage models such as YOLO favor real-time speed, and the technique underpins many practical vision systems from driving to retail.
Sources
Learn by doing
Read a guide, then practice with bite-sized AI lessons you can take offline.
Start learning free