Semiconductor scratch inspection

This is a scratch inspection of the kind you see often in packaging and test processes. When a scratch on the part is clearly visible it is easy enough to detect. The difficulty comes when the scratch is easily confused with the part’s own surface pattern.
Look at the part below. It has a horizontal grain of its own. Look closely and you can see a fine scratch running toward the four o’clock position.

When the optical illumination is not uniform, the scratch gets brighter or darker depending on where it sits, which makes detection harder still. If the part can rotate, the range of conditions widens further.
Rule-based vision struggles to cover every one of those conditions reliably, so an AI-based approach suits the problem better. We collect images of both good and defective parts and train a model to fit the specific part under inspection.
Results come out at roughly 95% accuracy, 98% recall, 90% precision, and a 95% F1 score. The current configuration is tuned for high recall and low precision — catching every defect, even at the cost of false rejects. Where a missed defect is acceptable, tuning for high precision and low recall instead will raise yield.
Below is the detection result, with the region the model judged to be a scratch marked in red.

