Road Obstacle Detection Method Based on Improved YOLOv5
Abstract
:1. Introduction
- The attention mechanism module is introduced to enhance feature extraction efficiency and expand the receptive field with the same convolutional kernel. This allows the model to capture subtle texture and edge information, leading to the acquisition of richer target features.
- An effective multi-scale feature fusion module is added to perform multi-scale feature extraction and fusion on the input feature map. This strengthens the connection between different levels of information and enhances the spatial texture details.
- The SPPF structure is modified, and the C3SPPF module is proposed to improve the model’s ability to understand contextual information and enhance its multi-scale adaptability. This modification boosts the performance and generalization of the algorithm.
2. Related Work
- Input: In this initial stage, the input data undergo a series of enhancement and preprocessing techniques aimed at augmenting the robustness of the algorithm throughout the training phase. These processes are crucial for ensuring that the data are optimally prepared, thereby facilitating improved performance and reliability of the model.
- Backbone: The Backbone is responsible for extracting features from the input image. It utilizes the CSP-Net structure [36], which reduces the number of parameters while enhancing the algorithm’s generalization ability. CSP-Net achieves this by dividing the feature map into two parts and introducing jump connections, maintaining efficient computation. The Backbone contains three critical modules: the ConBnSiLU module, the C3 module, and the SPPF module. The design of CSP-Net not only optimizes information flow but also strengthens feature expression, enabling the network to extract richer image features with lower computational effort.
- Neck: The Neck integrates the Feature Pyramid Network (FPN) [37] and the Path Aggregation Network (PAN) [38]. In traditional CNNs, deeper features typically contain rich semantic information but exhibit poor spatial localization, whereas shallower features offer strong localization but lack semantic depth. By combining FPN and PAN, YOLOv5 enhances semantic information in the shallow layers while improving localization in the deeper layers. This fusion of multi-scale features significantly elevates the overall performance of the network.
- Head: The Detection Head is responsible for making the final predictions regarding an object’s category and location. YOLOv5 utilizes CIOU as its loss function, which not only assesses the quality of the predicted bounding box but also takes into account elements such as position and shape. This approach facilitates better optimization of the learning and prediction processes, resulting in enhanced detection accuracy.
3. Methods
3.1. Effective Multi-Scale Feature Fusion Module
3.1.1. Efficient Multi-Scale Attention
3.1.2. Deep Separable Convolution
3.1.3. Effective Multi-Scale Feature Fusion Module
3.2. C3SPPF Module
3.3. Road Obstacle Detection Methods
4. Results
4.1. Datasets
4.2. Experimental Environment
4.3. Training Parameters and Results
4.4. Evaluation Indicators
4.5. Experimental Results
4.5.1. Ablation Experiments
4.5.2. Comparative Experiments Incorporating Different Attentions
- In terms of precision (P) metrics, the adoption of the attention mechanism resulted in significant improvements in both ECA and EMA by 3% and 3.1%, respectively. On the contrary, SE, CA, and CBAM decreased by 1.1%, 0.6%, and 3.1%, respectively.
- In terms of recall (R) metrics, the ECA and EMA attention mechanisms exhibited decreases of 1.4% and 0.6%, respectively. In contrast, the SE, CA, and CBAM attention mechanisms demonstrated improvements in recall, with increases of 2.5%, 0.1%, and 3.5%, respectively.
- In terms of mAP, all attention mechanisms showed varying degrees of improvement, with increases of 1%, 1.1%, 0.9%, and 0.8%, respectively, except for CA attention, which decreased by 0.1%. However, the differences between the improvements were minimal.
4.5.3. Comparative Experiments on the Performance of Different Algorithms
- The YOLOv5-EC3F algorithm shows significant improvement in both R and mAP values compared to YOLOv5. The R-value is increased by 7%, and mAP is improved by 3%. Although there is a slight decrease of 0.1% in the P (precision) value, the algorithm still meets real-time demands, despite a slight reduction in FPS (frames per second). Furthermore, the YOLOv5-EC3F algorithm outperforms YOLOv8 across all evaluation metrics.
- The YOLOX algorithm is 4.6% better than the YOLOv5-EC3F algorithm in precision (P) but is 2% and 2.3% lower in recall (R) and mAP, respectively. Additionally, the FPS value of YOLOX is only 34.6. YOLOv3 achieves the highest R-value and FPS, but it performs inadequately in precision and mAP. The SSD algorithm outperforms the YOLOv5-EC3F algorithm by 0.7% in precision, but it falls short in other important aspects. Overall, the YOLOv5-EC3F algorithm proposed in this paper is the most effective across the evaluated metrics.
- Comparison of experimental results between Group A and Group C shows that Group A misclassifies car as stone, while Group C misclassifies pothole as stone. The YOLOv5-EC3F algorithm defines the target more clearly, which effectively solves the problems of obstacle detection error and unclear feature expression.
- Comparison of experimental results between Group B and Group D shows that broken trees are missed in Group B, while potholes are missed in Group D. The YOLOv5-EC3F algorithm can locate the obstacle target more accurately and solves the problems of inaccurate localization and missed detection.
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Versaci, M.; Laganà, F.; Manin, L.; Angiulli, G. Soft Computing and Eddy Currents to Estimate and Classify Delaminations in Biomedical Device CFRP Plates. J. Electr. Eng. 2025, 76, 72–79. [Google Scholar] [CrossRef]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition. IEEE Trans. Pattern Anal. Mach. Intell. 2014, 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. 2017, 39, 1137–1149. [Google Scholar] [CrossRef] [PubMed]
- Uijlings, J.; Sande, K.V.D.; Gevers, T.; Smeulders, A. Selective Search for Object Recognition. Int. J. Comput. Vis. 2013, 104, 154–171. [Google Scholar] [CrossRef]
- Wei, L.; Dragomir, A.; Dumitru, E.; Christian, S.; Scott, R.; Cheng-Yang, F.; Berg, A.C. SSD: Single Shot MultiBox Detector; Springer: Cham, Switzerland, 2016; pp. 26–37. [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; IEEE: Piscataway, NJ, USA, 2016; pp. 779–788. [Google Scholar]
- Redmon, J.; Farhadi, A. YOLO9000: Better, Faster, Stronger. In Proceedings of the 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 6517–6525. [Google Scholar]
- 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]
- Liu, Z.; Zhang, Y.; Wei, Z.; Hu, Z.; Wang, H.; Xing, L.; Yu, J.; Qian, J. A Deep Learning-Based Obstacle Detection System in the Radiotherapy Room Based on YOLOv5s. In Proceedings of the 2023 2nd International Conference on Cloud Computing, Big Data Application and Software Engineering (CBASE), Chengdu, China, 3–5 November 2023; IEEE: Piscataway, NJ, USA, 2023; pp. 345–349. [Google Scholar]
- Xiang, L.; Jiang, W.B. Improvement of urban traveling road obstacle detection algorithm in YOLOv8. Electron. Meas. Technol. 2025, 48, 29–38. [Google Scholar] [CrossRef]
- Sami, A.A.; Sakib, S.; Deb, K.; Sarker, I.H. Improved YOLOv5-Based Real-Time Road Pavement Damage Detection in Road Infrastructure Management. Algorithms 2023, 16, 452. [Google Scholar] [CrossRef]
- Peng, Y.H.; Zheng, W.H.; Zhang, J.F. Deep learning based road obstacle detection method. Comput. Appl. 2020, 40, 2428–2433. [Google Scholar]
- Gao, J.-S.; Zhang, P.-N. Research on Obstacle Detection Algorithm Based on YOLOX. In Proceedings of the 2022 7th International Conference on Intelligent Computing and Signal Processing (ICSP), Xi’an, China, 15–17 April 2022; IEEE: Piscataway, NJ, USA, 2022; pp. 378–384. [Google Scholar]
- Ma, Y.; Xu, G. Research on Lightweight Obstacle Detection Model Based on Improved YOLOv5s. In Proceedings of the 2024 5th International Conference on Information Science, Parallel and Distributed Systems (ISPDS), Guangzhou, China, 31 May 2024; IEEE: Piscataway, NJ, USA, 2024; pp. 576–580. [Google Scholar]
- Feng, J.Y.; Zhang, H.; Zhang, T.L.; Peng, L.; Li, Y.J. SME-YOLO: A lightweight blind obstacle detection method. Comput. Technol. Dev. 2025, 35, 1–10. [Google Scholar] [CrossRef]
- Long, X.Y.; Nan, X.Y. A small and medium-sized obstacle detection method for intelligent driving scenarios. Sci. Technol. Eng. 2025, 25, 3778–3787. [Google Scholar]
- Liu, Y.X.; Guan, Z.S.; Shi, Y.J. Semantic segmentation-based obstacle detection for complex driving scenarios. Comput. Simul. 2023, 40, 167–171+231. [Google Scholar]
- Hui, G.; Meng, Z. Target Detection for Running Around Obstacles Based on Improved YOLOv5 Algorithm. In Proceedings of the 2024 IEEE 5th International Conference on Pattern Recognition and Machine Learning (PRML), Chongqing, China, 12–14 July 2024; pp. 296–301. [Google Scholar]
- Chen, M.Q.; Feng, S.J.; Zhang, Y.; Li, Q.F. Improved YOLOv5-based obstacle detection algorithm for UAVs. Sci. Technol. Eng. 2024, 24, 13627–13634. [Google Scholar]
- Tang, Y.J.; Miao, C.X.; Zhang, H.; Li, Y.F.; Ye, W. A low altitude UAV obstacle detection method based on position constraints and attention. J. Beijing Univ. Aeronaut. Astronaut. 2025, 51, 933–942. [Google Scholar] [CrossRef]
- Bai, J.Q.; Zhang, W.J. A lightweight UAV obstacle detection method based on YOLOv4 optimization. Electron. Meas. Technol. 2022, 45, 87–91. [Google Scholar] [CrossRef]
- Li, Y.; Ma, C.; Li, L.; Wang, R.; Liu, Z.; Sun, Z. Lightweight Tunnel Obstacle Detection Based on Improved YOLOv5. Sensors 2024, 24, 395. [Google Scholar] [CrossRef] [PubMed]
- Guan, L.; Jia, L.; Xie, Z.; Yin, C. A Lightweight Framework for Obstacle Detection in the Railway Image Based on Fast Region Proposal and Improved YOLO-Tiny Network. IEEE Trans. Instrum. Meas. 2022, 71, 1–16. [Google Scholar] [CrossRef]
- He, D.; Ren, R.; Li, K.; Zou, Z.; Ma, R.; Qin, Y.; Yang, W. Urban Rail Transit Obstacle Detection Based on Improved R-CNN. Measurement 2022, 196, 111277. [Google Scholar] [CrossRef]
- He, D.; Qiu, Y.; Miao, J.; Zou, Z.; Li, K.; Ren, C.; Shen, G. Improved Mask R-CNN for Obstacle Detection of Rail Transit. Measurement 2022, 190, 110728. [Google Scholar] [CrossRef]
- Liu, H.; Zheng, X.P.; Shen, Y.; Wang, S.Y.; Shen, Z.F.; Kai, J.R. Improved YOLOv5s-based target detection method for saplings and obstacles in nurseries. J. Agric. Eng. 2024, 40, 136–144. [Google Scholar]
- Chen, C.K.; Chen, J. Binocular vision-based obstacle detection and localization in an orchard. Agric. Mech. Res. 2023, 45, 196–201. [Google Scholar] [CrossRef]
- Xue, J.; Cheng, F.; Li, Y.; Song, Y.; Mao, T. Detection of Farmland Obstacles Based on an Improved YOLOv5s Algorithm by Using CIoU and Anchor Box Scale Clustering. Sensors 2022, 22, 1790. [Google Scholar] [CrossRef] [PubMed]
- Ruan, S.L.; Zhang, H.G.; Gu, Q.H.; Lu, C.W.; Liu, D.; Mao, J. Research on unmanned vehicle front obstacle detection in open-pit mines based on binocular vision. J. Coal 2024, 49, 1285–1294. [Google Scholar] [CrossRef]
- Zhang, J.; Wu, S.; Zhao, Q.; Liu, X.Q.; Huang, G. Development of a Lightweight Improved Algorithm for Obstacle Detection in Mine Electric Shovel Based on YOLOv5s. J. Wuhan Univ. Technol. 2025, 47, 59–66+81. [Google Scholar]
- Luo, W.; Wang, X.; Han, F.; Zhou, Z.; Cai, J.; Zeng, L.; Chen, H.; Chen, J.; Zhou, X. Research on LSTM-PPO Obstacle Avoidance Algorithm and Training Environment for Unmanned Surface Vehicles. J. Mar. Sci. Eng. 2025, 13, 479. [Google Scholar] [CrossRef]
- Liu, D.; Zhang, J.; Jin, J.; Dai, Y.; Li, L. A New Approach of Obstacle Fusion Detection for Unmanned Surface Vehicle Using Dempster-Shafer Evidence Theory. Appl. Ocean Res. 2022, 119, 103016. [Google Scholar] [CrossRef]
- Zhou, C.; Wang, Y.; Wang, L.; He, H. Obstacle Avoidance Strategy for an Autonomous Surface Vessel Based on Modified Deep Deterministic Policy Gradient. Ocean Eng. 2022, 243, 110166. [Google Scholar] [CrossRef]
- Wu, X.; Su, C.; Yu, Z.; Zhao, S.; Lu, H. Automatic Emergency Obstacle Avoidance for Intelligent Vehicles Considering Driver-Environment Risk Evaluation. Comput. Electr. Eng. 2025, 123, 110187. [Google Scholar] [CrossRef]
- Wang, C.-Y.; Mark Liao, H.-Y.; 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 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), Seattle, WA, USA, 14–19 June 2020; IEEE: Piscataway, NJ, USA, 2020; pp. 1571–1580. [Google Scholar]
- Lin, T.Y.; Dollar, P.; Girshick, R.; He, K.; Hariharan, B.; Belongie, S. Feature Pyramid Networks for Object Detection. IEEE Comput. Soc. 2017. [Google Scholar] [CrossRef]
- Liu, S.; Qi, L.; Qin, H.; Shi, J.; Jia, J. Path Aggregation Network for Instance Segmentation. In Proceedings of the 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018; IEEE: Piscataway, NJ, USA, 2018; pp. 8759–8768. [Google Scholar]
- Ouyang, D.; He, S.; Zhan, J.; Guo, H.; Huang, Z.; Luo, M.L.; Zhang, G.L. Efficient Multi-Scale Attention Module with Cross-Spatial Learning. arXiv 2023, arXiv:2305.13563. [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; IEEE: Piscataway, NJ, USA, 2021; pp. 13708–13717. [Google Scholar]
- Chollet, F. Xception: Deep Learning with Depthwise Separable Convolutions. In Proceedings of the 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July; IEEE: Piscataway, NJ, USA, 2017; pp. 1800–1807. [Google Scholar]
- 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.Y.; Kweon, I.S. CBAM: Convolutional Block Attention Module; Springer: Cham, Switzerland, 2018. [Google Scholar]
- Wang, Q.; Wu, B.; Zhu, P.; Li, P.; Zuo, W.; Hu, Q. ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks. In Proceedings of the 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 13–19 June 2020; IEEE: Piscataway, NJ, USA, 2020; pp. 11531–11539. [Google Scholar]
- Varghese, R.; Sambath, M. YOLOv8: A Novel Object Detection Algorithm with Enhanced Performance and Robustness. In Proceedings of the 2024 International Conference on Advances in Data Engineering and Intelligent Computing Systems (ADICS), Chennai, India, 18–19 April 2024; IEEE: Piscataway, NJ, USA, 2024; pp. 1–6. [Google Scholar]
- Ge, Z.; Liu, S.; Wang, F.; Li, Z.; Sun, J. YOLOX: Exceeding YOLO Series in 2021. arXiv 2021, arXiv:2107.08430. [Google Scholar]
Type of Obstacle | Label | Number of Labels | Number of Pictures |
---|---|---|---|
Stone | stone | 5281 | 1288 |
Tree | tree | 3181 | 2040 |
Pothole | pothole | 4397 | 1593 |
Algorithm | Precision/% | Recall/% | mAP@0.5/% | ||||||
---|---|---|---|---|---|---|---|---|---|
Stone | Tree | Pothole | Stone | Tree | Pothole | Stone | Tree | Pothole | |
YOLOv5s | 80.1 | 90.2 | 74.7 | 84.8 | 62.9 | 65.4 | 88.4 | 74.7 | 74.0 |
YOLOv5-EC3F | 78.4 | 92.3 | 74.0 | 89.0 | 72.0 | 73.1 | 88.6 | 79.3 | 78.2 |
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. |
© 2025 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
Tan, P.; Wang, Z.; Chang, X. Road Obstacle Detection Method Based on Improved YOLOv5. Algorithms 2025, 18, 300. https://doi.org/10.3390/a18060300
Tan P, Wang Z, Chang X. Road Obstacle Detection Method Based on Improved YOLOv5. Algorithms. 2025; 18(6):300. https://doi.org/10.3390/a18060300
Chicago/Turabian StyleTan, Pengliu, Zhi Wang, and Xin Chang. 2025. "Road Obstacle Detection Method Based on Improved YOLOv5" Algorithms 18, no. 6: 300. https://doi.org/10.3390/a18060300
APA StyleTan, P., Wang, Z., & Chang, X. (2025). Road Obstacle Detection Method Based on Improved YOLOv5. Algorithms, 18(6), 300. https://doi.org/10.3390/a18060300