# Drowsiness Detection in Drivers Using Facial Feature Analysis
## 3 Methods
### Adaptive Frame Threshold
In Figure 10, at the beginning, we expect to check 90 consecutive frames and steadily decline to 60 frames at the end of 30 min. **No. of frames**  
**Figure 10. Graph showing variation in consecutive frames (MAR). From Figure 10, the slope of the equation is given by the following equations:  
\[\text{slope}=\frac{\Delta\text{frames}}{\Delta\text{time}} \tag{7}\]  
\[\text{slope}=\frac{(90-60)}{(0-30)}=-1 \tag{8}\]  
The linear equation that represents the number of consecutive frames to be examined at any given time is as follows:  
\[\text{CM(t)}=\text{Initial frames}(t=0)-1(\text{TIME}) \tag{9}\]  
Figure 9:0  
CM (Consecutive Mouth) represents the threshold of consecutive frames used for detecting yawning, while DURATION refers to the elapsed number of minutes. Table 1 outlines the varying CM values utilized for different TIME intervals, with a 5 min increment. In [34], the duration of an eye blink was observed to vary between 100 and 400 milliseconds. This study adopted the maximum duration as the standard or baseline, considering that most individuals tend to blink for this duration. This means the number of frames given the frame rate of 15 fps, likewise in Equations (3)-(6), is given by the following:  
Figure 9:1  
Figure 9:2  
We established that following a normal eye blink lasting 0.4 s, the ideal duration for initiating the count of consecutive frames should commence after 0.5 s. In the study by [PERSON] [35], the eye blinks occur every 4 s [34]. Based on this finding, we infer that the range for the count of consecutive frames after a normal blink duration should span from 0.5 s to 4 s. The 0.5 th second and 4 th second will act as the lower and upper time bound for checking sleepy eyes after a normal blink. The lower boundary of the number of frames to count after a normal blink rate is given as follows:  
Figure 9:3  
Figure 9:4  
Furthermore, the maximum limit for the count of frames to be considered is also provided:  
Figure 9:5  
Figure 9:6 \begin{table}
\begin{tabular}{c c} \hline \hline
**Duration (min)** & **Corresponding CM Value** \\ \hline
0 & 90 \\ \hline
5 & 85 \\ \hline
10 & 80 \\ \hline
15 & 75 \\ \hline
20 & 70 \\ \hline
25 & 65 \\ \hline
30 & 60 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Duration versus CM threshold. Thus, the range of frames to consider after the number of frames for normal blink duration has been covered (6 frames) is between 8 and 60 frames. Figure 11 illustrates the frame count for a standard blink duration and the potential extra frames to be assessed before issuing a warning message. As observed in Figure 11, for the blink duration of 0.5 s, we have 8 frames to check while having a maximum of 60 frames to check before another normal blink. This means that we have 52 extra frames to decide if a person is drowsy; this is what we use to vary the count for drowsiness during the journey (30 min). Now, let us examine the method for adjusting the number of frames to be checked for each 30 min video. Although it is expected that, at the beginning of the journey, a greater/longer number of frames must be checked; while getting to the end, a smaller number of frames should be considered. To ascertain the adjustments needed in the count of consecutive frames as time progresses, a linear equation is formulated to determine the number of frames to be counted at any given time, t. The graph of how the frames vary with time is shown in Figure 12.  
The slope obtained from Figure 12 is given as follows:  
\[\text{slope}=\frac{\Delta\text{frames}}{\Delta\text{time}} \tag{17}\]  
\[\text{slope}=\frac{(60-8)}{(0-30)}=-1.73 \tag{18}\]  
Hence, the formula for calculating the continuous frame threshold for eye closure at any given time is given as follows:  
\[\text{CE}(\text{t})=\text{No.of frames}(\text{t}=0)-1.73(\text{TIME}) \tag{19}\]  
\[\text{CE}(\text{t})=60-1.73(\text{TIME}) \tag{20}\]  
Figure 11: Diagram of the duration of blinks and sleepy eyes. Figure 12: Graph showing variation in consecutive frames (ECR).