
Training Custom YOLO Models on Real Images to Count Soft Dough Lines Accurately
Why off-the-shelf object detection fails on pale, shape-shifting, flour-dusted dough—and how we trained a custom YOLO model to count thousands of pieces an hour in real time.

Soft Shapes, Flour Dust & Touching Boundaries
Pointing an off-the-shelf object detection model at a moving bakery dough line is a humbling experience. Unlike rigid cardboard cartons or printed beverage cans, unbaked dough pieces are pale, soft, and constantly changing shape as they proof.
Within hours on a real bakery shift, fine flour dust and warm steam shift the visual contrast across the conveyor belt. Even trickier, two pieces of dough frequently swell and touch slightly inside prover pans—causing generic models or optical beams to count two pieces as one.
Finding the Sweet Spot Between Edge FPS & Boundary Precision
To make the camera see the dough line reliably across every shift, we built a dedicated training and benchmarking pipeline from real production footage:
Nano/Small vs. Deeper YOLO Variants
Tested multiple YOLO architectures to balance fast 30 FPS edge inference against tight bounding-box separation on adjacent pans.
Hundreds of Real Shift Captures
Captured and hand-labeled frames across morning glare, night-shift LED lighting, heavy flour dusting, and steam plumes.
Teaching Touching-Edge Separation
Specifically annotated overlapping and touching dough seams so each individual piece receives its own high-confidence centroid before crossing the virtual gate.
5-Batch Pan Verification
Grouped individual dough centroids inside each prover pan container to flag under-filled pans immediately alongside total hourly piece counts.
Thousands of Pieces Per Hour, Verified Live
Once deployed above the prover line with diffused overhead LED illumination, the custom-trained model locked onto every pan cleanly—turning one of the hardest visual counting problems in food manufacturing into a live shift metric.
- Immune to Flour & Steam Drift: Training on real dirty-lens and steam conditions eliminated mid-shift accuracy drops.
- Under-Filled Pan Detection: Supervisors see immediately if 4-piece pans pass through a 5-piece batch run.
- Connected to Yield Reporting: Pre-oven dough counts reconcile directly against finished packaged loaves at dispatch.
Want This Engineered at Your Site?
Speak directly with our Nairobi engineering team in Gigiri & Kilimani to scope a practical deployment.
Discuss With Our EngineersNext: Field Note 06: Python Proxy + ANPR Weighbridge