Computer vision answers · Retail
How do I count products on store shelves with computer vision?
Without walking every aisle with a clipboard.
Short answer
Train an object detection model to find each product on the shelf with Roboflow for free, then count the detections per class. Label each product as its own class, and add a class for empty facings, so you get stock and gaps for every shelf in one pass. Box every facing one by one, even where packs touch, and split wide shelf photos into tiles so small products far from the camera still get found.
Skip the setup. Describe your images.
Describe your images and what you need to find. The agent sets up labeling, training and deployment with you.
Key facts
- What you need
- Shelf photos and a detection model trained on your products
- What you get
- A count per product, with empty facings marked on every shelf
- Image sources
- Phone photos, fixed shelf cameras and recorded video
- Runs on
- Cloud API, or an edge device or server running Docker

How to build shelf product counting, step by step
Six steps from a phone photo of a shelf to a count for every product.
Connect Roboflow to your coding agent, ChatGPT or Codex
Photograph shelves the way you will check them
Label every facing, with one class per product
Train a detection model for small, crowded products
Count the products on each shelf photo
Pythonimport supervision as sv from collections import Counter from inference import get_model model = get_model("your-project/1") result = model.infer("aisle_04.jpg", confidence=0.4)[0] detections = sv.Detections.from_inference(result) print(Counter(detections.data["class_name"])) # Counter({'cola_330ml': 14, 'water_500ml': 9, 'empty': 3})Rather not write code? Ask the Roboflow agent to set this up for you
Run every aisle and track stock over time
Why 2 million engineers build on Roboflow
Label faster
Auto-label with SAM 3 or your own model, then fix the misses instead of drawing every box.
RF-DETR
Roboflow’s open-source real-time detection model, built for accuracy (opens in a new tab) on small objects.
Logic built in
Counting, zones, tracking and alerts are ready-made Workflow blocks, so there is less code to write.
Your model, your weights
Use your trained weights on every plan, including free, through the open-source Inference package.
Run it anywhere
Self-host on a workstation, Docker, an on-prem GPU or an edge device, or call the cloud API.