SGN-YOLO: Detecting Wood Defects with Improved YOLOv5 Based on Semi-Global Network
Abstract
:1. Introduction
- We design a semi-global network to replace the C3 module, which focuses on local information and integrates global information simultaneously.
- We combine the E-ELAN with the depth model to learn more diverse features without disrupting the gradient pathways. Additionally, we improve the loss function by introducing a smoothing term to address the issue of offset and imprecise localization in object detection.
- We propose a unified framework (SGN-YOLO) for accurate defect detection and conduct extensive experiments on public datasets. Our approach achieved 86.4% in the mean average precision (mAP) metric, surpassing many existing models.
2. Related Works
2.1. Methods Based on Traditional Machine Learning Algorithms
2.2. Methods Based on Deep Learning Algorithms
3. Methodology
3.1. Baseline
3.2. Semi-Global Network (SGN)
3.3. Extended Efficient Layer Aggregation Networks (E-ELAN)
3.4. Efficient Intersection over Union (EIOU) loss
4. Materials
4.1. Experimental Settings and Evaluation Indicators
4.2. Evaluation Indices
4.3. Image Acquisition
5. Results and Discussion
5.1. Comparison Experiment of Different Attention Mechanisms
5.2. Comparison Experiment of Different Loss Functions
5.3. Comparison Experiment of Different Algorithms
5.4. Ablation Experiments
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Cherry, R.; Manalo, A.; Karunasena, W.; Stringer, G. Out-of-grade sawn pine: A state-of-the-art review on challenges and new opportunities in cross laminated timber (CLT). Constr. Build. Mater. 2019, 211, 858–868. [Google Scholar] [CrossRef]
- Kodytek, P.; Bodzas, A.; Bilik, P. A large-scale image dataset of wood surface defects for automated vision-based quality control processes. F1000Research 2021, 10, 581. [Google Scholar] [CrossRef]
- Urbonas, A.; Raudonis, V.; Maskeliūnas, R.; Damaševičius, R. Automated Identification of Wood Veneer Surface Defects Using Faster Region-Based Convolutional Neural Network with Data Augmentation and Transfer Learning. Appl. Sci. 2019, 9, 4898. [Google Scholar] [CrossRef]
- Du, X.; Li, J.; Feng, H.; Chen, S. Image reconstruction of internal defects in wood based on segmented propagation rays of stress waves. Appl. Sci. 2018, 8, 1778. [Google Scholar] [CrossRef]
- Mu, H. Study on Wood Defects Testing Based on Artificial Neural Network. Master’s Thesis, Northest Forestry University, Harbin, China, 2006. [Google Scholar]
- Zhang, W.; Wang, L. The Reasearch Progress on Non-destructive Testing of Mechanical Properities of Standing Trees Based on Stress Wave Method. For. Eng. 2014, 30, 48–51+55. [Google Scholar] [CrossRef]
- Zhang, Y.; Xu, C.; Li, C.; Yu, H.; Cao, J. Wood defect detection method with PCA feature fusion and compressed sensing. J. For. Res. 2015, 26, 745–751. [Google Scholar] [CrossRef]
- Wang, L.; Li, L.; Qi, W.; Yang, H. Pattern recognition and size determination of internal wood defects based on wavelet neural networks. Comput. Electron. Agric. 2009, 69, 142–148. [Google Scholar] [CrossRef]
- Wang, D.; Liu, Z.; Cong, F. Wood Surface Quality Detection and Classification Using Gray Level and Texture Features. In Advances in Neural Networks—ISNN 2015; Hu, X., Xia, Y., Zhang, Y., Zhao, D., Eds.; Springer: Cham, Switzerland, 2015; pp. 248–257. [Google Scholar]
- Hashim, U.R.; Hashim, S.Z.M.; Muda, A.K. Performance evaluation of multivariate texture descriptor for classification of timber defect. Optik 2016, 127, 6071–6080. [Google Scholar] [CrossRef]
- Girshick, R.; Donahue, J.; Darrell, T.; Malik, J. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Columbus, OH, USA, 23–28 July 2014; pp. 580–587. [Google Scholar]
- 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. 2017, 39, 1137–1149. [Google Scholar] [CrossRef]
- He, K.; Gkioxari, G.; Dollár, P.; Girshick, R. Mask r-cnn. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22–29 October 2017; pp. 2961–2969. [Google Scholar]
- Redmon, J.; Divvala, S.; Girshick, R.; Farhadi, A. You Only Look Once: Unified, Real-Time Object Detection. In Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 26 June–1 July 2016; pp. 779–788. [Google Scholar] [CrossRef]
- Redmon, J.; Farhadi, A. YOLOv3: An Incremental Improvement. arXiv 2018, arXiv:1804.02767. [Google Scholar]
- Bochkovskiy, A.; Wang, C.Y.; Liao, H.Y.M. YOLOv4: Optimal Speed and Accuracy of Object Detection. arXiv 2020, arXiv:2004.10934. [Google Scholar]
- Zhang, Y.; Liu, S.; Cao, J.; Li, C.; Yu, H. A rapid, automated flaw segmentation method using morphological reconstruction to grade wood flooring. J. For. Res. 2014, 25, 959–964. [Google Scholar] [CrossRef]
- Chang, Z.; Cao, J.; Zhang, Y. A novel image segmentation approach for wood plate surface defect classification through convex optimization. J. For. Res. 2018, 29, 1789–1795. [Google Scholar] [CrossRef]
- Gu, I.Y.H.; Andersson, H.; Vicen, R. Wood defect classification based on image analysis and support vector machines. Wood Sci. Technol. 2010, 44, 693–704. [Google Scholar] [CrossRef]
- Xu, Z.; Jia, P.; Wu, N.; Xu, K. Research on wood defect recognition technology based on GA-SVM. Transducre Microsyst. Technol. 2019, 38, 153–156. [Google Scholar] [CrossRef]
- Zhang, Y.; Liu, S.; Cao, J.; Li, C.; Yu, H. Wood board image processing based on dual-tree complex wavelet feature selection and compressed sensing. Wood Sci. Technol. 2016, 50, 297–311. [Google Scholar] [CrossRef]
- Fan, J. Research on Defect Detection Algorithm of Solid Wood Plate Based on Deep Learning. Master’s Thesis, Nanjing Forestry University, Nanjing, China, 2020. [Google Scholar]
- Liu, W.; Anguelov, D.; Erhan, D.; Szegedy, C.; Reed, S.; Fu, C.Y.; Berg, A.C. SSD: Single Shot MultiBox Detector. In Computer Vision—ECCV 2016; Leibe, B., Matas, J., Sebe, N., Welling, M., Eds.; Springer: Cham, Switzerland, 2016; pp. 21–37. [Google Scholar]
- Yang, Y.; Wang, H.; Jiang, D.; Hu, Z. Surface Detection of Solid Wood Defects Based on SSD Improved with ResNet. Forests 2021, 12, 1419. [Google Scholar] [CrossRef]
- Fang, Y.; Guo, X.; Chen, K.; Zhou, Z.; Ye, Q. Accurate and Automated Detection of Surface Knots on Sawn Timbers Using YOLO-V5 Model. BioResources 2021, 16, 5390. [Google Scholar] [CrossRef]
- Yun, S.; Han, D.; Chun, S.; Oh, S.J.; Yoo, Y.; Choe, J. CutMix: Regularization Strategy to Train Strong Classifiers With Localizable Features. In Proceedings of the 2019 IEEE/CVF International Conference on Computer Vision (ICCV), Seoul, Republic of Korea, 27 October–2 November 2019; pp. 6022–6031. [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. arXiv 2022, arXiv:2207.02696. [Google Scholar]
- Cao, Y.; Xu, J.; Lin, S.; Wei, F.; Hu, H. Global Context Networks. IEEE Trans. Pattern Anal. Mach. Intell. 2020, 45, 6881–6895. [Google Scholar] [CrossRef]
- Yu, J.; Jiang, Y.; Wang, Z.; Cao, Z.; Huang, T. UnitBox: An Advanced Object Detection Network. In Proceedings of the 24th ACM International Conference on Multimedia, Amsterdam, The Netherlands, 15–19 October 2016; pp. 516–520. [Google Scholar] [CrossRef]
- Rezatofighi, H.; Tsoi, N.; Gwak, J.; Sadeghian, A.; Reid, I.; Savarese, S. Generalized intersection over union: A metric and a loss for bounding box regression. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, CA, USA, 16–20 June 2019; pp. 658–666. [Google Scholar]
- Zheng, Z.; Wang, P.; Liu, W.; Li, J.; Ye, R.; Ren, D. Distance-IoU loss: Faster and better learning for bounding box regression. In Proceedings of the AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 February 2020; Volume 34, pp. 12993–13000. [Google Scholar]
- Zhang, Y.F.; Ren, W.; Zhang, Z.; Jia, Z.; Wang, L.; Tan, T. Focal and efficient IOU loss for accurate bounding box regression. Neurocomputing 2022, 506, 146–157. [Google Scholar] [CrossRef]
- Huang, Z.; Wang, X.; Huang, L.; Huang, C.; Wei, Y.; Liu, W. CCNet: Criss-Cross Attention for Semantic Segmentation. In Proceedings of the 2019 IEEE/CVF International Conference on Computer Vision (ICCV), Seoul, Republic of Korea, 27 October–2 November 2019; pp. 603–612. [Google Scholar] [CrossRef]
- Wang, X.; Girshick, R.; Gupta, A.; He, K. Non-local Neural Networks. In Proceedings of the 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018; pp. 7794–7803. [Google Scholar] [CrossRef]
- Wang, F.; Jiang, M.; Qian, C.; Yang, S.; Li, C.; Zhang, H.; Wang, X.; Tang, X. Residual Attention Network for Image Classification. In Proceedings of the 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017; pp. 6450–6458. [Google Scholar] [CrossRef]
- Niu, Z.; Zhong, G.; Yu, H. A review on the attention mechanism of deep learning. Neurocomputing 2021, 452, 48–62. [Google Scholar] [CrossRef]
- Hu, J.; Shen, L.; Sun, G. Squeeze-and-Excitation Networks. In Proceedings of the 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018; pp. 7132–7141. [Google Scholar] [CrossRef]
- Woo, S.; Park, J.; Lee, J.Y.; Kweon, I.S. CBAM: Convolutional Block Attention Module. In Computer Vision—ECCV 2018; Ferrari, V., Hebert, M., Sminchisescu, C., Weiss, Y., Eds.; Springer: Cham, Swizterland, 2018; pp. 3–19. [Google Scholar]
- Hou, Q.; Zhou, D.; Feng, J. Coordinate Attention for Efficient Mobile Network Design. In Proceedings of the 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Nashville, TN, USA, 19–25 June 2021; pp. 13708–13717. [Google Scholar] [CrossRef]
- Yuan, M.; Gao, L.; Fu, H.; Xia, S.H. Temporal Upsampling of Depth Maps Using a Hybrid Camera. IEEE Trans. Vis. Comput. Graph. 2017, 25, 1591–1602. [Google Scholar] [CrossRef] [PubMed]
Models | P (%) | R (%) | mAP (%) | Model Volume (M) |
---|---|---|---|---|
YOLOv5s | 83.0 | 78.7 | 83.3 | 14.1 |
YOLOv5m | 83.0 | 85.7 | 86.5 | 42.7 |
YOLOv5l | 83.6 | 84.1 | 86.7 | 91.5 |
YOLOv7-tiny | 75.8 | 80.4 | 81.2 | 12.3 |
YOLOv7 | 83.4 | 85.3 | 86.8 | 74.9 |
Defect Type | Number of Occurrences | Overall Occurrence in the Dataset (%) |
---|---|---|
live knot | 2981 | 30.7 |
dead knot | 1846 | 19.0 |
resin | 2220 | 22.8 |
knot with crack | 1337 | 13.7 |
crack | 1319 | 13.5 |
Models | Live Knot (%) | Dead Knot (%) | Resin (%) | Knot with Crack (%) | Crack (%) | P (%) | R (%) | mAP (%) |
---|---|---|---|---|---|---|---|---|
YOLOv5 | 75.6 | 80.7 | 85.4 | 92.0 | 82.7 | 83.0 | 78.7 | 83.3 |
+SE | 75.8 | 88.0 | 86.9 | 91.1 | 82.7 | 79.9 | 83.1 | 84.9 |
+CBAM | 74.0 | 86.2 | 90.2 | 90.1 | 83.2 | 80.5 | 85.5 | 84.7 |
+CA | 76.5 | 86.0 | 89.2 | 92.9 | 83.7 | 81.9 | 83.5 | 85.6 |
+GCN | 76.3 | 87.5 | 86.8 | 92.4 | 83.9 | 79.8 | 82.1 | 85.4 |
+SGN | 76.9 | 87.4 | 90.3 | 92.5 | 84.4 | 80.3 | 82.6 | 86.3 |
Models | Live Knot (%) | Dead Knot (%) | Resin (%) | Knot with Crack (%) | Crack (%) | P (%) | R (%) | mAP (%) |
---|---|---|---|---|---|---|---|---|
+GIOU | 54.4 | 59.8 | 69.5 | 88.0 | 75.2 | 81.7 | 66.3 | 71.4 |
+DIOU | 59.3 | 71.8 | 71.9 | 89.1 | 76.6 | 76.3 | 70.4 | 73.9 |
+CIOU | 61.4 | 70.3 | 74.2 | 90.5 | 78.2 | 75.9 | 71.5 | 74.9 |
+EIOU | 77.2 | 87.7 | 86.8 | 92.8 | 84.8 | 78.1 | 83.4 | 85.9 |
Models | P(%) | R(%) | mAP (%) | FPS | Average Detection Time (s) |
---|---|---|---|---|---|
Faster R-CNN | 48.0 | 82.5 | 72.8 | 24.0 | 0.026 |
SSD | 86.5 | 51.2 | 79.3 | 61.2 | 0.017 |
ResNet + SSD | 87.1 | 62.3 | 85.4 | 68.5 | 0.015 |
YOLOv3 | 80.7 | 80.7 | 82.6 | 42.8 | 0.028 |
YOLOv5 | 83.0 | 78.7 | 83.3 | 52.5 | 0.016 |
YOLOv7 | 83.4 | 85.3 | 86.8 | 54.3 | 0.030 |
SGN-YOLO | 80.6 | 82.9 | 86.4 | 51.8 | 0.015 |
Baseline | SGN | EIOU | E-ELAN | Live Knot (%) | Dead Knot (%) | Resin (%) | Knot with Crack (%) | Crack (%) | P (%) | R (%) | mAP (%) |
---|---|---|---|---|---|---|---|---|---|---|---|
YOLOv5 | 75.6 | 80.7 | 85.4 | 92.0 | 82.7 | 83.0 | 78.7 | 83.3 | |||
+ | ✓ | 76.9 | 87.4 | 90.3 | 92.5 | 84.4 | 80.3 | 82.6 | 86.3 | ||
+ | ✓ | ✓ | 77.2 | 87.7 | 86.8 | 92.8 | 84.8 | 78.1 | 83.4 | 85.9 | |
+ | ✓ | ✓ | ✓ | 78.0 | 87.2 | 90.2 | 91.3 | 85.2 | 80.6 | 82.9 | 86.4 |
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
Meng, W.; Yuan, Y. SGN-YOLO: Detecting Wood Defects with Improved YOLOv5 Based on Semi-Global Network. Sensors 2023, 23, 8705. https://doi.org/10.3390/s23218705
Meng W, Yuan Y. SGN-YOLO: Detecting Wood Defects with Improved YOLOv5 Based on Semi-Global Network. Sensors. 2023; 23(21):8705. https://doi.org/10.3390/s23218705
Chicago/Turabian StyleMeng, Wei, and Yilin Yuan. 2023. "SGN-YOLO: Detecting Wood Defects with Improved YOLOv5 Based on Semi-Global Network" Sensors 23, no. 21: 8705. https://doi.org/10.3390/s23218705
APA StyleMeng, W., & Yuan, Y. (2023). SGN-YOLO: Detecting Wood Defects with Improved YOLOv5 Based on Semi-Global Network. Sensors, 23(21), 8705. https://doi.org/10.3390/s23218705