In recent years,more and more cities have promulgated relevant traffic regulations,stipulating that electric vehicle drivers need to wear safety helmets while driving.In this research,the detection algorithm of safety helmet wearing is studied based on deep learning technology.Since there is no public helmet data set available at present,a data set is made by collecting data in multiple scenarios.In view of the poor performance of detection ability of YOLOv5 s algorithm in small targets like helmets,the detection ability of helmets is effectively enhanced by improving methods including the down-sampling method,feature fusion method and the calculation method of frame regression loss function.The main contents of this research are as follows:First of all,in order to produce data sets,about 300 videos were shot in multiple scenarios,with video duration ranging from a few seconds to tens of seconds.Then write a code to convert these videos into pictures,and retain 11370 pictures after selection.Use label Img annotation tool to label the pictures one by one to form the data set required in this research.Secondly,a mass of useless content will be learned by YOLOv5 s when extracting the features of the helmet.Therefore,a down-sampling method is proposed in this research.A total of five block modules are designed and densely connected with each other.The purpose is to ensure the effective extraction of shallow target features and easier training of the network.The average pooling operation can reduce the dimension of the input characteristic matrix,and the 1×1 convolution in the module can reduce the parameters of the network model and prevent over-fitting.Thirdly,in view of the problem that the feature fusion method of YOLOv5 s cannot distinguish the contribution of helmet feature images with different resolutions,this research optimizes the feature fusion network structure,and then gives different weights to the important feature images involved before feature fusion.In addition,in view of the problem that no special attention is paid to the important information in the feature map in YOLOv5 s,the attention module is introduced into the CBL layer.Finally,the frame regression loss function of YOLOv5 s uses area as the penalty term.When the detection frame and the real frame intersect,the intersection mode of the two frames cannot be determined.When the prediction frame is separated and far from the real frame,the loss value is large and difficult to optimize.In view of this,a calculation method of the frame regression loss function is provided in the research,the difference between the center point,width and height of the prediction frame and those of the minimum outer frame is calculated,and their Euclidean distance is regressed.Thus,the above problems are effectively solved. |