A Feature-Oriented Reconstruction Method for Surface-Defect Detection on Aluminum Profiles
Abstract
:1. Introduction
- (a)
- A new unsupervised surface-defect detection method for aluminum profiles is proposed. It solves the problems of the existing supervised learning surface-defect detection methods for aluminum profiles, which require a large number of manually labeled defect features in advance, and a small number of aluminum profile samples and incomplete defect types lead to the insufficient detection capability of undefined defect categories.
- (b)
- Incorporating the feature-optimization module into the Masked Auto-Encoders (MAE) model eliminates the complex texture randomly distributed on the surface of aluminum profiles and retains its surface feature information, which excludes the interference of irregular texture on the generated model and improves the performance of the model.
2. Related Works
2.1. Deep Learning Detection Methods
2.2. Transformer
3. Proposed Methods
- (a)
- Adaptive preprocessing of aluminum profile images: Images of aluminum profiles with different background colors, lighting, and placement angles are extracted by adaptive boundary extraction, removal of background colors and data normalization to obtain images with no background, only the main part of aluminum profiles, and uniform specifications.
- (b)
- Essential Feature Learning: Firstly, the boundary extraction, background removal, and data normalization operations are performed on the non-defective images aluminum profile dataset. Then these are cropped to 224 × 224 specifications and input into the model one by one. The model performs feature extraction on them, removes the masked image blocks based on the randomly generated mask image (mask rate of 75%), and inputs 25% of the image blocks that are not removed into the encoder and decoder for prediction of the removed image blocks. Finally, the loss constraint is utilized to make the reconstructed image as consistent as possible with the input image.
- (c)
- Surface-defect detection: Firstly, the image to be detected is adaptively preprocessed to get the aluminum profile image with uniform specifications. Then it is cropped to obtain all of the area images, and the area images are input into the model one by one. The feature-reconstructed image is then compared with the area-feature image by mean structural similarity index measure (MSSIM) comparison to determine whether the input image is a defective image. Finally, the detection results of all area images of the image to be detected are used to determine the final detection results.
3.1. Aluminum Profile Image Preprocessing
3.1.1. Adaptive Boundary Extraction
- (a)
- S-channel image extraction.
- (b)
- Binarization processing.
- (c)
- Extract the maximum connected domain.
- (d)
- Adaptive boundary-line fitting.
3.1.2. Data Normalization
- (a)
- Adaptive Rotation.
- (b)
- Finding the maximum internally connected rectangle.
- (c)
- Cropping and scaling processing.
3.2. Image Essential Feature Learning Model
3.2.1. Transformer Model
3.2.2. Feature-Optimization Module
- (a)
- Convert the image format, then convert the area image to a grayscale image one by one, using conversion equations as follows:
- (b)
- The feature discrimination of the area grayscale image, eliminating the complex texture features randomly distributed on the surface of the main image of the aluminum profile and highlighting its essential features, is processed as follows:
3.2.3. Essential Features Extraction Network
- (a)
- Feature-Optimization Layer: the image input to the encoder first passes through the feature-optimization layer, which consists of three parts: the feature-optimization module, the convolutional layer, and the flatten function. Firstly, the essential features of the area image are extracted by the full variational image restoration algorithm, and then the essential features image has its features extracted by the convolutional layer, which divides the area image X into N blocks as in Equation (17). Next, the N blocks of the image are transformed into a one-dimensional sequence using the Flatten function, and the linear transformation of the sequence is performed as in Equation (18):
- (b)
- Positional Embedding: The positional encoding is introduced in order to prevent the loss of sequentiality of the positional information of the accession sequence, as shown in Equation (19).
- (c)
- Class token: The Concat function is utilized to add a learnable category encoding that is used to represent the global features of the image after encoding:
- (d)
- Transformer Block: The data Z is encoded through this process as in Equations (21) and (22).
- (e)
- Layer Norm: The data output from (4) is normalized by this process as in Equation (23):
- (f)
- Decoder: The output vector of the encoder is used as the input for the decoder, and after the data enters the decoder, it first passes through the Linear layer for dimensional conversion, and in order to ensure that it can distinguish between the different positions of mask tokens in the image, it will be added to the data as a whole with decoder-positional embedding.
- (g)
- Loss: The mean square error (MSE) and SSIM [38] are used as loss functions to calculate the loss of the original and restored images of the feature-optimization map as shown in (24), where the MSE expression is shown in (25):
3.3. Aluminum Profiles Surface-Defect Detection
3.3.1. Defect-Detection Process
- (a)
- Area-feature image acquisition. The main image of the aluminum profile obtained by the aluminum profile image preprocessing method is cropped to an image of uniform specification of 224 × 224, i.e., an area image, and then image restoration operations are performed one by one on the area image to remove its randomly distributed complex texture, and obtain an area-feature image that effectively maintains the essential feature information of the aluminum profile surface.
- (b)
- Mask image production. The entire area image obtained from one aluminum profile image is sequentially masked with two fixed masks each with a removal rate of 75%, respectively, to obtain two mask images, as shown in Figure 11.
- (c)
- Feature Reconstruction: The mask image is fed into the detection model, and the feature-reconstructed image of the corresponding area-feature image is reconstructed sequentially.
- (d)
- Defective or non-defective judgment: The MSSIM comparison is performed on the feature-reconstructed image and the regional feature image, and the regional image whose obtained MSSIM value is less than the judgment threshold is judged to be a defective image, and the regional image whose obtained MSSIM value is greater than the judgment threshold is judged to be a non-defective image.
- (e)
- Aluminum profile surface-defect detection results are classified: If all the regional images cropped out of an aluminum profile image are non-defective images, the aluminum profile is judged to be a non-defective product, otherwise it is judged to be a defective product.
3.3.2. Definition of Judgment Thresholds
4. Experimental Results and Discussion
4.1. Experimental Environment
4.2. Data Description
4.3. Experimental Result
4.4. Comparative Experiments
4.4.1. Experiments Comparing Feature-Optimization Methods
4.4.2. Model Comparison Experiment
4.5. Ablation Experiment
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Tian, H.; Wang, D.; Lin, J.; Chen, Q.; Liu, Z. Surface defects detection of stamping and grinding flat parts based on machine vision. Sensors 2020, 20, 4531. [Google Scholar] [CrossRef] [PubMed]
- Xu, C.; Li, L.; Li, J.; Wen, C. Surface defects detection and identification of lithium battery pole piece based on multi-feature fusion and PSO-SVM. IEEE Access 2021, 9, 85232–85239. [Google Scholar] [CrossRef]
- Le, N.; Rathour, V.S.; Yamazaki, K.; Luu, K.; Savvides, M. Deep reinforcement learning in computer vision: A comprehensive survey. Artif. Intell. Rev. 2022, 55, 2733–2819. [Google Scholar] [CrossRef]
- Hesamian, M.H.; Jia, W.; He, X.; Kennedy, P. Deep learning techniques for medical image segmentation: Achievements and challenges. J. Digit. Imaging 2019, 32, 582–596. [Google Scholar] [CrossRef] [PubMed]
- Martínez, S.S.; Vázquez, C.O.; García, J.G.; Ortega, J.G. Quality inspection of machined metal parts using an image fusion technique. Measurement 2017, 111, 374–383. [Google Scholar] [CrossRef]
- Tian, C.; Fei, L.; Zheng, W.; Xu, Y.; Zuo, W.; Lin, C.W. Deep learning on image denoising: An overview. Neural Netw. 2020, 131, 251–275. [Google Scholar] [CrossRef] [PubMed]
- Krizhevsky, A.; Sutskever, I.; Hinton, G.E. Imagenet classification with deep convolutional neural networks. Adv. Neural Inf. Process. Syst. 2012, 25, 84–90. [Google Scholar] [CrossRef]
- Hu, J.; Shen, L.; Sun, G. Squeeze-and-excitation networks. In Proceedings of the IEEE Conference on Computer 690 Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018; pp. 7132–7141. [Google Scholar]
- Liao, D.; Cui, Z.; Zhu, Z.; Jiang, Z.; Zheng, Q.; Wu, N. A nondestructive recognition and classification method for detecting surface defects of Si3N4 bearing balls based on an optimized convolutional neural network. Opt. Mater. 2023, 136, 113401. [Google Scholar] [CrossRef]
- Song, K.; Sun, X.; Ma, S.; Yan, Y. Surface Defect Detection of Aero-engine Blades Based on Cross-layer Semantic Guidance. IEEE Trans. Instrum. Meas. 2023, 72, 2514411. [Google Scholar] [CrossRef]
- Guan, S.; Shi, H. Fabric defect detection based on the saliency map construction of target-driven feature. J. Text. Inst. 2018, 109, 1133–1142. [Google Scholar] [CrossRef]
- Wang, C.; Xie, H. MeDERT: A Metal Surface Defect Detection Model. IEEE Access 2023, 11, 35469–35478. [Google Scholar] [CrossRef]
- Xiao, S.; Liu, Z.; Yan, Z.; Wang, M. Grad-MobileNet: A Gradient-Based Unsupervised Learning Method for Laser Welding Surface Defect Classification. Sensors 2023, 23, 4563. [Google Scholar] [CrossRef] [PubMed]
- Zhou, Q.; Wang, H.; Wang, Y. Defect detection method based on knowledge distillation. IEEE Access 2023, 11, 35866–35873. [Google Scholar] [CrossRef]
- Rui, J.; Qiang, N. Research on textile defects detection based on improved generative adversarial network. J. Eng. Fibers Fabr. 2022, 17, 15. [Google Scholar] [CrossRef]
- Guo, Y.; Zhong, L.; Qiu, Y.; Wang, H.; Gao, F.; Wen, Z.; Zhan, C. Using ISU-GAN for unsupervised small sample defect detection. Sci. Rep. 2022, 12, 11604. [Google Scholar] [CrossRef] [PubMed]
- Khan, S.; Naseer, M.; Hayat, M.; Zamir, S.W.; Khan, F.S.; Shah, M. Transformers in vision: A survey. ACM Comput. Surv. (CSUR) 2022, 54, 1–41. [Google Scholar] [CrossRef]
- Qi, L.; Zhang, Y.; Liu, T. Bidirectional Transformer with absolute-position aware relative position encoding for encoding sentences. Front. Comput. Sci. 2023, 17, 171301. [Google Scholar] [CrossRef]
- Von der Mosel, J.; Trautsch, A.; Herbold, S. On the validity of pre-trained transformers for natural language processing in the software engineering domain. IEEE Trans. Softw. Eng. 2022, 49, 1487–1507. [Google Scholar] [CrossRef]
- Mosin, V.; Samenko, I.; Kozlovskii, B.; Tikhonov, A.; Yamshchikov, I.P. Fine-tuning transformers: Vocabulary transfer. Artif. Intell. 2023, 317, 103860. [Google Scholar] [CrossRef]
- Tay, Y.; Dehghani, M.; Bahri, D.; Metzler, D. Efficient Transformers: A Survey. ACM Comput. Surv. 2022, 55, 109. [Google Scholar] [CrossRef]
- Badaro, G.; Saeed, M.; Papotti, P. Transformers for Tabular Data Representation: A survey of models and applications. Trans. Assoc. Comput. Linguist. 2023, 11, 227–249. [Google Scholar] [CrossRef]
- Carion, N.; Massa, F.; Synnaeve, G.; Usunier, N.; Kirillov, A.; Zagoruyko, S. End-to-end object detection with transformers. In European Conference on Computer Vision; Springer International Publishing: Cham, Switzerland, 2020; pp. 213–229. [Google Scholar]
- Yu, H.; Liu, D.; Zhang, Z.; Wang, J. A Dynamic Transformer Network with Early Exit Mechanism for Fast Detection of Multiscale Surface Defects. IEEE Trans. Instrum. Meas. 2023, 72, 5025710. [Google Scholar] [CrossRef]
- Wang, J.; Xu, G.; Yan, F.; Wang, J.; Wang, Z. Defect transformer: An efficient hybrid transformer architecture for surface defect detection. Measurement 2023, 211, 112614. [Google Scholar] [CrossRef]
- Shang, H.; Sun, C.; Liu, J.; Chen, X.; Yan, R. Defect-aware transformer network for intelligent visual surface defect detection. Adv. Eng. Inform. 2023, 55, 101882. [Google Scholar] [CrossRef]
- Dosovitskiy, A.; Beyer, L.; Kolesnikov, A.; Weissenborn, D.; Zhai, X.; Unterthiner, T.; Dehghani, M.; Minderer, M.; Heigold, G.; Gelly, S.; et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv 2020, arXiv:2010.11929. [Google Scholar]
- Zhou, W.; Hong, J. FHENet: Lightweight Feature Hierarchical Exploration Network for Real-Time Rail Surface Defect Inspection in RGB-D Images. IEEE Trans. Instrum. Meas. 2023, 72, 5005008. [Google Scholar] [CrossRef]
- Chang, Q.; Li, X.; Zhao, Y. Reversible data hiding for color images based on adaptive three-dimensional histogram modification. IEEE Trans. Circuits Syst. Video Technol. 2022, 32, 5725–5735. [Google Scholar] [CrossRef]
- Fan, Z.; Lin, H.; Li, C.; Su, J.; Bruno, S.; Loprencipe, G. Use of parallel ResNet for high-performance pavement crack detection and measurement. Sustainability 2022, 14, 1825. [Google Scholar] [CrossRef]
- Huo, D.; Wang, J.; Qian, Y.; Yang, Y.H. Glass segmentation with RGB-thermal image pairs. IEEE Trans. Image Process. 2023, 32, 1911–1926. [Google Scholar] [CrossRef]
- Song, K.; Bao, Y.; Wang, H.; Huang, L.; Yan, L. A Potential Vision-Based Measurements Technology: Information Flow Fusion Detection Method Using RGB-Thermal Infrared Images. IEEE Trans. Instrum. Meas. 2023, 72, 5004813. [Google Scholar] [CrossRef]
- Zhang, F.; Jiang, X.; Xia, Z.; Gabbouj, M.; Peng, J.; Feng, X. Non-Local Color Compensation Network for Intrinsic Image Decomposition. IEEE Trans. Circuits Syst. Video Technol. 2022, 33, 132–145. [Google Scholar] [CrossRef]
- Zhang, Y.; Di, X.; Zhang, B.; Ji, R.; Wang, C. Better than reference in low-light image enhancement: Conditional re-enhancement network. IEEE Trans. Image Process. 2021, 31, 759–772. [Google Scholar] [CrossRef] [PubMed]
- Mohsan, M.M.; Akram, M.U.; Rasool, G.; Alghamdi, N.S.; Baqai, M.A.A.; Abbas, M. Vision Transformer and Language Model Based Radiology Report Generation. IEEE Access 2022, 11, 1814–1824. [Google Scholar] [CrossRef]
- Zhuang, X.; Liu, F.; Hou, J.; Hao, J.; Cai, X. Modality attention fusion model with hybrid multi-head self-attention for video understanding. PLoS ONE 2022, 17, e0275156. [Google Scholar] [CrossRef]
- Lou, X.; Jia, Z.; Yang, J.; Kasabov, N. Change detection in SAR images based on the ROF model semi-implicit denoising method. Sensors 2019, 19, 1179. [Google Scholar] [CrossRef]
- Bakurov, I.; Buzzelli, M.; Schettini, R.; Castelli, M.; Vanneschi, L. Full-Reference Image Quality Expression via Genetic Programming. IEEE Trans. Image Process. 2023, 32, 1458–1473. [Google Scholar] [CrossRef]
- Pukelsheim, F. The Three Sigma Rule. Am. Stat. 1994, 48, 88–91. [Google Scholar]
- Chen, R.; Cai, D.; Hu, X.; Zhan, Z.; Wang, S. Defect detection method of aluminum profile surface using deep self-attention mechanism under hybrid noise conditions. IEEE Trans. Instrum. Meas. 2021, 70, 3524509. [Google Scholar] [CrossRef]
- Liu, J.; Song, K.; Feng, M.; Yan, Y.; Tu, Z.; Zhu, L. Semi-supervised anomaly detection with dual prototypes autoencoder for industrial surface inspection. Opt. Lasers Eng. 2021, 136, 106324. [Google Scholar] [CrossRef]
- Jiang, L.; Yuan, B.; Wang, Y.; Ma, Y.; Du, J.; Wang, F.; Guo, J. MA-YOLO: A Method for Detecting Surface Defects of Aluminum Profiles with Attention Guidance. IEEE Access 2023, 11, 71269–71286. [Google Scholar] [CrossRef]
Environment | Name | Model |
---|---|---|
Hardware environment | Processor | Intel(R) Core(TM) [email protected] GHz |
Internal memory | 32GB DDR5 | |
GPU | NVIDIA GeForce RTX 3070Ti Laptop GPU | |
Software environment | CUDA Toolkit | 10.0 |
Pytorch | 1.7.1 | |
Data | Data |
Model | PR | RC | F1 |
---|---|---|---|
VAE + ROF | 0.686 | 0.603 | 0.642 |
GAN + ROF | 0.624 | 0.584 | 0.598 |
MAE | 0.850 | 0.751 | 0.798 |
Ours | 0.974 | 0.931 | 0.952 |
Model | PR | TPR | TNR | F1 | AUC |
---|---|---|---|---|---|
AE(L2) | 0.78 | 0.74 | 0.45 | 0.76 | 0.68 |
AE(SSIM) | 0.83 | 0.64 | 0.66 | 0.73 | 0.67 |
VAE | 0.79 | 0.64 | 0.54 | 0.71 | 0.63 |
AnoGAN | 0.69 | 0.68 | 0.58 | 0.63 | 0.64 |
GANomaly | 0.79 | 0.74 | 0.49 | 0.76 | 0.72 |
DPAE | 0.96 | 0.92 | 0.89 | 0.94 | 0.92 |
Ours | 0.97 | 0.93 | 0.98 | 0.95 | 0.95 |
Model | PR | RC | F1 |
---|---|---|---|
SSD300 | 0.958 | 0.511 | 0.672 |
Faster R-CNN | 0.541 | 0.879 | 0.658 |
YOLOv3 | 0.901 | 0.787 | 0.826 |
YOLOv4 | 0.928 | 0.599 | 0.671 |
YOLOv5s | 0.884 | 0.792 | 0.827 |
YOLOX_s | 0.875 | 0.829 | 0.847 |
YOLOv6s | 0.769 | 0.725 | 0.739 |
YOLOv7 | 0.878 | 0.554 | 0.639 |
DETR | 0.711 | 0.837 | 0.778 |
MA-YOLO | 0.908 | 0.811 | 0.849 |
Ours | 0.974 | 0.931 | 0.952 |
Original Image | Normalization Data | Partial Area Image | Area-Feature Image | Reconstructed Area-Feature Image | Actual | Desired |
---|---|---|---|---|---|---|
Defective | Defective | |||||
Non-defective | Non-defective | |||||
Non-defective | Defective | |||||
Defective | Non-defective |
Blocks | 8 × 8 | 16 × 16 | 32 × 32 |
---|---|---|---|
PR | 0.581 | 0.974 | 0.738 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Tang, S.; Zhang, Y.; Jin, Z.; Lu, J.; Li, H.; Yang, J. A Feature-Oriented Reconstruction Method for Surface-Defect Detection on Aluminum Profiles. Appl. Sci. 2024, 14, 386. https://doi.org/10.3390/app14010386
Tang S, Zhang Y, Jin Z, Lu J, Li H, Yang J. A Feature-Oriented Reconstruction Method for Surface-Defect Detection on Aluminum Profiles. Applied Sciences. 2024; 14(1):386. https://doi.org/10.3390/app14010386
Chicago/Turabian StyleTang, Shancheng, Ying Zhang, Zicheng Jin, Jianhui Lu, Heng Li, and Jiqing Yang. 2024. "A Feature-Oriented Reconstruction Method for Surface-Defect Detection on Aluminum Profiles" Applied Sciences 14, no. 1: 386. https://doi.org/10.3390/app14010386
APA StyleTang, S., Zhang, Y., Jin, Z., Lu, J., Li, H., & Yang, J. (2024). A Feature-Oriented Reconstruction Method for Surface-Defect Detection on Aluminum Profiles. Applied Sciences, 14(1), 386. https://doi.org/10.3390/app14010386