Quality control through anomaly detection
Spotting a defect on a watch component with an iPhone, without first having to photograph thousands of faulty parts.
Context
Visual inspection of watch components is done by eye, under a loupe, on parts a few millimetres across. It is slow, tiring work whose consistency depends on the time of day.
Automating it with machine learning seems obvious until someone asks for the training set. A rare defect is rare by definition: nobody holds a collection of thousands of rejected parts, sorted by defect type.
Constraints
Classic supervised classification was therefore out. What was needed was a method that learns only from conforming parts and flags anything that departs from them.
Second constraint: confidentiality. The components photographed are industrial property. Sending images to an external analysis service was not on the table.
Third constraint: the tool had to be usable at the bench, not from a workstation in another building.
Solution
Unsupervised anomaly detection, trained only on conforming parts, and running directly on an iPhone held over the component.
The training set was produced synthetically: components are modelled and rendered under variations of lighting, orientation and material, which yields a volume of conforming images no photography campaign would have produced in the same time.
Architecture
Two approaches were implemented and compared. PatchCore builds a memory of normal features and measures the distance of each image region to that memory. EfficientAD targets the same result with a smaller compute footprint, which matters when inference runs on a phone.
The synthetic images are produced in Blender, with explicit control over which variations should count as normal. That is where the quality of the system is decided: a model trained on renders that are too clean will flag reflections as defects.
The models are converted for CoreML and executed on the device. No image leaves the iPhone, network latency disappears, and the tool works in a workshop with no Wi-Fi coverage.
Outcome
The setup works on the principle that mattered: learn the normal rather than collect the abnormal. It transfers to a new component by regenerating a synthetic set, without starting another photography campaign.
The approach holds beyond watchmaking, for any mass-produced part where defects are rare and industrial property is sensitive.
CoreML · PatchCore · EfficientAD · Blender · iPhone