# Driver Attention Detection Based on Improved YOLOv5
###### Abstract  
In response to negative impacts such as personal and property safety hazards caused by drivers being distracted while driving on the road, this article proposes a driver's attention state-detection method based on the improved You Only Look Once version five (YOLOv5). Both fatigue and distracted behavior can cause a driver's attention to be diverted during the driving process. Firstly, key facial points of the driver are located, and the aspect ratio of the eyes and mouth is calculated. Through the examination of relevant information and repeated experimental verification, threshold values for the aspect ratio of the eyes and mouth under fatigue conditions, corresponding to closed eyes and yawning, are established. By calculating the aspect ratio of the driver's eyes and mouth, it is possible to accurately detect whether the driver is in a state of fatigue. Secondly, distracted abnormal behavior is detected using an improved YOLOv5 model. The backbone network feature extraction element is modified by adding specific modules to obtain different receptive fields through multiple convolution operations on the input feature map, thereby enhancing the feature extraction ability of the network. The introduction of Swin Transformer modules in the feature fusion network replaces the Bottleneck modules in the C3 module, reducing the computational complexity of the model while increasing its receptive field. Additionally, the network connection in the feature fusion element has been modified to enhance its ability to fuse information from feature maps of different sizes. Three datasets were created of distracting behaviors commonly observed during driving: smoking, drinking water, and using a mobile phone. These datasets were used to train and test the model. After testing, the mAP (mean average precision) has improved by 2.4% compared to the model before improvement. Finally, through comparison and ablation experiments, the feasibility of this method has been verified, which can effectively detect fatigue and distracted abnormal behavior. deep learning; YOLOv5; attention detection; distracted behavior detection; multi-scale feature extraction; Swin Transformer +
Footnote †: journal: Medical  
clearly described in Chinese road traffic safety law. A driver is considered fatigued if they have been continuously and uninterruptedly driving the vehicle for more than 4 h [4]. Distracted driving behavior refers to those where drivers turn their attention to activities unrelated to driving, including visual distraction and cognitive distraction, which are dangerous behaviors that result in the loss of decision-making and operational ability of drivers [5]. In addition, in current important industrial processes, it is also necessary to maintain the attention of the monitoring personnel to avoid accidents in the production process, resulting in unnecessary waste of materials and economic losses. Among them, the main causes of inattention are distraction and fatigue. Common distracted behaviors mainly include smoking, drinking water, using mobile phones, etc. The use of mobile phones in particular causes distraction to a large extent. The driving process and industrial production process carry safety risks. Fatigue makes it difficult for people to concentrate, which will also have a great impact on the current work. Therefore, to avoid the occurrence of potential accidents, it is important to further attention detection of personnel in daily production and life, especially in road traffic safety. At present, unmanned driving and intelligent assisted driving technology have been widely used. When detecting the driver's distraction, timely assisted driving can prevent many traffic accidents. Currently, there are two main methods of personnel attention detection: detection methods based on wearable devices and detection methods based on machine vision.