| For high-risk industries such as construction,steel,and coal mining,wearing a safety helmet during construction and operation is one of the most effective and cost-effective ways to avoid injury.In recent years,many high-risk incidents in the construction industry have been caused by non-standard on-site safety,and safety accidents due to not wearing safety helmets or non-standard use of safety helmets are even more common.Therefore,this article proposes an improved YOLOv5 object detection method to detect the wearing of safety helmets in complex environments where there are errors and omissions in detecting small and dense targets.The main work of this article is as follows:(1)This paper proposes a YOLO v5 algorithm based on RFB and multi-scale feature fusion to address the practical situation where safety helmets are small objects and difficult to detect due to their small target size in complex environments.The improved multi-scale fusion algorithm makes it easier to obtain shallow information and can obtain smaller targets through larger feature maps;The algorithm uses RFB to replace SPP to increase its Receptive field.Kmeans++clustering algorithm is used to obtain 12 anchor frames more suitable for helmet wearing recognition,which are evenly distributed on four detection layers to improve accuracy.The experimental results show that the detection accuracy and testing effect of the improved algorithm have been significantly improved,with a MAP(mean accuracy)increase of 2.7%compared to the original network,and a decrease in missed detection rate of 43.9%.(2)Compared with the loss function used in the existing algorithm,it is observed that there are oscillations and slow convergence in the process of its convergence.This paper analyzes the loss function CIOU(complete intersection/union ratio)in the algorithm for this problem,and finds that the parameter v in the formula only reflects the difference in the aspect ratio of width and height,which hinders the effective optimization similarity of the model,and further affects the training results.Therefore,this paper uses Focal EIOU loss function instead of the original loss function to solve the above problem.Focal EIOU can save the complete characteristics of the loss,and the EIOU can quickly move the prediction box to the nearest axis,and the subsequent method only requires a regression of coordinates X or Y to solve the problem of sample imbalance.The experimental results show that the Focal EIOU loss function adopted by the improved algorithm improves the curve oscillation caused by the small number of batch samples and the imbalance of sample quality.The MAP value increases by 1.1%,and the rate of missed detection decreases by 21.8%,meeting the requirements for small target and dense target detection in complex environments. |