Fatigue driving face tracking detection holder system based on Raspberry Pi and detection method
By integrating the servo gimbal and suction cup support on the Raspberry Pi platform, combined with MTCNN and ERT-level regression tree models, the driver's multi-angle and attitude monitoring is realized, solving the problems of low accuracy and poor adaptability in traditional methods. problem, improving the accuracy and reliability of fatigue driving monitoring.
Patent Information
- Application Number
- CN202410863222.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-29
- Publication Date
- 2024-10-29
AI Technical Summary
Traditional fatigue driving monitoring methods have problems such as low accuracy, poor adaptability and discomfort to the driver. Fixed cameras cannot cover the driver's multiple angles and postures, and it is difficult to adjust the equipment after it is installed and fixed.
A fatigue driving face tracking and detection gimbal system based on Raspberry Pi is used, combined with the steering gear gimbal and suction cup bottom support, using the MTCNN algorithm and ERT-level regression tree model to perform facial feature point positioning and fatigue status analysis. Through the steering gear cloud The platform realizes rotation adjustment of the camera, expands the viewing angle range and reduces monitoring blind spots.
It improves the accuracy and reliability of fatigue driving monitoring, provides a wider viewing angle, avoids monitoring blind spots, and the device is stable and portable, reducing interference to the driver.
Smart Images

