Skip to content
LexDataLexData
PlatformIndustriesCustomers
DocsThe Field GuideBlogWhy models drift
AboutCareersSecurityContact
Log inStart now

// MANUFACTURING

Chocolate Box Inspection

Chocolate Box Inspection. What it takes to run it.

Every piece boxed and named from the top-down camera, checked against the insert's own template by row and position before the lid goes on.

Start with your footageBook a demo →All of manufacturing →

// 01 · The question

“Is every piece in its cup, named right and undamaged, before the lid goes on?”

// 02 · Why it is hard

A milk caramel and a milk praline in the same cup shape, under the same light, differ by a swirl on top, and those two classes want more frames and a person who already packs this assortment checking every box. Naming bites later: one labeler writing "praline" and another writing "hazelnut praline" gives the template two classes where the line has one, and every tray fails. The line's own name for a piece that has escaped its cup and sits between two others is a traveller, and travellers cause most of the doubtful frames.

// 03 · What the labels have to be

Bounding box

Decided before the first frame

The question is which piece sits in which cup and whether it is sound, not its extent, so a box carries the answer: its position says which cup, and a class read from the crop inside it says the piece type and whether that piece is damaged. Nothing here is measured by area, so a mask would add labelling cost without changing a single verdict.

This is the decision that is expensive to reverse. The geometry has to match what the answer contains, and finding out it does not means labelling the set a second time.

// 03a · What it finds

Every piece in its cup

boxed from the top-down camera at a fixed height and named by type as the tray crosses the line

The piece out of place

the detections sorted into rows and read left to right, each position compared against the insert's own template and a mismatch reported by the cup it sits in

Damage as its own class

cracked, bloomed, misshapen or missing its decoration, read from the same box as the piece type rather than scored separately

The traveller, or a tray the model doubts

a piece that has escaped its cup and sits between two others, or a count too close to call, held for a person rather than scored either way

// 03b · What it checks

  1. 01

    The template's own rows and positions against what the camera found, so a mismatch is reported by cup rather than failing the whole tray on one number.

  2. 02

    The count first on a short tray: an empty cup read from the template at the gap, a missed detection read from a doubted box in that same region, so the two are never confused.

  3. 03

    Damage read from the piece's own box, held alongside a swapped piece rather than scored on a separate pass.

  4. 04

    A doubted tray held for a person with the frame and the box attached, the way the packer at the end of the belt decides today.

// 03c · What the line provides

  • The camera already over the tray line, fixed height, with the tray always in the same place.
  • The insert's own template, written down as rows and positions the way the box's own lid already shows it.
  • A few dozen labeled frames per piece type on this camera; the lookalikes want more, and a person who already packs this assortment to check them.
  • Someone to settle each piece's name once, so the template and the model never carry two classes for one piece.

// 04 · How we run it

Three parts of one loop, on this job.

LexAnnotate

Defect Annotation

Pixel-level defect annotation for surface scratches, cracks, dents, weld faults, and assembly misalignments. Multi-sensor alignment for multi-camera inspection systems.

LexInsight

Line Performance

Ask which shift or which line is producing the most of one defect class, and get an answer with the frames behind it, graded against the plant's own written standard.

LexAlert

Quality Alerts

Monitor defect detection accuracy across changing production conditions. Detect when lighting shifts, new materials, or equipment aging degrades model performance. Auto-retrain to maintain 99%+ accuracy.

How the loop fits together →

// 05 · What breaks it after launch

Concept drift

The spec changed

→Concept drift →

A seasonal assortment swaps two pieces for new ones and the insert's template changes with it. The camera sees a piece it has never seen and either boxes it as the nearest lookalike or boxes nothing, so every tray fails the template check for the first run until the new pieces are labeled.

It is not the only one that can get this use case, it is the one that usually gets it first. All ten conditions.

// 06 · In manufacturing

Defect Detection at Scale

Full write-up ↓Every case study →

The Challenge

Vision models performed well in pilots but lost accuracy as factory conditions shifted.

Our Execution

Built pixel-level annotated datasets and multi-sensor alignment for reliable defect detection.

The Result

