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 detection: Datasets & Models

Pill detection uses computer vision to locate and identify individual pills in images, whether on a conveyor line, in a blister pack, or in a fill tray. It supports counting, sorting, and defect flagging tasks in pharmaceutical manufacturing and packaging.

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

Pill detection

This pill detection workflow locates individual pills in an image and returns bounding boxes for each one, supporting downstream tasks like counting, sorting, and defect flagging. It accepts still images or video frames from inspection cameras positioned over conveyor lines, blister packs, or fill trays.

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 detection

Manual pill counting and visual inspection are slow, tedious, and error-prone, and in a pharma production environment a miscount or a missed defect carries regulatory and safety consequences. Automating pill detection lets a line inspect every unit at production speed rather than sampling, catching miscounts, broken tablets, and foreign objects before they reach packaging. It removes the fatigue factor from repetitive high-volume inspection and produces a consistent, auditable record of what was detected on every frame. For teams already running inspection cameras, adding a detection model turns those feeds into an automated verification step.

Key benefits

A trained detection model can count and verify pills continuously across shifts without the inconsistency of manual checks, and it integrates with the cameras and edge hardware many packaging lines already have in place. RF-DETR provides strong accuracy on dense, overlapping objects, making it well suited to trays and blister packs where pills touch or partially occlude one another. The same approach scales from a single inspection station to multiple lines without retraining from scratch.

How to use it

  1. Upload an image: Drop any photo into the widget above to try pill detection 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 detection

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 detection, 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 Detection project to Roboflow Agent.

Agent