A Practical Guide to Industrial Defect Detection with Pre‑trained Neural Networks
The article explains how manufacturers can shift from defect‑specific vision models to anomaly detection by leveraging pre‑trained object‑detection networks, visualising feature maps, and applying memory‑bank methods such as PaDiM and PatchCore, with the open‑source Anomalib library as a ready‑to‑use solution.
Problem Statement
Manufacturers need to detect defects on production parts. Conventional computer‑vision pipelines require labeled images for every defect type, which is often infeasible. Modern anomaly‑detection approaches treat any deviation from the normal appearance as a defect, simplifying data collection.
Using Pre‑trained Object‑Detection Networks
A defect detector must (1) extract visual features, (2) decide whether a feature is anomalous, and optionally (3) localise the anomaly. Object‑detection convolutional neural networks (CNNs) already satisfy these requirements, so they can be reused without training a new model from scratch.
Naïve Fine‑tuning Attempt
One could fine‑tune a pre‑trained detector to recognise only “good” parts; any deviation would be flagged as a defect. This yields a binary “no defect” signal but provides no localisation and still requires a collection of defect images for validation.
What a Detector Learns
After each convolutional layer a CNN produces a set of feature maps. Visualising these maps shows that shallow layers capture edges, mid layers capture shapes, and deep layers capture whole objects. When feeding images of manufactured parts, the feature maps highlight the part’s characteristics. Differences between defect‑free and defective images appear as distinct patterns in shallow feature maps, and each map can be projected back onto the original image to obtain spatial locations.
Memory‑Bank Methods
Memory‑bank approaches treat defect detection as a problem of memorising the feature‑map representation of defect‑free samples and flagging any deviation.
PaDiM computes the mean and covariance of the feature maps of normal samples, producing a statistical summary that reduces memory usage at inference time.
PatchCore selects a subset of representative feature vectors from normal images using a distance‑based selection, discarding many training‑set features while retaining strong performance.
https://arxiv.org/pdf/2011.08785 https://arxiv.org/abs/2106.08265
Implementation Reference
The algorithms are available in the open‑source Anomalib library (maintained by Intel). Anomalib provides ready‑to‑use implementations of PaDiM, PatchCore, and other anomaly‑detection models.
https://anomalib.readthedocs.io/en/v2.2.0/
AI Algorithm Path
A public account focused on deep learning, computer vision, and autonomous driving perception algorithms, covering visual CV, neural networks, pattern recognition, related hardware and software configurations, and open-source projects.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