Maintained 99%+ defect detection accuracy across changing production environments. Reduced unplanned downtime.

99%+

Accuracy maintained in production

// 06a · Questions we get asked

Does this replace the packer at the end of the line?

No. It is the check that runs on every tray before the lid goes on, where a glance only catches what the eye happens to land on by the end of a shift. The packer still gets the held trays, with the frame and the box attached, and decides the ones the camera doubts.

What happens when the assortment changes for a new season?

The template update is the easy half. The new pieces need labeled frames before the run starts, and every tray fails the template check for the first hour until they are added, which is the tell that somebody skipped the relabel.

How does it tell a missing piece from one the model just missed?

By checking the count against the template before scoring anything. A tray short by one is read against the cup the template expects at the gap; if the model was unsure about that region, the tray is held for a person rather than marked as a missing piece on a guess.

What about two pieces that look almost identical?

Answered with more labeled frames, not a different method. A milk caramel and a milk praline in the same cup shape need a person who already knows the swirl that tells them apart checking every box the model draws on those two classes, until the boundary is the one the plant actually uses.

Read next

Chocolate box inspection with a camera over the tray line, the full walk-through →The same presence-and-position question, boxing a fastener instead of a praline →What a new seasonal assortment does to a template built for last year's box →
Start with your footageBook a demo →

// 07 · Also in manufacturing

Surface Defect Detection→Weld Quality Inspection→Assembly Verification & Error Proofing→Package & Label Inspection→Package Damage Detection→FDA Food Label Compliance→Juice Box Quality Inspection→Diabetes Device Inspection→Date & Lot Code Inspection→Predictive Maintenance→Multi-Sensor Monitoring→Tablet Defect Inspection→Syringe Barrel Defect Detection→Foreign Material Detection→Glass Defect Detection→Semiconductor Wafer Inspection→Strip Surface Defect Inspection→Ceramic Defect Detection→Wood Defect Detection→Pipe & Tube Defect Inspection→Body-in-White Inspection→Contact Lens Defect Inspection→Coffee Bean Defect Inspection→Parts Count Verification→Product Color Inspection→Blister Pack Inspection→Date Code OCR Verification→Process Compliance Tracking→Pallet Scanning→PCB Defect Detection→IV Bag Fill Level & Leak Detection→Bottle Cap Inspection→Paint Defect Detection→Fall Detection→Orthopedic Implant Inspection→All forty-one→
Surface Defect DetectionWeld Quality InspectionAssembly Verification & Error ProofingPackage & Label InspectionPackage Damage DetectionFDA Food Label ComplianceJuice Box Quality InspectionDiabetes Device InspectionDate & Lot Code InspectionPredictive MaintenanceMulti-Sensor MonitoringTablet Defect InspectionSyringe Barrel Defect DetectionForeign Material DetectionGlass Defect DetectionSemiconductor Wafer InspectionStrip Surface Defect InspectionCeramic Defect DetectionWood Defect DetectionPipe & Tube Defect InspectionBody-in-White InspectionContact Lens Defect InspectionCoffee Bean Defect InspectionParts Count VerificationProduct Color InspectionBlister Pack InspectionDate Code OCR VerificationProcess Compliance TrackingPallet ScanningPCB Defect DetectionIV Bag Fill Level & Leak DetectionBottle Cap InspectionPaint Defect DetectionFall DetectionOrthopedic Implant InspectionAll forty-one →

Send us a week of this footage. We’ll show you what comes back.

Start with your footageBook a demo →
LexData
LexData

Product

  • Platform
  • Industries
  • Use cases

Resources

  • Docs
  • The Field Guide
  • Blog
  • Why models drift

Industries

  • Energy & utilities
  • Oil & gas
  • Agriculture
  • Manufacturing
  • Insurance
  • Retail
  • Robotics

Company

  • About
  • Customers
  • Careers
  • Contact

Trust

  • Security
  • Privacy
  • Terms

Stay updated

What we learn running vision models in production.

See everything.
Miss nothing.

Stay updated

What we learn running vision models in production.

Terms of use & Privacy policy

© 2026 LexData Labs · All rights reserved