Travel safety has always been a major concern for people.With the development of my country’s transportation industry,the road environment is becoming more and more complex,and the vehicles are becoming more and more dense.It is of practical significance to design a system with real-time vehicle detection capability.At present,most of the algorithms used in motor vehicle detection are based on machine learning and traditional digital image processing algorithms.However,such models have low detection effects when dealing with complex and changeable traffic scenes,and cannot meet the needs of the country to promote digital industrialization in the field of intelligent transportation.Convolutional neural network is the most influential research method in the field of computer vision.It can mine the feature information of images through adaptive learning parameters of convolution kernels to realize target detection.The YOLO series model is a representative algorithm in the field of target detection,with both detection speed and accuracy.Based on the latest version iteration of the YOLOv5 network,this thesis proposes a model that improved the loss function and integrated the attention mechanism to further improve the accuracy of the detection algorithm.The main contents and innovations of this thesis are as follows:(1)There is a lack of unified and high-quality datasets in the field of traffic safety.Most of the commonly used datasets have the defects of low resolution,few labels,and missing labels.Low-quality data sets will lead to the optimization of the model weights in the wrong direction and fail to give full play to network performance.This thesis uses image annotation tools to annotate 1313 high-resolution road real-shot pictures,and builds a dataset suitable for vehicle detection tasks.(2)Considering that the imaging quality of the traffic camera is affected by the weather,the lens may be blocked,the field of view is blurred,and the amount of light entering is insufficient.In order to improve the robustness of the model,for the shortcoming of the selfmade dataset limited to sunny scenes,this thesis Through traditional image algorithms,noise is used to simulate rainy days,and generative adversarial networks are used to simulate images in foggy days and night scenes,corresponding to the above three restricted shooting conditions,and the data set is enhanced.(3)This thesis improves the YOLOv5 network structure,integrates the attention mechanism into the residual structure of the feature extraction module,and adds Focal Loss to the loss function part to improve the problem of sample imbalance.The improved two models have achieved better results than the original structure and other classic object detection networks on both the self-made dataset and the enhanced dataset,with a maximum accuracy rate of 97.8% and a recall rate of up to 97.1%.The model AP The value is 0.943,which is 1.08%higher than the original network.For images with weak shooting conditions,the performance loss of the model proposed in this thesis is between 10% and 12%,while the performance loss of the original network is 19.7%,which shows that through the modification,the model can adaptively allocate resources and tilt the weights to more Enriching more important features,the improved model has stronger anti-risk ability. |