How to Count Objects in a Photo With AI (and How Accurate It Is)
How object detection counts people, cars and items, what the confidence threshold does, how to count only part of a scene and how to check results.
&c=%237c3aed&k=images)
How to Count Objects in a Photo With AI (and How Accurate It Is)
Counting things in photos is part of many jobs: event organisers estimating attendance, shop staff checking shelves, researchers counting birds, teachers counting chairs, and engineers counting vehicles in traffic photos. Object detection models make it fast. The AI Object Counter runs one such model in your browser and gives you a labelled image and a CSV of what it found.
How object detection works
An object detector looks at a photo and outputs boxes, each with a category and a confidence score. The YOLOX-Nano model used here divides the picture into grids at three scales and, for each grid cell, predicts whether an object is centred there, what it is and how big it is. Overlapping predictions of the same object are merged with a step called non-maximum suppression, which keeps the most confident box. The whole model is 3.7 MB and runs in about a second.
What it can recognise
The model knows the 80 categories of the COCO dataset, a standard benchmark. They include people, bicycles, cars, motorcycles, buses, trucks, boats, traffic lights, benches, birds, cats, dogs, horses, sheep, cows, backpacks, umbrellas, suitcases, bottles, cups, chairs, sofas, plants, beds, tables, TVs, laptops, phones, books and clocks. It cannot count things outside this list, such as specific products or plant species.
The confidence threshold
Every detection comes with a score between 0 and 1. The threshold decides which detections count:
- Too high and real objects that are small or partly hidden are left out.
- Too low and shadows, reflections or patterns are counted as objects.
A good habit is to move the slider and watch the count. If the number stays stable across a range, you can trust it more. If it jumps around, check the boxes in the labelled image.
Counting part of a scene
Often you only care about one area: one shelf, one side of a road, one block of seats. Draw boxes in the tool and only objects whose centre falls inside them are counted. Splitting a big scene into sections also helps accuracy, because each region can be checked more easily.
Why small detectors miss things
Compact models trade some accuracy for speed. They miss very small objects, people deep in a crowd, and objects cut off by the frame. The input image is scaled to 416 pixels, so in a large group photo each face is only a few pixels. For dense crowds, specialised crowd-counting methods that estimate density are more reliable than box detection.
Making counts more reliable
- Use the sharpest, most evenly lit photo you have.
- Count each area separately and add up the results.
- Check the labelled image and correct obvious misses by hand.
- Use more than one photo of the same scene if possible.
- Record the threshold you used so the count can be repeated.
Exporting results
The labelled image shows numbered boxes, optionally with type and confidence, so anyone can verify the count. The CSV lists each detection with its position and size in pixels, then a total for each type, ready for a spreadsheet.
Privacy
The model runs in your browser and does not identify individuals. Photos of people are still personal data, so handle them carefully.
A worked example
A school hall photo shows rows of chairs for a concert. With the type set to chair and the threshold at 35 percent, the counter finds 212 chairs. Drawing a box around the front block gives 96. Checking the labelled image shows four chairs hidden behind a pillar that were missed, so the final count is recorded as about 216.
Limits
Counts are estimates. Do not rely on them where safety, money or legal decisions depend on an exact number without checking by hand.


&c=%23c2410c&k=education)
