In actual production of light chemical industrial products,product quality is easily affected due to equipment and operating environment limitations,and surface defects are the most direct manifestation of product quality damage.Therefore,surface defect detection plays a key role in ensuring product quality and maintaining industrial production lines.With the advancement of technology,automated and intelligent surface defect detection methods are an important means of simultaneously balancing quality and efficiency.Different products have various forms of surface defects,and even new types of defects may appear during the production process that were not previously observed.Traditional image processing techniques applied to surface defect detection tasks suffer from problems such as poor algorithm robustness and incomplete feature information extraction.Additionally,defective products are often scarce in number,making it difficult to collect enough samples,which poses difficulty in supervised learning.This thesis adopts an unsupervised anomaly detection method based on deep learning,using convolutional neural networks and Transformer as different structures to build a reconstruction network.The model is trained using defect-free images,and the difference between the reconstructed image and the test image is used to detect defects.The main research work carried out is as follows.I.A light chemical industrial products surface defect detection method based on dual attention and consistency loss is proposed.To address the problem of diverse surface defect types for different products and the difficulty in collecting defect samples,a generative adversarial network based on a convolutional neural network structure is used overall.The generator network uses an encoder-decoder structure to quickly reconstruct defect-free images.Since convolutional neural networks typically use a single-size convolution kernel,the amount of feature information captured is insufficient.To obtain richer semantic information,a dual attention module is added to the encoder network,which uses parallel fusion of channel attention and pixel attention to enhance the network’s extraction of key features.To constrain the network to focus only on the features of normal samples,a consistency loss function is composed of pixel consistency,structural consistency,and gradient consistency between the input image and the reconstructed image,which enhances the network’s ability to reconstruct normal samples while suppressing the ability to reconstruct defect parts,further improving the accuracy of defect detection.Ⅱ.A light chemical industrial products surface defect detection method based on the Transformer multi-scale mask cross-layer feature fusion network is proposed.The CNN network has a large difference in similarity feature representation between shallow and deep layers,and lacks attention to global information,while the Transformer-based network structure has highly similar representations in shallow and deep layers,it can retain more global information.Research shows that Transformer-based models can achieve comparable or even superior performance in image classification tasks.The overall approach adopts a Transformer-based generative adversarial network structure,and the Transformer block embedding operation uses large-kernel convolution with a larger stride.Although it has powerful global feature extraction capabilities,it introduces too much redundant information.To more effectively extract important information from images and eliminate redundant information,a stacking of small-kernel convolution with a smaller stride is used for block embedding operations.At the same time,different scales of masks are used to complementarily mask a normal image.Then,the encoder-decoder structure with cross-layer feature fusion is used to reconstruct the masked part,and the reconstructed parts are reassembled to obtain a complete reconstructed image.First,the model is trained to reconstruct normal samples,and after the model is trained,the anomaly score is calculated using the similarity of gradient magnitudes between the query image and the reconstructed image.III.Evaluate the effectiveness of the two proposed surface defect detection methods for light chemical industrial products.A series of experiments were conducted on the MVTec AD dataset containing 15 product categories and the Magnetic Tile industrial product surface defect dataset.The hyperparameters were adjusted during training on different datasets to find the parameter settings that achieved optimal performance for the network model.In addition,this thesis provided a detailed explanation of each module in the network structure and analyzed the role of each module in the structure through design of different structures for ablation experiments.Finally,compared with the AUC of other surface defect detection methods,the results showed that the proposed method can effectively be used for surface defect detection in lightweight industrial products..In summary,this thesis is based on the image reconstruction method using deep learning,which trains the network only with normal samples to reconstruct images that are as similar as possible to the normal samples.During the detection phase,defects are discovered by analyzing the differences between the reconstructed images and the test images.It has been demonstrated by the experimental results that the method proposed in this thesis performs more effectively in light chemical industrial product surface defect detection. |