This page is being translated by your browser

Translation can break parts of Roboflow. If something stops working, turn translation off and reload the page.

Detection · Pharma & Semiconductor

Pill counting: Datasets & Models

A computer vision workflow that detects and counts individual pills in an image, giving an automated tally for quality control, dispensing, and packaging verification.

Pill counting example
1M+
developers
16k
organizations
50B
inferences

Pill counting

This pill counting detection workflow locates each individual pill in an image and returns a total count, removing the need for manual tallying during quality control, dispensing, and packaging verification. It accepts still images or camera frames from pharmacy dispensing stations, blister pack lines, counting trays, and bottle-fill inspection systems.

Try it out

Powered by general detection model

Run on custom image

Drop an image here or click to upload

Detecting classes:

Why automate pill counting

Manual pill counting is slow, error-prone, and hard to audit at scale, and miscounts in a pharma packaging or dispensing context carry real compliance and safety risk. Automating pill counting detection removes the human bottleneck, catches overfill and underfill before product moves downstream, and creates an image-backed record for every count. For high-throughput lines it delivers consistent results across shifts where operator fatigue would otherwise introduce variance.

Key benefits

Teams get repeatable, verifiable counts that plug into existing inspection cameras and line control systems without new specialized hardware. Detection-based counting scales from a single dispensing station to multiple parallel packaging lines, and RF-DETR provides strong accuracy on densely packed or overlapping pills where simpler methods struggle.

How to use it

  1. Upload an image: Drop any photo into the widget above to try pill counting for free, right on this page.
  2. Preview instant results: The model detects pill, tablet, capsule, blister pack, pill bottle within seconds and returns an annotated image with structured predictions, so you can immediately see how well it works. Adjust the detection classes and re-run until the results fit your scenario.
  3. Like what you see?: With a free Roboflow account, you can deploy this workflow with the Serverless Cloud API, customize it in your workspace, or train RF-DETR on your own images for production accuracy.
  4. Get started for free: No code or training data required to begin: upload, review the results, and make it part of your stack in a single click.
Recommended model

Recommended model for pill counting

RF-DETR is state of the art for real-time object detection, instance segmentation, and keypoint detection, with higher accuracy and lower latency than comparable models, and it's Apache 2.0 licensed. When you're ready to build a production model for pill counting, fine-tune it on your own labeled images, then deploy to a Serverless Cloud API endpoint.

Train your own model
Roboflow Agent

Not sure where to start?

Describe your Pill Counting project to Roboflow Agent.

Agent