An Efficient Printing Defect Detection Based on YOLOv5-DCN-LSK
Abstract
:1. Introduction
- We replaced the C3 module in the backbone network with the C3-DCN module, enabling adaptive refinement of the ROI and flexible adjustment of convolutional kernel shapes. This modification significantly improved the network’s ability to detect elongated defects in printed materials.
- To improve the detection of minute defects, we integrated the LSK-RepConv module between the neck and prediction layers. Additionally, we proposed the WEIoU loss function, which combined NWD with EIoU to better assess anchor box similarity, thereby enhancing feature extraction for small-scale objects and boosting detection accuracy.
- To ensure compatibility with low-power mobile devices and achieve a balance between accuracy and speed, we adopted a lightweight design for the improved model. Model pruning is employed to remove redundant weights, reducing model complexity and inference time.
2. Method
2.1. Improved-YOLOv5
2.1.1. C3-DCN
2.1.2. LSK-RepConv
2.1.3. WEIoU
2.1.4. Model Compression by Pruning
3. Experiments and Analyses
3.1. Dataset
3.2. Experimental Setup
3.3. Experimental Evaluation Metrics
3.4. Experimental Results
3.5. Ablation Experimental
3.6. Comparison of Results of Pruning Algorithms
3.7. Comparative Experiments
4. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Shi, Y.; Hou, B.; Liu, J.; Liu, A.; Guo, S.; Liu, J. Element Defective Sample Augmentation Method Based on Improved DCGAN. In Proceedings of the 2023 IEEE 16th International Conference on Electronic Measurement & Instruments (ICEMI), Harbin, China, 9–11 August 2023; pp. 167–171. [Google Scholar]
- Valente, A.C.; Wada, C.; Neves, D.; Neves, D.; Perez, F.V.M.; Megeto, G.A.S.; Cascone, M.H.; Gomes, O.; Lin, Q. Print defect mapping with semantic segmentation. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, Snowmass Village, CO, USA, 2–5 March 2020; pp. 3551–3559. [Google Scholar]
- Ma, B.; Wei, Z.; Wang, Y.; Wu, H. The defect detection of personalized print based on template matching. In Proceedings of the 2017 IEEE International Conference on Unmanned Systems (ICUS), Beijing, China, 27–29 October 2017; pp. 266–271. [Google Scholar]
- Son, J.H.; Kim, C.O. A Study on the Application of Deep Learning Models for Real-Time Defect Detection in the Manufacturing Process: Cases of Defect detection in the Label Printing Process. J. Korea TAPPI 2021, 53, 74–81. [Google Scholar] [CrossRef]
- Betti, A.; Tucci, M. YOLO-S: A lightweight and accurate YOLO-like network for small target detection in aerial imagery. Sensors 2023, 23, 1865. [Google Scholar] [CrossRef]
- Luo, J.; Wang, Q.; Zou, R.; Wang, Y.; Liu, F.; Zheng, H.; Du, S.; Yuan, C. A Heart Image Segmentation Method Based on Position Attention Mechanism and Inverted Pyramid. Sensors 2023, 23, 9366. [Google Scholar] [CrossRef] [PubMed]
- Jing, B.; Duan, P.; Chen, L.; Du, Y. EM-YOLO: An X-Ray Prohibited-Item-Detection Method Based on Edge and Material Information Fusion. Sensors 2023, 23, 8555. [Google Scholar] [CrossRef] [PubMed]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Spatial pyramid pooling in deep convolutional networks for visual recognition. IEEE Trans. Pattern Anal. Mach. Intell. 2015, 37, 1904–1916. [Google Scholar] [CrossRef] [PubMed]
- Ren, S.; He, K.; Girshick, R.; Sun, J. Faster R-CNN: Towards real-time object detection with region proposal networks. IEEE Trans. Pattern Anal. Mach. Intell. 2016, 39, 1137–1149. [Google Scholar] [CrossRef] [PubMed]
- Liu, W.; Anguelov, D.; Erhan, D.; Szegedy, C.; Reed, S.; Fu, C.Y.; Berg, A.C. Ssd: Single shot multibox detector. In European Conference on Computer Vision 2016; Leibe, B., Matas, J., Sebe, N., Welling, M., Eds.; Springer: Berlin/Heidelberg, Germany, 2016. [Google Scholar] [CrossRef]
- Bochkovskiy, A.; Wang, C.-Y.; Liao, H.-Y.M. Yolov4: Optimal speed and accuracy of object detection. arXiv 2004, arXiv:2004.10934. [Google Scholar] [CrossRef]
- Li, J.; Bai, X.; Pan, J.; Tian, Q. A Deep Learning Method for Printing Defect Detection. In Proceedings of the 2022 IEEE 4th International Conference on Power, Intelligent Computing and Systems (ICPICS), Shenyang, China, 29–31 July 2022; pp. 246–249. [Google Scholar]
- Liu, A.; Yang, E.; Wu, J.; Teng, Y.; Yu, L. Double sparse low rank decomposition for irregular printed fabric defect detection. Neurocomputing 2022, 482, 287–297. [Google Scholar] [CrossRef]
- Zhang, E.; Ma, Q.; Chen, Y.; Duan, J.; Shao, L. EGD-Net: Edge-Guided and differential attention network for surface defect detection. J. Ind. Inf. Integr. 2022, 30, 100403. [Google Scholar] [CrossRef]
- Li, D.; Li, Y.; Li, J.; Lu, G. PPR-Net: Patch-Based multi-scale pyramid registration network for defect detection of printed labels. In Asian Conference on Computer Vision 2022; Wang, L., Gall, J., Chin, T.-J., Sato, I., Chellappa, R., Eds.; Springer: Berlin/Heidelberg, Germany, 2022; pp. 4061–4076. [Google Scholar]
- Tang, H.; Shan, L.; Dan, Y.; Qiao, Y. A visual defect detection for optics lens based on the YOLOv5-C3CA-SPPF network model. Opt. Express 2023, 31, 2628–2643. [Google Scholar] [CrossRef] [PubMed]
- Wang, C.-Y.; Liao, H.-Y.M.; Wu, Y.-H.; Chen, P.-Y.; Hsieh, J.-W.; Yeh, I.-H. CSPNet: A new backbone that can enhance learning capability of CNN. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, Seattle, WA, USA, 14–19 June 2020; pp. 390–391. [Google Scholar] [CrossRef]
- Dai, J.; Qi, H.; Xiong, Y.; Li, Y.; Zhang, G.; Hu, H.; Wei, Y. Deformable convolutional networks. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22 October 2017; pp. 764–773. [Google Scholar] [CrossRef]
- Wang, W.; Dai, J.; Chen, Z.; Huang, Z.; Li, Z.; Zhu, X.; Hu, X.; Lu, T.; Lu, L.; Li, H.; et al. Internimage: Exploring large-scale vision foundation models with deformable convolutions. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 14408–14419. [Google Scholar] [CrossRef]
- Li, Y.; Hou, Q.; Zheng, Z.; Cheng, M.-M.; Yang, J.; Li, X. Large Selective Kernel Network for Remote Sensing Object Detection. arXiv 2023, arXiv:2303.09030. [Google Scholar] [CrossRef]
- Zhang, Y.-F.; Ren, W.; Zhang, Z.; Jia, Z.; Wang, L.; Tan, T. Focal and efficient IOU loss for accurate bounding box regression. arXiv 2021, arXiv:2101.08158. [Google Scholar] [CrossRef]
- Wang, J.; Xu, C.; Yang, W.; Yu, L. A normalized Gaussian Wasserstein distance for tiny object detection. arXiv 2022, arXiv:2110.13389. [Google Scholar] [CrossRef]
- Fang, G.; Ma, X.; Song, M.; Mi, M.B.; Wang, X. Depgraph: Towards any structural pruning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 16091–16101. [Google Scholar] [CrossRef]
- Lee, J.; Park, S.; Mo, S.; Ahn, S.; Shin, J. Layer-adaptive sparsity for the magnitude-based pruning. arXiv 2021, arXiv:2010.07611. [Google Scholar] [CrossRef]
- Liu, Z.; Li, J.; Shen, Z.; Huang, G.; Yan, S.; Zhang, C. Learning efficient convolutional networks through network slimming. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22–29 October 2017; pp. 2736–2744. [Google Scholar] [CrossRef]
- Hao, L.; Kadav, A.; Durdanovic, I.; Samet, H.; Graf, H.P. Pruning filters for efficient convnets. arXiv 2017, arXiv:1608.08710. [Google Scholar] [CrossRef]
- Wang, C.-Y.; Bochkovskiy, A.; Liao, H.-Y.M. YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 7464–7475. [Google Scholar] [CrossRef]
- Terven, J.; Córdova-Esparza, D.-M.; Romero-González, J.-A. A comprehensive review of yolo architectures in computer vision: From yolov1 to yolov8 and yolo-nas. Mach. Learn. Knowl. Extr. 2023, 5, 1680–1716. [Google Scholar] [CrossRef]
- Howard, A.; Mark, S.; Grace, C.; Chen, L.-C.; Chen, B.; Tan, M.; Wang, W.; Zhu, Y.; Pang, P.; Vasudevan, V. Searching for mobilenetv3. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 1314–1324. [Google Scholar] [CrossRef]
- Ma, N.; Zhang, X.; Zheng, H.-T.; Sun, J. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 116–131. [Google Scholar] [CrossRef]
- Chen, J.; Kao, S.; He, H.; Zhuo, W.; Wen, S.; Lee, C.-H.; Chan, G.S.-H. Run, Don’t walk: Chasing higher FLOPS for faster neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 12021–12031. [Google Scholar] [CrossRef]
- Han, K.; Wang, Y.; Tian, Q.; Guo, J.; Xu, C.; Xu, C. Ghostnet: More features from cheap operations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 1580–1589. [Google Scholar] [CrossRef]
- Tan, M.; Le, Q.V. Efficientnet: Rethinking model scaling for convolutional neural networks. arXiv 2019, arXiv:1905.11946. [Google Scholar] [CrossRef]
Model | Precision (%) | Recall (%) | [email protected] | [email protected]:0.95 | Parameter | GFLOPs |
---|---|---|---|---|---|---|
YOLOv3 | 0.952 | 0.921 | 0.941 | 0.705 | 2,336,818 | 5.9 |
YOLOv3-tiny | 0.949 | 0.900 | 0.928 | 0.640 | 547,700 | 1.0 |
YOLOv5s | 0.938 | 0.922 | 0.936 | 0.726 | 7,023,610 | 15.8 |
YOLOv5n | 0.951 | 0.938 | 0.939 | 0.714 | 1,765,930 | 4.1 |
YOLOv7 | 0.948 | 0.939 | 0.936 | 0.719 | 2,346,204 | 6.9 |
YOLOv7-tiny | 0.945 | 0.930 | 0.925 | 0.710 | 1,517,444 | 3.4 |
YOLOv8n | 0.950 | 0.941 | 0.942 | 0.728 | 3,011,807 | 8.2 |
IoU Name | [email protected] | [email protected] | [email protected]:0.95 |
---|---|---|---|
CIoU | 0.939 | 0.838 | 0.714 |
GIoU | 0.935 | 0.830 | 0.712 |
EIoU | 0.943 | 0.842 | 0.72 |
DIoU | 0.876 | 0.745 | 0.654 |
WEIoU | 0.941 | 0.846 | 0.725 |
Dataset | Number of Images | Satellite Ink Spot | White Line | Mark | Offset | Dirty |
---|---|---|---|---|---|---|
Train | 3000 | 630 | 580 | 800 | 670 | 950 |
Validation | 360 | 80 | 74 | 105 | 65 | 127 |
Test | 360 | 77 | 80 | 96 | 70 | 120 |
Total | 3720 | 787 | 734 | 1001 | 805 | 1197 |
Parameter | Value |
---|---|
Init_lr | 0.02 |
Batchsize | 8 |
Lr decay | 0.01 (0.02 × 0.01) |
Epoch | 500 |
Box loss gain | 0.5 |
Momentum | 0.937 |
Optimizer | Adam |
Learning rate schedule | Linear |
Defect Class | Precision (%) | Recall (%) | [email protected] | [email protected] | [email protected]:0.95 |
---|---|---|---|---|---|
Satellite ink spot | 0.991 | 0.996 | 0.995→0.995 | 0.973→0.995 | 0.874→0.892 |
White line | 0.961 | 0.943 | 0.957→0.973 | 0.853→0.894 | 0.741→0.751 |
Mark | 0.987 | 0.980 | 0.984→0.985 | 0.925→0.950 | 0.726→0.740 |
Offset | 0.849 | 0.861 | 0.767→0.868 | 0.519→0.648 | 0.469→0.547 |
Dirty | 0.983 | 0.986 | 0.985→0.985 | 0.920→0.944 | 0.760→0.777 |
Method | Precision (%) | Recall (%) | [email protected] | [email protected] | [email protected]:0.95 | Params |
---|---|---|---|---|---|---|
Baseline (YOLOv5n) | 0.951 | 0.938 | 0.939 | 0.838 | 0.714 | 1.76 |
+LSK-Rep | 0.950 | 0.954 | 0.960 | 0.862 | 0.733 | 1.95 |
+C3-DCN | 0.955 | 0.944 | 0.955 | 0.851 | 0.719 | 1.74 |
+LSK-Rep+C3-DCN | 0.960 | 0.959 | 0.966 | 0.855 | 0.732 | 1.91 |
+WEiou | 0.956 | 0.934 | 0.941 | 0.846 | 0.725 | 1.76 |
+WEiou+C3-DCN | 0.947 | 0.937 | 0.941 | 0.851 | 0.724 | 1.72 |
+WEiou+LSK-Rep | 0.956 | 0.946 | 0.946 | 0.867 | 0.733 | 1.95 |
Ours | 0.941 | 0.956 | 0.957 | 0.890 | 0.745 | 1.91 |
Name | Precision (%) | Recall (%) | [email protected] | [email protected] | [email protected]:0.95 | Parameters | FPS |
---|---|---|---|---|---|---|---|
Before pruning | 0.941 | 0.956 | 0.957 | 0.890 | 0.745 | 1,910,892 | 267.5 |
LAMP [24] | 0.934 | 0.901 | 0.934 (−0.023) | 0.782 (−0.108) | 0.676 (−0.069) | 539,915 (28.25%) | 339.1 |
Random pruning | 0.918 | 0.939 | 0.950 (−0.007) | 0.847 (−0.043) | 0.719 (−0.026) | 1,039,981 (54.42%) | 332.9 |
L1 [25] | 0.939 | 0.958 | 0.966 (+0.009) | 0.886 (−0.004) | 0.745 (0.000) | 650,468 (34.04%) | 325.5 |
Slimming [26] | 0.966 | 0.952 | 0.958 (+0.001) | 0.888 (−0.002) | 0.744 (−0.001) | 863,491 (45.19%) | 328.2 |
Group sparsity [23] | 0.953 | 0.956 | 0.964 (+0.007) | 0.878 (−0.012) | 0.742 (−0.003) | 776,110 (40.62%) | 335.9 |
Group Norm [23] | 0.954 | 0.953 | 0.961 (+0.004) | 0.886 (−0.004) | 0.741 (−0.004) | 664,675 (34.78%) | 323.2 |
Model | [email protected] | [email protected]:0.95 | Parameters | GFLOPs | Inference/ms (bs = 16) |
---|---|---|---|---|---|
YOLOv3 | 0.941 | 0.705 | 2,336,818 | 5.9 | 3.0 × 10−3 |
YOLOv3-tiny | 0.928 | 0.64 | 547,700 | 1.0 | 1.4 × 10−3 |
YOLOv5s | 0.936 | 0.726 | 7,023,610 | 15.8 | 6.3 × 10−3 |
YOLOv5n | 0.939 | 0.714 | 1,765,930 | 4.1 | 2.6 × 10−3 |
YOLOv7 [27] | 0.936 | 0.719 | 2,346,204 | 6.9 | 4.5 × 10−3 |
YOLOv7-tiny [27] | 0.925 | 0.710 | 1,517,444 | 3.4 | 2.4 × 10−3 |
YOLOv8 [28] | 0.942 | 0.728 | 3,011,807 | 8.2 | 5.2 × 10−3 |
Mobilenetv3 [29] | 0.948 | 0.683 | 1,337,884 | 2.2 | 3.0 × 10−3 |
Shufflenetv2 [30] | 0.829 | 0.575 | 813,254 | 1.5 | 1.5 × 10−3 |
Fasternet [31] | 0.836 | 0.628 | 3,191,646 | 7.2 | 3.9 × 10−3 |
Ghostnet [32] | 0.866 | 0.658 | 2,531,106 | 3.3 | 5.3 × 10−3 |
EfficientLite [33] | 0.948 | 0.715 | 1,005,214 | 2.2 | 4.2 × 10−3 |
Improved-YOLOv5 (before pruning) | 0.957 | 0.745 | 1,910,892 | 4.5 | 3.7 × 10−3 |
Improved-YOLOv5 (pruning) | 0.961 | 0.741 | 664,675 | 2.2 | 3.0 × 10−3 |
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. |
© 2024 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
Liu, J.; Cai, Z.; He, K.; Huang, C.; Lin, X.; Liu, Z.; Li, Z.; Chen, M. An Efficient Printing Defect Detection Based on YOLOv5-DCN-LSK. Sensors 2024, 24, 7429. https://doi.org/10.3390/s24237429
Liu J, Cai Z, He K, Huang C, Lin X, Liu Z, Li Z, Chen M. An Efficient Printing Defect Detection Based on YOLOv5-DCN-LSK. Sensors. 2024; 24(23):7429. https://doi.org/10.3390/s24237429
Chicago/Turabian StyleLiu, Jie, Zelong Cai, Kuanfang He, Chengqiang Huang, Xianxin Lin, Zhenyong Liu, Zhicong Li, and Minsheng Chen. 2024. "An Efficient Printing Defect Detection Based on YOLOv5-DCN-LSK" Sensors 24, no. 23: 7429. https://doi.org/10.3390/s24237429
APA StyleLiu, J., Cai, Z., He, K., Huang, C., Lin, X., Liu, Z., Li, Z., & Chen, M. (2024). An Efficient Printing Defect Detection Based on YOLOv5-DCN-LSK. Sensors, 24(23), 7429. https://doi.org/10.3390/s24237429