LSH-YOLO: A Lightweight Algorithm for Helmet-Wear Detection
Abstract
1. Introduction
- (1)
- High computational complexity and large parameter count: current mainstream methods, while improving detection accuracy, significantly increase computational burden and storage overhead, limiting deployment on resource-constrained devices (e.g., Jetson, mobile devices);
- (2)
- Inconsistent detection performance across different target scales: when detecting small-scale or densely distributed targets (e.g., helmets worn by distant workers), conventional detection heads exhibit poor feature adaptation, negatively impacting overall accuracy;
- (3)
- Insufficient loss function optimization for low- and medium-quality samples: the original IoU-based loss function suffers from an unreasonable gradient distribution for medium-quality anchor boxes, leading to inadequate focus on important samples during training, thus affecting the model’s stability and generalization ability. To address these challenges, this study proposes an improved lightweight helmet detection model, LSH-YOLO, based on YOLOv8. The main contributions are as follows:
- (1)
- KWConv-based Backbone and Bottleneck Optimization: Ordinary convolutions in the backbone and bottleneck structures are replaced with KWConv, and an improved C2f-KW module is constructed, significantly reducing FLOPs and parameter counts while maintaining efficient feature extraction.
- (2)
- Lightweight Detection Head Design: A lightweight detection head, SCDH (Shared Convolutional Detection Head), is proposed to enhance feature co-expression across different scales via a feature-sharing mechanism, effectively reducing redundant computations.
- (3)
- Introduction of Wise-IoU v3 for Improved Localization: Wise-IoU v3 is adopted as the localization loss function, employing a non-monotonic focusing factor to adjust the gradient distribution. This encourages the model to focus more on medium-quality anchor boxes during training, enhancing stability and improving detection performance, especially for occluded targets.
- (4)
- Experimental Validation: Experiments conducted on a construction site helmet detection dataset show that LSH-YOLO improves mAP50 by 0.6% to 92.9%, while reducing computational cost by 63% and parameter count by 19%, demonstrating both the effectiveness of the proposed method and its potential for practical deployment.
2. Analysis of the YOLOv8 Algorithm
3. Innovations and Improvements of the Algorithm
3.1. KWConv Module
3.2. C2f-KW Module
3.3. Lightweight Detection Head: SCDH Module
- (1)
- Normalization strategy optimization: Group Normalization (GN) is adopted to replace Batch Normalization (BN), addressing the instability of BN under small-batch training and eliminating dependence on batch size. This ensures stable detection performance under varying training conditions [21], particularly in small-batch scenarios.
- (2)
- Shared convolution structure: The detection head employs a shared convolution strategy, where the output of the 1 × 1 Conv_GN is fed into the 3 × 3 Conv_GN, and the same convolution kernel is shared across all spatial locations for feature extraction. This approach enhances feature representation while significantly reducing computational complexity, thereby improving the overall efficiency of the detection head.
- (3)
- Robust scale consistency and adaptability: By unifying the scale representation across different feature map layers using shared convolution and scale layers, the detection head achieves strong adaptability to both small and large targets.
- (4)
- Decoupled detection branches: The detection head decouples classification and regression branches, enabling each task to learn optimal features independently. This reduces task interference and improves both localization and classification accuracy.
3.4. Loss Function: Wise-IoU
4. Experiments and Analysis
4.1. Experimental Environment
4.2. Dataset
4.2.1. Dataset Introduction and Splitting
4.2.2. Dataset Processing
4.3. Evaluation Metrics
4.4. Ablation Study
4.5. Comparative Experiment
4.6. Generalization Experiment
4.7. Experimental Results and Analysis
4.7.1. Heatmap
4.7.2. Visualization of Detection Results
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Rubaiyat, A.H.; Toma, T.T.; Kalantari-Khandani, M.; Rahman, S.A.; Chen, L.; Ye, Y.; Pan, C.S. Automatic detection of helmet uses for construction safety. In Proceedings of the 2016 IEEE/WIC/ACM International Conference on Web Intelligence Workshops (WIW), Omaha, NE, USA, 13–16 October 2016; pp. 135–142. [Google Scholar]
- Park, M.W.; Elsafty, N.; Zhu, Z. Hardhat-wearing detection for enhancing on-site safety of construction workers. J. Constr. Eng. Manag. 2015, 141, 04015024. [Google Scholar] [CrossRef]
- Cheng, L. A Highly robust helmet detection algorithm based on YOLO V8 and Transformer. IEEE Access 2024, 12, 130693–130705. [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 June 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. Adv. Neural Inf. Process. Syst. 2015, 28, 91–99. [Google Scholar] [CrossRef] [PubMed]
- Fang, Q.; Li, H.; Luo, X.; Ding, L.; Luo, H.; Rose, T.M.; An, W. Detecting non-hardhat-use by a deep learning method from far-field surveillance videos. Autom. Constr. 2018, 85, 1–9. [Google Scholar] [CrossRef]
- 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: 14th European Conference, Amsterdam, The Netherlands, 11–14 October 2016; Proceedings, Part I; Springer: Cham, Switzerland, 2016; pp. 21–37. [Google Scholar]
- Redmon, J.; Divvala, S.; Girshick, R.; Farhadi, A. You only look once: Unified, real-time object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 779–788. [Google Scholar]
- Redmon, J.; Farhadi, A. YOLO9000: Better, faster, stronger. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 7263–7271. [Google Scholar]
- Redmon, J.; Farhadi, A. Yolov3: An incremental improvement. arXiv 2018, arXiv:1804.02767. [Google Scholar] [CrossRef]
- He, C.; Tan, S.; Zhao, J.; Ergu, D.; Liu, F.; Ma, B.; Li, J. Efficient and Lightweight Neural Network for Hard Hat Detection. Electronics 2024, 13, 2507. [Google Scholar] [CrossRef]
- Liang, H.; Seo, S. Automatic detection of construction workers’ helmet wear based on lightweight deep learning. Appl. Sci. 2022, 12, 10369. [Google Scholar] [CrossRef]
- Xing, J.; Zhan, C.; Ma, J.; Chao, Z.; Liu, Y. Lightweight detection model for safe wear at worksites using GPD-YOLOv8 algorithm. Sci. Rep. 2025, 15, 1227. [Google Scholar] [CrossRef] [PubMed]
- Fan, Z.; Wu, Y.; Liu, W.; Chen, M.; Qiu, Z. Lg-yolov8: A lightweight safety helmet detection algorithm combined with feature enhancement. Appl. Sci. 2024, 14, 10141. [Google Scholar] [CrossRef]
- Bochkovskiy, A.; Wang, C.Y.; Liao, H.Y.M. Yolov4: Optimal speed and accuracy of object detection. arXiv 2020, arXiv:2004.10934. [Google Scholar] [CrossRef]
- Zhao, Z.Q.; Zheng, P.; Xu, S.t.; Wu, X. Object detection with deep learning: A review. IEEE Trans. Neural Netw. Learn. Syst. 2019, 30, 3212–3232. [Google Scholar] [CrossRef] [PubMed]
- Hao, W.; Zhili, S. Improved mosaic: Algorithms for more complex images. J. Phys. Conf. Ser. 2020, 1684, 012094. [Google Scholar] [CrossRef]
- Zhang, T.; Wang, F.; Wang, W.; Zhao, Q.; Ning, W.; Wu, H. Research on fire smoke detection algorithm based on improved YOLOv8. IEEE Access 2024, 12, 117354–117362. [Google Scholar] [CrossRef]
- Li, C.; Yao, A. KernelWarehouse: Rethinking the design of dynamic convolution. arXiv 2024, arXiv:2406.07879. [Google Scholar] [CrossRef]
- Ioffe, S.; Szegedy, C. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of the International Conference on Machine Learning, Lille, France, 6–11 July 2015; pp. 448–456. [Google Scholar]
- Wu, Y.; He, K. Group normalization. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 3–19. [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]
- Ma, S.; Xu, Y. Mpdiou: A loss for efficient and accurate bounding box regression. arXiv 2023, arXiv:2307.07662. [Google Scholar] [CrossRef]
- Tong, Z.; Chen, Y.; Xu, Z.; Yu, R. Wise-IoU: Bounding box regression loss with dynamic focusing mechanism. arXiv 2023, arXiv:2301.10051. [Google Scholar]
- Zhang, C.; Du, Y.; Xiao, X.; Gu, Y. GE-YOLO: A lightweight object detection method for helmet wearing state. Signal Image Video Process. 2025, 19, 411. [Google Scholar] [CrossRef]
Name | Parameter |
---|---|
Operating System | Windows11 |
Programming Language | Python3.9 |
Cpu | Intel Corei5-12400F |
Gpu | RTX 4060 |
Memory | 32 G |
Algorithm Framework | Pytorch2.2.2 |
Epoch (hyperparameter) | 200 |
Batch_size (hyperparameter) | 16 |
lr0 (hyperparameter) | 0.005 |
Optimizer (hyperparameter) | SGD |
Imges_Size (hyperparameter) | 640 |
ID | KW | SCDH | Wise-IoU | FLOPs (G) | mA (%) | mA (%) | P (%) | R (%) | Model Size (M) |
---|---|---|---|---|---|---|---|---|---|
1 | × | × | × | 8.1 | 92.3 | 58.1 | 92.3 | 86.8 | 5.95 |
2 | ✓ | × | × | 4.5 | 92.1 | 58.0 | 92.3 | 86.6 | 6.22 |
3 | × | ✓ | × | 6.5 | 92.7 | 58.5 | 92.3 | 87.1 | 4.70 |
4 | × | × | ✓ | 8.1 | 92.4 | 58.1 | 92.5 | 86.6 | 5.95 |
5 | ✓ | ✓ | × | 3.0 | 92.4 | 57.7 | 92.8 | 86.1 | 4.97 |
6 | ✓ | ✓ | ✓ | 3.0 | 92.9 | 57.7 | 91.7 | 87.4 | 4.97 |
Model | FLOPs (G) | mA (%) | mA (%) | P (%) | R (%) | Model Size (M) |
---|---|---|---|---|---|---|
YOLOv5n | 4.1 | 91.6 | 56.3 | 92.4 | 87.2 | 3.65 |
YOLOv5s | 15.8 | 93.2 | 58.7 | 93.8 | 88.1 | 13.6 |
YOLOv7tiny | 13.0 | 92.7 | 55.9 | 92.7 | 87.1 | 11.6 |
YOLOv8n | 8.1 | 92.3 | 58.1 | 92.3 | 86.8 | 5.95 |
YOLOv9t | 10.7 | 92.3 | 58.3 | 92.0 | 87.0 | 17.1 |
YOLOv10n | 6.5 | 92.2 | 58.4 | 92.2 | 86.1 | 5.22 |
YOLOv11n | 6.3 | 92.1 | 58.3 | 92.0 | 86.9 | 5.22 |
YOLOv12n | 5.8 | 92.1 | 57.9 | 91.7 | 86.7 | 5.18 |
RT-DETR | 56.9 | 93.4 | 59.2 | 93.9 | 88.7 | 38.5 |
Faster R-CNN | 190 | 91.7 | 52.4 | 88.2 | 82.3 | 315 |
swintransformer | 79.1 | 91.3 | 56.3 | 91.2 | 85.5 | 60.5 |
GE-YOLO | 5.8 | 92.5 | – | 93.4 | 86.5 | – |
Ours | 3.0 | 92.9 | 57.7 | 91.7 | 87.4 | 4.97 |
FLOPs/G | mA (%) | mA (%) | P (%) | R (%) | |
---|---|---|---|---|---|
YOLOv8n | 8.1 | 83.7 | 49.5 | 88.4 | 75.5 |
LSH-YOLO | 3.0 | 83.4 | 48.8 | 88.8 | 75.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. |
© 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
Liu, Z.; Wang, F.; Wang, W.; Cao, S.; Gao, X.; Chen, M. LSH-YOLO: A Lightweight Algorithm for Helmet-Wear Detection. Buildings 2025, 15, 2918. https://doi.org/10.3390/buildings15162918
Liu Z, Wang F, Wang W, Cao S, Gao X, Chen M. LSH-YOLO: A Lightweight Algorithm for Helmet-Wear Detection. Buildings. 2025; 15(16):2918. https://doi.org/10.3390/buildings15162918
Chicago/Turabian StyleLiu, Zhao, Fuwei Wang, Weimin Wang, Shenyi Cao, Xinhao Gao, and Mingxin Chen. 2025. "LSH-YOLO: A Lightweight Algorithm for Helmet-Wear Detection" Buildings 15, no. 16: 2918. https://doi.org/10.3390/buildings15162918
APA StyleLiu, Z., Wang, F., Wang, W., Cao, S., Gao, X., & Chen, M. (2025). LSH-YOLO: A Lightweight Algorithm for Helmet-Wear Detection. Buildings, 15(16), 2918. https://doi.org/10.3390/buildings15162918