Robust unsupervised-learning based crack detection for stamped metal products
Crack detection plays an important role in the industrial inspection of stamped metal products. While supervised learning methods are commonly used in the quality assessment process, they often require a substantial amount of labeled data, which can be challenging to obtain in a well-tuned production line. Unsupervised learning has demonstrated exceptional performance in anomaly detection. This study proposes an unsupervised algorithm for crack detection on stamped metal surfaces, capable of classification and segmentation without the need for crack images during training. The approach leverages the Vector Quantized-Variational Autoencoder 2 (VQ-VAE2) based model to reconstruct input images, while retaining crack details. Additionally, latent features at different scales are quantized into discrete representations using a codebook. To learn the distribution of these discrete representations from non-crack samples, the study utilizes PixelSNAIL, an autoregressive model used for sequential modeling. In the testing stage, the model assigns low probabilities to discrete features that deviate from the non-crack distribution. These potential crack candidate features are resampled using vectors in the codebook that exhibit the highest dissimilarity. The edited representations are then fed into the decoder to generate resampled images that have the most significant differences in the crack area from the original reconstruction. Crack patterns are extracted at the pixel level by subtracting resampled images from the reconstruction. Prior knowledge that crack patterns often appear darker is leveraged to enhance the crack features. A robust classification criterion is introduced based on the probability given by the autoregressive model. Extensive experiments were conducted using images captured from stamped metal panels. The results demonstrate that the proposed technique exhibits robust performance and high accuracy.