What Is Object Detection, and How Does It Work?
Object detection finds and locates things in an image, drawing a box around each object and naming it, from products on a shelf to faults on a line.
On this page
Short answer
Object detection is a computer vision task that finds objects in an image or video and marks where each one is, usually with a box and a label naming what it is. One photo can return several boxes at once, each with a confidence score. It differs from image classification, which names only the main subject of a whole image and says nothing about where things are.
What is object detection?
Object detection is a computer vision task that finds objects in an image or video frame and marks the position of each one, usually with a rectangular box and a label naming the object. A photo of a warehouse shelf can return one box per product, a photo of a road can return one box per car, and a photo of a factory line can return one box per defect.
Each box comes with a confidence score, a number from 0 to 1 that says how sure the model is about that box. Teams set a cut-off, such as 0.5, and keep only boxes above it. This keeps weak guesses out of the result while keeping the strong ones.
| Task | What it returns | Position included? |
|---|---|---|
| Image classification | One label for the whole image | No |
| Object detection | Boxes and labels for each object | Yes, as a box |
| Semantic segmentation | A label for every pixel | Yes, per pixel |
| Instance segmentation | A pixel mask per object | Yes, per object |
Detection sits between classification and segmentation. It is cheaper to label and faster to run than drawing exact outlines, which is why most production vision systems start with detection and add finer methods only where a box is not enough.
How does object detection work?
An object detection model works in three steps: it reads the image, it proposes where objects might be, and it scores each proposal with a label and a confidence value. Most modern models do all three in one pass, which is why they can run on live video.
First, a backbone network turns the image into a set of feature maps, which are summaries of edges, shapes and textures at several scales. Then the model predicts boxes from those maps, either by scoring a grid of candidate regions or by scoring fixed anchor boxes placed across the image. Each prediction carries a class label and a confidence score.
Finally, the model removes duplicate boxes for the same object. A car might get ten overlapping boxes, so a step called non-maximum suppression keeps the strongest box and drops the rest. What remains is the list of boxes and labels the user sees. For how teams test models like this before release, see how to test AI models.
What does an object detection model need to learn?
An object detection model needs labelled images where a person has drawn a box around each object and named it. The model learns from those examples: the box teaches it where objects end, and the label teaches it what each kind of object looks like.
Good training data covers the same variation the model will meet in use. If the camera angle, lighting or background changes, the model needs examples of that change. A model trained only on bright, clean photos will struggle with dim, cluttered ones, so teams collect images from the real setting, not from stock photo sites.
Small and rare objects are the hardest part. A defect that appears once in a thousand images will be missed unless the dataset includes enough examples of it. Teams often add more examples of rare classes, or use data annotation services to label them consistently. See data annotation services for how labelling work is organised.
Where is object detection used?
Object detection is used wherever a team needs to count, locate or check physical things from a camera feed. Retailers use it to check shelf stock, factories use it to spot defects on a line, farms use it to count crops, and logistics teams use it to track parcels and pallets.
It is also used in vehicles and security. Driver assistance systems detect cars, pedestrians and road signs, while site cameras detect people entering restricted areas or equipment left in the wrong place. In healthcare, detection helps radiologists find regions worth a closer look, though a human still makes the final call.
The common thread is that detection turns video into structured data a system can act on. A camera that only records footage is a passive observer; a camera with detection becomes a sensor that can raise an alert, update a count or trigger the next step in a workflow. For real-world examples across industries, see computer vision use cases.
Example (hypothetical): counting pallets in a warehouse
Example (hypothetical): a warehouse team counts pallets by walking the floor. They check 240 pallets a day, and each check takes 2 minutes, so the daily count costs 240 x 2 = 480 minutes, or 8 hours of staff time.
With object detection, a camera at the dock reads each pallet as it passes and records the count. Staff only check the pallets the model flags as unclear, say 60 a day, which takes 60 x 2 = 120 minutes, or 2 hours. The team saves 8 - 2 = 6 hours a day, and the count is available at any time instead of once at the end of the shift.
The saving only holds if the model is right most of the time. If it flags half the pallets, staff spend more time checking than they did before. That is why teams measure accuracy on their own footage before trusting the count, and keep a human check on anything the model is unsure about.
How do teams measure object detection?
Teams measure object detection with three ideas: how much the predicted box overlaps the true box, how many of the model's boxes are right, and how many real objects it finds. Overlap is measured with a ratio called IoU, the area shared by the two boxes divided by the area covered by either box.
Precision is the share of the model's boxes that are correct, and recall is the share of real objects the model found. A model that draws boxes everywhere has high recall and low precision; a model that draws very few boxes has high precision and low recall. Teams balance the two for the job at hand.
The standard summary is mean average precision, or mAP, which averages precision across classes and overlap levels. It is useful for comparing models on the same dataset, but it hides the detail teams need in production, so most teams also look at precision and recall per class before shipping.
What are the common mistakes?
The most common object detection mistakes are training on the wrong images, trusting the headline metric, and skipping the check on low-confidence boxes.
- Training on clean data. Models trained on tidy photos fail on real footage with glare, clutter and odd angles.
- Trusting one number. A good mAP score can hide a class the model never finds, so check results per class.
- Ignoring small objects. Small objects need higher-resolution input or the model will miss them entirely.
- No plan for unclear boxes. Boxes below the cut-off still need a rule: send them to a human, not to the bin.
- Skipping a pilot. A model that scores well on a test set can still fail on the team's own cameras.
Key takeaways
- Object detection finds objects and marks each one with a box and a label
- Each box carries a confidence score, and teams keep only boxes above a cut-off
- Good training data comes from the real setting, not from stock photos
- Measure precision and recall per class, not just the headline mAP score
- Start with a pilot on your own cameras before trusting the counts
Frequently asked questions
What is the difference between object detection and image classification?
Image classification gives one label for a whole image, such as cat or dog, and says nothing about where the subject is. Object detection finds every object in the image, draws a box around each one and labels it. If you need to count objects or know where they are, you need detection, not classification.
Can object detection run in real time?
Yes, most modern detection models run in real time on a graphics card, and smaller models run on phones and edge cameras. Speed depends on the model size and the image resolution: a larger model is more accurate but slower, so teams pick the smallest model that meets their accuracy target.
How much labelled data does object detection need?
It depends on the number of classes and how much they vary. A single-class detector for one kind of defect may work with a few hundred labelled images, while a model with many classes in changing light needs thousands. Teams start small, test on real footage, and add labels where the model fails.
What is IoU in object detection?
IoU stands for intersection over union. It measures how much a predicted box overlaps the true box: the shared area divided by the total area covered by both boxes. A value of 1 means a perfect match, and 0 means no overlap at all. Teams usually count a box as correct when its IoU is above 0.5.
Does object detection replace human inspection?
No, it changes the job. Detection handles the routine checks and flags the unclear cases, while people handle exceptions, edge cases and final decisions. In safety and medical settings a human always makes the final call, and the model acts as a second pair of eyes.
How do I start an object detection project?
Start with a small pilot: pick one camera, one object class and one clear decision the boxes will drive. Collect a few hundred labelled images from that camera, train a small model, and test it on a week of real footage. If the pilot saves time without missing the objects that matter, widen the scope.