An Effective Surface Defect Classification Method Based on RepVGG with CBAM Attention Mechanism (RepVGG-CBAM) for Aluminum Profiles
Abstract
:1. Introduction
2. Methodology
2.1. Data Augmentation
- (1)
- Rotation: By generating samples of aluminum surface defects at different angles for the classification model to learn, the sensitivity of the model to defects at arbitrary angles was improved.
- (2)
- Flip: Changing the position distribution of defects in the image provided image samples with richer defect position distribution.
- (3)
- Brightness transformation: Considers environmental factors. We simulated the actual variation of brightness in an aluminum profile production plant so as to improve the adaptability of the model to a complex brightness environment.
- (4)
- Contrast transformation: By changing the contrast of defect images, defect samples with different contrasts were added for classification model training.
2.2. RepVGG
2.3. CBAM Attention Mechanism
2.4. Our Proposed Method (RepVGG-CBAM)
3. Experiment and Results
3.1. Dataset
3.2. Experimental Environment and Training Parameters
3.3. Evaluation Method
3.4. Defect Classification Test Results
4. Discussion
4.1. Comparison of Different Defect Classification Algorithms
4.2. Ablation Study
5. Conclusions
- To address the problem of small and unbalanced numbers of various types of defect images in the original dataset, digital image-processing methods such as rotation, flip, contrast transformation, and brightness transformation were used to augment our dataset. Not only does this simulate the environment of the actual production conditions, but it also generates a large number of sample images for model training.
- A RepVGG-CBAM model was proposed by combining CBAM based on the RepVGGB3g4 algorithm and used to classify ten types of aluminum profile surface defects. The training process of this model was stable without overfitting. Our RepVGG-CBAM algorithm achieved promising results. Six types of defects: cl, eb, ecb, mc, nc, and op, could be perfectly classified, and their precision, recall, and F1 reached 100%. The classification accuracy of our method was 99.41%. The outstanding performance of RepVGG-CBAM demonstrated the advantages of our method in classifying surface defects in aluminum profiles.
- The classification accuracy of our RepVGG-CBAM was 4.85% better than that of the basic RepVGG algorithm, indicating that integrating a CBAM had a positive effect. In addition, the results of comparative experiments confirm that the accuracy, macro precision, macro recall, and macro F1 of our proposed method were the highest; it outperformed VGG16, VGG19, ResNet34, ResNet50, ShuffleNet_v2, and RepVGGB3g4. It indicates that our proposed RepVGG-CBAM is an advanced algorithm for classifying surface defects in aluminum profiles. Moreover, the results of the ablation study demonstrated that the classification ability was strongest when the CBAM attention mechanism was added following Stage 1 through Stage 4 of RepVGG. This provides a certain basis for later related studies.
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Zhou, W.; Shao, Z.; Yu, J.; Lin, J. Advances and Trends in Forming Curved Extrusion Profiles. Materials 2021, 14, 1603. [Google Scholar] [CrossRef] [PubMed]
- Wang, Y.; Zhao, G. Hot Extrusion Processing of Al–Li Alloy Profiles and Related Issues: A Review. Chin. J. Mech. Eng. 2020, 33, 64. [Google Scholar] [CrossRef]
- Liu, Z.; Li, L.; Li, S.; Yi, J.; Wang, G. Simulation Analysis of Porthole Die Extrusion Process and Die Structure Modifications for an Aluminum Profile with High Length–Width Ratio and Small Cavity. Materials 2018, 11, 1517. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Romanova, V.; Balokhonov, R.; Zinovieva, O.; Shakhidzhanov, V.; Dymnich, E.; Nekhorosheva, O. The relationship between mesoscale deformation-induced surface roughness, in-plane plastic strain and texture sharpness in an aluminum alloy. Eng. Fail. Anal. 2022, 137, 106377. [Google Scholar] [CrossRef]
- Wouters, O.; Vellinga, W.P.; van Tijum, R.; De Hosson, J.T.M. Effects of crystal structure and grain orientation on the roughness of deformed polycrystalline metals. Acta Mater. 2006, 54, 2813–2821. [Google Scholar] [CrossRef]
- Wang, Q.; Yang, R.; Wu, C.; Liu, Y. An effective defect detection method based on improved Generative Adversarial Networks (iGAN) for machined surfaces. J. Manuf. Process. 2021, 65, 373–381. [Google Scholar] [CrossRef]
- Karthikeyan, S.; Pravin, M.C.; Sathyabama, B.; Mareeswari, M. DWT Based LCP Features for the Classification of Steel Surface Defects in SEM Images with KNN Classifier. Aust. J. Basic Appl. Sci. 2016, 10, 13–19. [Google Scholar]
- Wei, P.; Liu, C.; Liu, M.; Gao, Y.; Liu, H. CNN-based reference comparison method for classifying bare PCB defects. J. Eng. 2018, 2018, 1528–1533. [Google Scholar] [CrossRef]
- Ricci, M.; Ficola, A.; Fravolini, M.L.; Battaglini, L.; Palazzi, A.; Burrascano, P.; Valigi, P.; Appolloni, L.; Cervo, S.; Rocchi, C. Magnetic imaging and machine vision NDT for the on-line inspection of stainless steel strips. Meas. Sci. Technol. 2012, 24, 25401. [Google Scholar] [CrossRef]
- Zaghdoudi, R.; Seridi, H.; Ziani, S. Binary Gabor pattern (BGP) descriptor and principal component analysis (PCA) for steel surface defects classification. In Proceedings of the 2020 International Conference on Advanced Aspects of Software Engineering (ICAASE), Constantine, Algeria, 28–30 November 2020; pp. 1–7. [Google Scholar]
- Hu, H.; Li, Y.; Liu, M.; Liang, W. Classification of defects in steel strip surface based on multiclass support vector machine. Multimed. Tools Appl. 2014, 69, 199–216. [Google Scholar] [CrossRef]
- Chondronasios, A.; Popov, I.; Jordanov, I. Feature selection for surface defect classification of extruded aluminum profiles. Int. J. Adv. Manuf. Technol. 2016, 83, 33–41. [Google Scholar] [CrossRef]
- Ma, Z.; Li, Y.; Huang, M.; Huang, Q.; Cheng, J.; Tang, S. A lightweight detector based on attention mechanism for aluminum strip surface defect detection. Comput. Ind. 2022, 136, 103585. [Google Scholar] [CrossRef]
- Duan, C.; Zhang, T. Two-Stream Convolutional Neural Network Based on Gradient Image for Aluminum Profile Surface Defects Classification and Recognition. IEEE Access 2020, 8, 172152–172165. [Google Scholar] [CrossRef]
- Abualighah, S.M.; Al-Naimi, A.F.; Duwairi, R.M. DD-SSD: Deep Detector for Strip Steel Defects. In Proceedings of the 2022 13th International Conference on Information and Communication Systems (ICICS), Irbid, Jordan, 21–23 June 2022; pp. 9–14. [Google Scholar]
- Zhang, J.; Li, S.; Yan, Y.; Ni, Z.; Ni, H. Surface Defect Classification of Steel Strip with Few Samples Based on Dual-Stream Neural Network. Steel Res. Int. 2022, 93, 2100554. [Google Scholar] [CrossRef]
- Liu, X.; He, W.; Zhang, Y.; Yao, S.; Cui, Z. Effect of dual-convolutional neural network model fusion for Aluminum profile surface defects classification and recognition. Math. Biosci. Eng. 2022, 19, 997–1025. [Google Scholar] [CrossRef]
- Mayr, M.; Hoffmann, M.; Maier, A.; Christlein, V. Weakly supervised segmentation of cracks on solar cells using normalized Lp norm. In Proceedings of the 2019 IEEE International Conference on Image Processing (ICIP), Taipei, Taiwan, 22–25 September 2019; pp. 1885–1889. [Google Scholar]
- Tabernik, D.; Aela, S.; Skvarč, J.; Skočaj, D. Segmentation-based deep-learning approach for surface-defect detection. J. Intell. Manuf. 2020, 31, 759–776. [Google Scholar] [CrossRef] [Green Version]
- Huang, Y.; Qiu, C.; Yuan, K. Surface defect saliency of magnetic tile. Vis. Comput. 2020, 36, 85–96. [Google Scholar] [CrossRef]
- Hao, Z.; Li, Z.; Ren, F.; Lv, S.; Ni, H. Strip Steel Surface Defects Classification Based on Generative Adversarial Network and Attention Mechanism. Metals 2022, 12, 311. [Google Scholar] [CrossRef]
- Simonyan, K.; Zisserman, A. Very deep convolutional networks for large-scale image recognition. arXiv 2014, arXiv:1409.1556. [Google Scholar]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar]
- Ding, X.; Zhang, X.; Ma, N.; Han, J.; Ding, G.; Sun, J. Repvgg: Making vgg-style convnets great again. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–25 June 2021; pp. 13733–13742. [Google Scholar]
- Qing, Y.; Liu, W.; Feng, L.; Gao, W. Improved YOLO Network for Free-Angle Remote Sensing Target Detection. Remote Sens. 2021, 13, 2171. [Google Scholar] [CrossRef]
- Wu, Z.; Wang, X.; Chen, C. Research on Lightweight Infrared Pedestrian Detection Model Algorithm for Embedded Platform. Secur. Commun. Netw. 2021, 2021, 1549772. [Google Scholar] [CrossRef]
- Hu, J.; Shen, L.; Albanie, S.; Sun, G.; Wu, E. Squeeze-and-Excitation Networks. IEEE Trans. Pattern Anal. Mach. Intell. 2020, 42, 2011–2023. [Google Scholar] [CrossRef] [PubMed]
- Woo, S.; Park, J.; Lee, J.; Kweon, I.S. Cbam: Convolutional block attention module. In Proceedings of the European conference on computer vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 3–19. [Google Scholar]
- Wang, Q.; Wu, B.; Zhu, P.; Li, P.; Zuo, W.; Hu, Q. Supplementary material for ‘ECA-Net: Efficient channel attention for deep convolutional neural networks. In Proceedings of the 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 13–19. [Google Scholar]
- Feng, X.; Gao, X.; Luo, L. X-SDD: A New Benchmark for Hot Rolled Steel Strip Surface Defects Detection. Symmetry 2021, 13, 706. [Google Scholar] [CrossRef]
Type | cl | ds | eb | ecb | gra | mc | nc | op | pb | spf |
---|---|---|---|---|---|---|---|---|---|---|
Number | 407 | 261 | 538 | 346 | 128 | 365 | 390 | 173 | 82 | 86 |
Total | 2776 |
Type | cl | ds | eb | ecb | gra | mc | nc | op | pb | spf |
---|---|---|---|---|---|---|---|---|---|---|
Number | 814 | 783 | 1076 | 1038 | 768 | 730 | 780 | 1038 | 738 | 774 |
Proportion (%) | 9 | 9 | 13 | 12 | 9 | 9 | 9 | 12 | 9 | 9 |
Stage | Output Size | Layers of Each Stage | Number of Channels |
---|---|---|---|
1 | 112 × 112 | 1 | 64 |
2 | 56 × 56 | 4 | 192 |
3 | 28 × 28 | 6 | 384 |
4 | 14 × 14 | 16 | 768 |
5 | 7 × 7 | 1 | 2560 |
Defect Class | Training Set | Validation Set | Testing Set |
---|---|---|---|
cl | 587 | 146 | 81 |
ds | 564 | 141 | 78 |
eb | 776 | 193 | 107 |
ecb | 748 | 187 | 103 |
gra | 554 | 138 | 76 |
mc | 526 | 131 | 73 |
nc | 562 | 140 | 78 |
op | 748 | 187 | 103 |
pb | 532 | 133 | 73 |
spf | 558 | 139 | 77 |
total | 6155 | 1535 | 849 |
Parameters | Setting |
---|---|
Optimizer | Adam |
Learning rate | 0.0001 |
Batch size | 16 |
Epoch | 100 |
Label | Precision (%) | Recall (%) | F1 (%) | Accuracy (%) |
---|---|---|---|---|
cl | 100 | 100 | 100 | 99.41 |
ds | 100 | 97.44 | 98.70 | |
eb | 100 | 100 | 100 | |
ecb | 100 | 100 | 100 | |
gra | 97.44 | 100 | 98.70 | |
mc | 100 | 100 | 100 | |
nc | 100 | 100 | 100 | |
op | 100 | 100 | 100 | |
pb | 100 | 95.89 | 97.9 | |
spf | 96.25 | 100 | 98.09 |
Methods | Accuracy (%) | Macro Precision (%) | Macro Recall (%) | Macro F1 (%) |
---|---|---|---|---|
VGG16 | 98.35 | 98.21 | 98.16 | 98.18 |
VGG19 | 97.53 | 97.25 | 97.32 | 97.28 |
ResNet34 | 97.41 | 97.23 | 97.18 | 97.29 |
ResNet50 | 97.76 | 97.84 | 97.78 | 97.80 |
ShuffleNet_v2 | 97.64 | 97.48 | 97.43 | 97.42 |
RepVGGB3g4 | 98.82 | 98.77 | 98.71 | 98.73 |
RepVGG-CBAM (ours) | 99.41 | 99.37 | 99.33 | 99.34 |
Stage 1 | Stage 2 | Stage 3 | Stage 4 | Stage 5 | Accuracy (%) |
---|---|---|---|---|---|
✓ | - | - | - | - | 98.94 |
✓ | ✓ | - | - | - | 99.29 |
✓ | ✓ | ✓ | - | - | 99.17 |
✓ | ✓ | ✓ | ✓ | - | 99.41 |
✓ | ✓ | ✓ | ✓ | ✓ | 98.58 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 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
Li, Z.; Li, B.; Ni, H.; Ren, F.; Lv, S.; Kang, X. An Effective Surface Defect Classification Method Based on RepVGG with CBAM Attention Mechanism (RepVGG-CBAM) for Aluminum Profiles. Metals 2022, 12, 1809. https://doi.org/10.3390/met12111809
Li Z, Li B, Ni H, Ren F, Lv S, Kang X. An Effective Surface Defect Classification Method Based on RepVGG with CBAM Attention Mechanism (RepVGG-CBAM) for Aluminum Profiles. Metals. 2022; 12(11):1809. https://doi.org/10.3390/met12111809
Chicago/Turabian StyleLi, Zhiyang, Bin Li, Hongjun Ni, Fuji Ren, Shuaishuai Lv, and Xin Kang. 2022. "An Effective Surface Defect Classification Method Based on RepVGG with CBAM Attention Mechanism (RepVGG-CBAM) for Aluminum Profiles" Metals 12, no. 11: 1809. https://doi.org/10.3390/met12111809
APA StyleLi, Z., Li, B., Ni, H., Ren, F., Lv, S., & Kang, X. (2022). An Effective Surface Defect Classification Method Based on RepVGG with CBAM Attention Mechanism (RepVGG-CBAM) for Aluminum Profiles. Metals, 12(11), 1809. https://doi.org/10.3390/met12111809