Figure CN118865334A_ABST
Abstract
Description
Technical Field
[0001] The invention provides a Raspberry Pi-based fatigue driving face tracking and detection pan-tilt system and a detection method, belonging to the technical field of video surveillance. Background Art
[0002] Fatigue driving accounts for a large part of the causes of accidents. According to statistics, accidents caused by fatigue driving account for more than 20% of the total number of traffic accidents in the country, and even account for about 45% of the total number of major traffic accidents in the country, which has become the main factor affecting driving safety. Real-time monitoring of the driver's fatigue state is of great practical significance for reducing traffic accidents and casualties.
[0003] Traditional fatigue monitoring methods are mainly based on human physiological signals and vehicle operation behaviors. Among them, the use of biological instruments and equipment to measure the driver's physiological signals will cause discomfort to the driver, and the specialized testing instruments are generally very expensive; the other method is that the monitoring accuracy is easily affected by weather conditions and the driver's driving habits, etc., and the robustness is not strong. With the birth of deep learning, the rapid development of computer vision has been promoted. This non-invasive monitoring method can easily capture the driver's facial features by using cameras and other equipment, and analyze the fatigue state by observing the changing patterns of the driver's facial area features. It will not interfere with the driver's state. It is also the method adopted by most researchers at home and abroad.
[0004] At present, most of the domestic computer vision-based anti-fatigue warning devices rely on fixed camera devices, using some algorithms to infer the driver's fatigue characteristics based on the driver's facial features. They can usually only capture the area directly facing the camera and cannot cover all possible angles and postures of the driver. Once the camera is installed and fixed, it cannot be adjusted or changed, and its adaptability is poor. Summary of the invention
[0005] In response to the above technical problems, the present invention provides a Raspberry Pi-based fatigue driving face tracking and detection pan-tilt system and detection method. Compared with a fixed camera device, the present invention adds a servo pan-tilt system to provide a wider viewing angle range and avoid the problem of monitoring blind spots. The use of a suction cup as the bottom support has the advantages of stability and portability. These improvements can further improve the accuracy and reliability of the fatigue driving monitoring system.
[0006] The specific technical solutions are:
[0007] The fatigue driving face tracking and detection PTZ system based on Raspberry Pi uses the core board Raspberry Pi 4B, equipped with a 64-bit quad-core processor running at 1.5GHz, 8GB RAM, power supply using Type-C, 2.4 / 5.0GHz dual-band wireless LAN, Bluetooth 5.0 / BLE, Gigabit Ethernet interface, two USB2.0 interfaces and two USB3.0 interfaces;
[0008] The voice module uses the XFS5152CE speech synthesis chip. The RXD pin of the speech synthesis broadcast module is connected to the 8th pin GPIO14 of the Raspberry Pi 40Pin, the TXD pin is connected to the 10th pin GPIO15, the VCC and GND are connected to the positive pole of the +3.3V power supply of the 1st pin of the Raspberry Pi and the GND of the 6th pin, and the 4th pin AO_P and the 6th pin AO_N are connected to the 5W circular speaker.
[0009] The display module uses an FFC cable to connect a 4.3-inch display with a resolution of 800×480 to the D SI interface of the Raspberry Pi for issuing an alarm;
[0010] The Raspberry Pi Camera is a component that uses a 15-pin FFC cable to connect to the CSI camera interface of the Raspberry Pi.
[0011] Two SG90 servos are used, and their control is based on PWM waves. Pulses with different duty cycles are sent to make the servos rotate a certain angle, 90° / 180°. The red line is connected to the Raspberry Pi's pin 2 VCC+5V, the gray line is connected to the GND pin 6, and the yellow line is the PWM signal line connected to the Raspberry Pi's pin 16 GPIO23 and pin 18 GPIO24 ports respectively.
[0012] The fatigue driving face tracking detection method based on Raspberry Pi adopts the fatigue driving face tracking detection pan-tilt system based on Raspberry Pi, and comprises the following steps:
[0013] The fatigue driving face tracking and detection PTZ system based on Raspberry Pi is fixed on the car dashboard with a suction cup. The video frames captured by the camera are used for face positioning through the Haar cascade classifier, and the center of the area is compared with the center of the picture, that is, the center of the pixel point, as the source of control error. The PID algorithm is used to calculate the duty cycle of the servo according to the error, and then the rotation angle of the servo is controlled to realize the face tracking movement of the camera.
[0014] Based on the captured face, the lightweight MTCNN algorithm and ERT cascade regression tree model are used to locate 64 facial feature points. The 68 feature points and coordinates of the driver's face are extracted based on the collected face orientation, face position, pupil orientation, eye opening, and blinking frequency data to accurately locate the driver's face. The eye aspect ratio EAR is calculated using the 12 feature points of the eyes, and the mouth MAR is calculated based on the 6 feature points of the mouth. The Euler angle of head rotation is calculated using other coordinates combined with the HPE algorithm. These data are compared with the corresponding thresholds to count the number of times the driver blinks, yawns, and nods. By counting the number of times the driver blinks, yawns, and nods, the driver's concentration level can be judged in real time, whether the driver is driving fatigued can be analyzed, and safety prompts can be given in a timely manner.
[0015] The specific detection process includes two parts: using the 68 points of the ERT cascade regression tree model to calibrate the driver's face, eyes and mouth areas; adding the calculated EAR, PERCLOS and MAR values according to their different weights to get the M value, and the number of frames accumulated M is recorded as N. By comparing the value of N, it is judged whether the driver is driving fatigued;
[0016] The driver’s facial features are extracted through the facial landmark detector of the ERT cascade regression tree model to obtain the positions of the eye and mouth feature points. The eye aspect ratio EAR and mouth aspect ratio MAR are then combined with the calculated frame number to determine drowsiness.
[0017] In order to improve the efficiency and accuracy of the EAR value, the system also calculates the average EAR value:
[0018]
[0019]
[0020] EAR left is the left eye aspect ratio, EAR right is the right eye aspect ratio, EAR average It is the average EAR value; 68 key points of the face are detected, P38 represents the 38th point, and the same applies to the others;
[0021] Mouth opening is detected by calculating the mouth aspect ratio MAR using the marked mouth shape according to the following equation:
[0022]
[0023] When the driver feels tired and enters a state of mild sleepiness, the head tilts downward significantly, indicating an increase in fatigue level; nod detection based on the HPE algorithm, the algorithm steps: 2D face key point detection, 3D face model matching, solving the transformation relationship between 3D points and corresponding 2D points, and solving the Euler angle according to the rotation matrix; the detection process requires the use of the world coordinate system UVW camera coordinate system XYZ, the image center coordinate system uv and the pixel coordinate system xy.
[0024] The present invention constructs a comprehensive face tracking fatigue detection system by comprehensively applying multiple algorithms such as image processing technology and machine learning. This comprehensive method enables the system to accurately identify the driver's fatigue state from different dimensions.
[0025] Compared with the prior art, the present invention has the following technical effects:
[0026] (1) The present invention introduces the MTCNN algorithm with a MobileNet lightweight network structure. MTCNN is a multi-task convolutional neural network that can simultaneously perform tasks such as face detection, key point location, and face alignment with a high accuracy. By introducing the MobileNet lightweight structure, the amount of calculation can be reduced to improve the lightweight level, thereby effectively improving the running speed. This makes it easier to deploy and run MTCNN on devices with limited computing resources.
[0027] (2) The present invention uses a suction cup as a bottom support, which can provide a strong adsorption force to firmly fix the monitoring system on the smooth surface of the vehicle to prevent the device from shaking or loosening during driving.
[0028] (3) Multi-module collaborative work. For fatigue behaviors such as blinking, yawning, and nodding, detection methods based on EAR, MAR, and HPE algorithms are used. These algorithms achieve high-precision monitoring of these specific behaviors through mathematical models and image processing.
[0029] (4) Compared with a fixed camera device, the present invention uses a servo gimbal to control the camera, so that the camera can be rotated and adjusted in the horizontal and vertical directions, thereby expanding the monitoring field of view, reducing the monitoring blind area, and improving the accuracy and reliability of the fatigue driving monitoring system. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is an overall front view of the system of the present invention;
[0031] Figure 2 is an overall side view of the system of the present invention;
[0032] Figure 3 It is a schematic diagram of the overall structure of the system of the present invention;
[0033] Figure 4 is a system connection circuit diagram of the present invention;
[0034] Figure 5 It is a fatigue detection flow chart of the present invention. DETAILED DESCRIPTION
[0035] The specific technical solution of the present invention is described in conjunction with the accompanying drawings.
[0036] The present invention is a fatigue driving face tracking and detection pan-tilt system based on Raspberry Pi, which is an intelligent monitoring device. Figure 1 and Figure 2 The camera 1 and the second SG90 servo 7 are installed on the top of the adjustable gimbal bracket 2, the first SG90 servo 3 is installed on the bottom of the adjustable gimbal bracket 2, the adjustable gimbal bracket 2 is arranged on the protective shell 4, the protective shell 4 is provided with a display screen 6, a speaker 8, a working indicator light 9, a power switch 10, and a Raspberry Pi 4B11, and a suction cup 5 is provided at the bottom of the protective shell 4.
[0037] The core board used is Raspberry Pi 4B11, equipped with a 64-bit quad-core processor running at 1.5GHz, 8GB RAM, Type-C (5V / 3A) power supply, 2.4 / 5.0GHz dual-band wireless LAN, Bluetooth 5.0 / BLE, Gigabit Ethernet interface, two USB2.0 interfaces and two USB3.0 interfaces. The voice module uses the XFS5152CE speech synthesis chip. The pin RXD (UART serial data input) of the speech synthesis broadcast module is connected to the 8th pin GPIO14 of the Raspberry Pi 40Pin, the pin TXD (UART serial data output) is connected to its 10th pin GPIO15, VCC and GND are connected to the positive pole of the Raspberry Pi 1st pin +3.3V power supply and the 6th pin GND, and the 4th pin (AO_P) and the 6th pin (AO_N) are connected to the 5W circular speaker. The display module uses the FFC line to connect the 4.3-inch display 6 with a resolution of 800×480 to the DSI interface of the Raspberry Pi, which can issue warnings in real time. Camera 1 Raspberry Pi Camera is used as a component. This camera 1 has 500W pixels, the module is OV5647, the field of view is about 60.6°, and it uses a 15PIN FFC, that is, a 15-core cable, to connect to the CSI camera interface of the Raspberry Pi. Two SG90 servos are used, the first SG90 servo 3 and the second SG90 servo 7. The control is based on PWM waves, and pulses with different duty cycles are sent to make the servos rotate a certain angle. The rotation angle is 90° / 180°. The red line is connected to the Raspberry Pi pin 2 VCC+5V, the gray line is connected to the GND pin 6, and the yellow line is the PWM signal line connected to the Raspberry Pi pin 16 GPIO23 and pin 18 GPIO24 ports respectively. The system connection circuit diagram is as follows Figure 3 and Figure 4 shown.
[0038] The present invention adopts an embedded system, the core hardware of which is a Raspberry Pi 4B11, and integrates a speech synthesis module and a camera 1, etc.
[0039] In terms of hardware connection, the voice module and the camera 1 are compactly integrated together, reducing the size of the system; the use of the suction cup 5 fixing method can provide relatively stable support, ensuring that the camera 1 will not shake or shift during movement, thereby maintaining an accurate monitoring direction; using a servo gimbal, one servo is used to adjust the direction of the camera 1, which can pitch up and down 130°, and the other servo can achieve a 180° left and right view. By controlling the rotation angle of the servo, the horizontal and vertical directions of the camera 1 can be accurately adjusted, thereby monitoring and detecting a specific area.
[0040] In terms of software configuration, the Python programming language is used to collect images using camera 1, and the MTCNN algorithm combined with the MobileNet lightweight network structure and the ERT cascade regression tree model are introduced to achieve efficient face detection and key point positioning. Here, the fatigue judgment scheme is further designed using the feature point positions of the eyes and mouth, and the fatigue judgment threshold is set through experiments; in addition, after studying the principles of camera distortion correction and coordinate system conversion, the camera internal parameters are obtained, so that the two-dimensional plane coordinate system can be converted to three-dimensional space. With the help of the three-dimensional coordinates of the key points of the face, the posture solution and threshold setting of the head in the three-dimensional coordinate system are completed. Finally, the GPIO of the Raspberry Pi 4B11 is used to generate a PWM signal, and the two-degree-of-freedom servo is accurately controlled through the PID algorithm to track the driver's face position, so that the invention can achieve face tracking fatigue detection.
[0041] The above configuration can quickly and accurately perform face detection and key point positioning, and use head posture solution and face tracking functions to perform fatigue detection, providing safety protection for the driver.
[0042] like Figure 5 As shown, the detection method is as follows: the device is fixed on the dashboard of the vehicle using a suction cup 5, and the video frame captured by the camera 1 is used for face positioning through a Haar cascade classifier, and the center of the region is compared with the center of the picture (pixel point center) as the source of control error, and the PID algorithm is used to calculate the duty cycle of the servo according to the error, and then the rotation angle of the servo is controlled to realize the face tracking movement of the camera 1. Based on the captured face, the MTCNN algorithm with a lightweight structure and the ERT cascade regression tree model are used to realize the positioning of 64 facial feature points. For the collected data such as face orientation, face position, pupil orientation, eye opening, blinking frequency, etc., 68 feature points and their coordinates of the driver's face are extracted to accurately locate the position of the driver's face, and the eye aspect ratio EAR is calculated using the 12 feature points of the eye, the mouth MAR is calculated based on the 6 feature points of the mouth, and the Euler angle of the head rotation is calculated using other coordinates combined with the HPE algorithm. These data are compared with the corresponding thresholds respectively, so as to count the number of times the driver blinks, yawns and nods. By counting the number of times the driver blinks, yawns, and nods, the system can determine the driver's concentration level in real time, analyze whether the driver is driving fatigued, and provide timely safety reminders.
[0043] Flowchart as Figure 1 shown.
[0044] The detection process of the system includes two parts: using the 68 points of the ERT cascade regression tree model to calibrate the driver's face, eyes and mouth areas; adding the calculated EAR, PERCLOS and MAR values according to their different weights to get the M value, and the number of frames accumulated by M is recorded as N. By comparing the value of N, it is judged whether the driver is driving fatigued.
[0045] The facial features of the driver are extracted through the facial landmark detector of the ERT cascade regression tree model, which can quickly and effectively obtain the positions of the feature points of the eyes and mouth, and then judge drowsiness by combining the eye aspect ratio (Eye Aspect Ratio, EAR) and mouth aspect ratio (Mouth Aspect Ratio, MAR) with the calculated frame number.
[0046] In addition, in order to improve the efficiency and accuracy of the EAR value, the system also calculates the average EAR value.
[0047]
[0048]
[0049] EAR left is the left eye aspect ratio, EAR right is the right eye aspect ratio, EAR average It is the average EAR value; 68 key points of the face are detected, P38 represents the 38th point, and the same applies to the others;
[0050] Besides eye closure, yawning is one of the most obvious indicators of fatigue. Mouth opening can be detected by calculating the mouth aspect ratio (MAR) using the marked mouth shape according to the following equation.
[0051]
[0052] When the driver feels tired and enters a state of mild sleepiness, the head tilts down significantly, indicating an increase in fatigue. Nod detection based on the HPE algorithm: Algorithm steps: 2D face key point detection, 3D face model matching, solving the transformation relationship between 3D points and corresponding 2D points, and solving the Euler angle according to the rotation matrix. The world coordinate system (UVW), camera coordinate system (XYZ), image center coordinate system (uv) and pixel coordinate system (xy) are required in the detection process. The posture of an object relative to the camera can be represented by a rotation matrix and a translation matrix.
[0053] This system is mainly composed of a controller, a display module, a voice module and a servo module. The main control module uses the Raspberry Pi 4B11 as the control core, and the face detection module uses the Raspberry Pi dedicated camera 1. Its 500W pixels can meet the clarity of collecting facial images, with low power consumption and price, and small size. The voice module uses the XFS5152CE professional speech synthesis chip, and the communication method is I2C communication. A 4.3-inch capacitive touch display 6 is used for system display. Camera 1 extracts eye and mouth features, and uses the PID algorithm to calculate the servo duty cycle based on the error, thereby controlling the servo rotation angle to achieve the movement of camera 1. Through the coordinated work of these modules, the driver's fatigue condition can be more comprehensively monitored. The overall system design is as follows Figure 2 shown.
Claims
1. The fatigue driving face tracking and detection PTZ system based on Raspberry Pi is characterized by: It uses the core board Raspberry Pi 4B, equipped with a 64-bit quad-core processor running at 1.5GHz, 8GB RAM, Type-C power supply, 2.4 / 5.0GHz dual-band wireless LAN, Bluetooth 5.0 / BLE, Gigabit Ethernet interface, two USB2.0 interfaces and two USB3.0 interfaces; The voice module uses the XFS5152CE speech synthesis chip. The RXD pin of the speech synthesis broadcast module is connected to the 8th pin GPIO14 of the Raspberry Pi 40Pin, the TXD pin is connected to the 10th pin GPIO15, the VCC and GND are connected to the positive pole of the +3.3V power supply of the 1st pin of the Raspberry Pi and the GND of the 6th pin, and the 4th pin AO_P and the 6th pin AO_N are connected to the 5W circular speaker. The display module uses an FFC cable to connect a 4.3-inch display with a resolution of 800×480 to the DSI interface of the Raspberry Pi for issuing warnings; The Raspberry Pi Camera is a component that uses a 15-pin FFC cable to connect to the CSI camera interface of the Raspberry Pi. Two SG90 servos are used, and their control is based on PWM waves. Pulses with different duty cycles are sent to make the servos rotate a certain angle, 90° / 180°. The red line is connected to the Raspberry Pi's pin 2 VCC+5V, the gray line is connected to the GND pin 6, and the yellow line is the PWM signal line connected to the Raspberry Pi's pin 16 GPIO23 and pin 18 GPIO24 ports respectively.
2. A fatigue driving face tracking and detection method based on Raspberry Pi, characterized in that: The fatigue driving face tracking and detection pan-tilt system based on Raspberry Pi as claimed in claim 1 comprises the following steps: The fatigue driving face tracking and detection PTZ system based on Raspberry Pi is fixed on the car dashboard with a suction cup. The video frames captured by the camera are used for face positioning through the Haar cascade classifier, and the center of the area is compared with the center of the picture, that is, the center of the pixel point, as the source of control error. The PID algorithm is used to calculate the duty cycle of the servo according to the error, and then the rotation angle of the servo is controlled to realize the face tracking movement of the camera. Based on the captured face, the lightweight MTCNN algorithm and ERT cascade regression tree model are used to locate 64 facial feature points. The 68 facial feature points and their coordinates are extracted from the collected data on face orientation, face position, pupil orientation, eye opening, and blinking frequency to accurately locate the driver's face. The eye aspect ratio EAR is calculated using the 12 feature points of the eyes, and the mouth aspect ratio MAR is calculated based on the 6 feature points of the mouth. The Euler angle of head rotation is calculated using other coordinates combined with the HPE algorithm. These data are compared with the corresponding thresholds to count the number of times the driver blinks, yawns, and nods. By counting the number of times the driver blinks, yawns, and nods, the driver's concentration level can be judged in real time, whether the driver is driving fatigued can be analyzed, and safety prompts can be given in a timely manner.
3. The method for detecting fatigue driving face tracking based on Raspberry Pi according to claim 2 is characterized in that: The specific detection process includes two parts: using the 68 points of the ERT cascade regression tree model to calibrate the driver's face, eyes and mouth areas; adding the calculated EAR, PERCLOS and MAR values according to their different weights to get the M value, and the number of frames accumulated M is recorded as N. By comparing the value of N, it is judged whether the driver is driving fatigued; The driver’s facial features are extracted through the facial landmark detector of the ERT cascade regression tree model to obtain the positions of the eye and mouth feature points. The eye aspect ratio EAR and mouth aspect ratio MAR are then combined with the calculated frame number to determine drowsiness.
4. The method for detecting fatigue driving face tracking based on Raspberry Pi according to claim 3 is characterized in that: To improve the efficiency and accuracy of the eye aspect ratio EAR value, the system also calculates the average EAR value: EAR left is the left eye aspect ratio, EAR right is the right eye aspect ratio, EAR average It is the average EAR value; 68 key points of the face are detected, P38 represents the 38th point, and the same applies to the others; Mouth opening is detected by calculating the mouth aspect ratio MAR using the marked mouth shape according to the following equation:
5. The method for detecting fatigue driving face tracking based on Raspberry Pi according to claim 3 is characterized in that: When the driver feels tired and enters a state of mild sleepiness, the head tilts downward significantly, indicating an increase in fatigue level; nod detection based on the HPE algorithm, the algorithm steps: 2D face key point detection, 3D face model matching, solving the transformation relationship between 3D points and corresponding 2D points, and solving the Euler angle according to the rotation matrix; the detection process requires the use of the world coordinate system UVW camera coordinate system XYZ, the image center coordinate system uv and the pixel coordinate system xy.
