Industrial Surface Defect Detection

Apr 1, 2021 · 2 min read

Jan 2021 – Apr 2021

Problem

Industrial defect inspection is an unbalanced detection problem with an unforgiving cost function: defects are rare, visually subtle, and vary in severity, while a false negative ships a bad part and a false positive stops a line. The output the customer needs is not just defect / no defect but a grade — how severe, and therefore what to do about it.

Approach

I built the detection and grading models, and — the part that shaped the project most — the integration path.

The customer’s existing inspection software was a .NET application, not a Python stack. Rather than standing up a separate inference service and forcing a network hop into a line-rate process, the model was packaged as a .NET-consumable DLL so it could be called directly from the existing application. That removed a whole class of latency and deployment failure modes, at the cost of doing the native packaging and memory-management work properly.

On the modelling side, the emphasis was on the severity grading step: getting a reliable ordering of defect severity out of a detector matters more to the operator than squeezing the last point of detection mAP.

Tech stack

PyTorch · LibTorch · C++ · .NET DLL integration · OpenCV

Outcome

Delivered as an integrated component of the customer’s existing inspection application.