Masked Swin Transformer Unet for Industrial Anomaly Detection

The intelligent detection process for industrial anomalies employs artificial intelligence methods to classify images that deviate from a normal appearance. Traditional convolutional neural network (CNN)-based anomaly detection algorithms mainly use the network to restructure abnormal areas and detect anomalies by calculating the errors between the original image and reconstructed image. However, the traditional CNNs struggle to extract global context information, resulting in poor anomaly detection performance. Thus, a masked Swin Transformer Unet (MSTUnet) for anomaly detection is proposed. To solve the problem of insufficient abnormal samples in the training phase, an anomaly simulation and mask strategy is first applied on anomaly-free samples to generate a simulated anomaly and, then, the Swin Transformer's powerful global learning ability is used to inpaint the masked area. Finally, a convolution-based Unet network is used for end-to-end anomaly detection. Experimental results on industrial dataset MVTec AD show that MSTUnet achieves superior anomaly detection and localization performance.