# LG-YOLOv8: A Lightweight Safety Helmet Detection Algorithm Combined with Feature Enhancement
## 1 Introduction  
As industrialization advances, the emphasis on safety management in the construction industry has grown. Safety helmets, which are essential personal protective equipment, play a vital role on construction sites, substantially reducing the potential for head injuries. However, the consistent and conscientious use of these helmets by workers is not always guaranteed, highlighting the need for real-time monitoring to ensure their utilization and, by extension, secure work environments. Unfortunately, such monitoring is typically resource-intensive and laborious, and it also poses challenges in terms of cost and practicality when it comes to deploying on edge devices for an efficient outcome. Currently, certain accomplishments have been attained in the domain of object detection. Particularly, the approaches based on deep learning have made breakthrough advancements in the performance detection of numerous tasks. Presently, the mainstream methods are mainly categorized into two types: two-stage algorithms and single-stage algorithms. The former mainly relies on the two-stage object detection algorithm of candidate regions to achieve high-precision object detection. Representative algorithms in this category include R-CNN [1], Faster R-CNN [2], etc. The second category uses a single network to predict the location and category of the object directly from the input image, avoiding the complex process of generating candidate regions and achieving faster detection speed, and the main representative networks in this category include SSD [3] and YOLO [4, 5, 6, 7, 8, 9]. These two types of methods have certain advantages for target detection tasks, but considering the specific task of safety helmet detection and in the real scene of a construction site for objects of different sizes and the influence of other uncontrollable factors, especially for some places with limited resources, it is a general trend to design high precision lightweight models. YOLOv8-n [10] demonstrates enhanced accuracy and speed over its predecessors, yet the detection accuracy for small objects like helmets remains suboptimal, and the substantial model size complicates deployment on edge devices. Based on this, on the basis of the YOLOv8-n algorithm, this paper optimizes the model to a certain extent and introduces the novel LG-YOLOv8 safety helmet detection algorithm, which is a high-precision lightweight model with fast detection speed and strong detection effect. The main contributions of this paper are as follows:  
(1) In the backbone of the YOLOv8-n model, a novel structure named C2f-Ghost-DynamicConv is introduced. This structure amalgamates the strengths of the Ghost module and dynamic convolution, substantially decreasing computational load and parameter count through a distinctive feature generation process. Concurrently, it employs dynamic convolution to adaptively modify the convolution kernel, thereby enhancing the model's feature representation capabilities. This innovation notably improves the detection performance in complex construction settings, such as those involving distant or partially obscured helmets, leading to heightened accuracy and efficiency. (2) Optimize the traditional unidirectional feature fusion method into a bidirectional feature pyramid structure, enhancing feature fusion and multi-scale feature extraction capabilities through the bidirectional feature pyramid network. By leveraging contextual information and combining top-down and bottom-up feature transfer, it effectively extracts multi-scale features, addressing the issues of background interference and leakage in complex scenes and different sizes of helmets. This improves the model's recognition accuracy for helmets. (3) In the construction of the detection head, the LADH-Head has been implemented as an upgrade.