## 2 Algorithm and Methodology
### Sliding Window Model  
Driver fatigue is a dynamic process that requires assessing the driver's state over time. To capture this, a sliding window model is employed, as illustrated in Figure 5. In this model, it is as follows:  
* Eye state is labeled as 0 (closed) when \(\eta_{NAE}\) is below the personalized threshold, and 1 (open) otherwise. * Mouth state is labeled as 0 (closed) when \(\eta_{NAM}\) is below the threshold, and 1 (open) otherwise. * Nodding state is labeled as 0 (normal) when HEA\(\alpha\) is below its threshold, and 1 (nodding) otherwise. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Range \(\eta_{NAE}\)** & **Eyes Size** & **Range \(\eta_{NAM}\)** & **Mouth Size** \\ \hline
0.15–0.24 & undersize & 0.10–0.14 & undersize \\
0.25–0.34 & normal & 0.15–0.24 & normal \\
0.35–0.40 & oversize & 0.25–0.40 & oversize \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Different sizes of eyes and mouths corresponding to different \(\eta_{NAE}\) and \(\eta_{NAM}\) values. \begin{table}
\begin{tabular}{c c c} \hline \hline
**No.** & **Zves Size** & \(\eta_{NAE}\)** **Threshold** \\ \hline
1 & undersize & 0.20 \\
2 & normal & 0.25 \\
3 & oversize & 0.20 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Information base of personalized \(\eta_{NAE}\) thresholds. \begin{table}
\begin{tabular}{c c c} \hline \hline
**No.** & **Zves Size** & \(\eta_{NAE}\)** **Threshold** \\ \hline
1 & undersize & 0.30 \\
2 & normal & 0.40 \\
3 & oversize & 0.50 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Information base of personalized \(\eta_{NAM}\) thresholds. The window size is set to 1800 frames, and the step size is 30 frames, ensuring that fatigue state is determined based on continuous feature data from 1800 frames. After obtaining head Euler angles (HEAs), \(\eta_{NAE}\) and \(\eta_{NAM}\), the blinking frequency (BF), yawning frequency (YF), and nodding frequency (NF) can be further calculated from these evaluation indexes, which are calculated as follows:  
\[\text{BF},\ \text{YF},\text{NF}=\frac{n}{T}\times 100\% \tag{8}\]  
where \(n\) represents the number of frames of blinking, yawning, or nodding in a sliding window, and \(T\) is set to 1800 frames (equivalent to 1 min of video at 30 frames per second). The blinking frequency (BF) is calculated based on the average of both eyes. Since blinking is a synchronized bilateral behavior, using the average of both eyes provides a reliable and accurate measure. As shown in Figure 6, the flowchart illustrates the process of calculating BF, YF, and NF using the sliding window model. The specific algorithm for calculating these evaluation indexes is detailed in Algorithm 1. ```
\(T=1800\); # Sliding window size, set to 1800 frames \(S=30\); # The step size of the sliding window, set to 30 frames \(BF_{i}=[]\); # Blink frequency in the \(i\)-th sliding window \(YF_{i}=[]\); # Yawning frequency in the \(i\)-th sliding window \(NF_{i}=[]\); # Nodding frequency in the \(i\)-th sliding window \(n=\left\lfloor\frac{N-T}{S}\right\rfloor+1\); # \(n\) is the number of sliding windows and \(N\) is the total number of frames acquired continuously \(i=1,2,3\ldots n\); \(BF_{i}=\frac{1}{T}\sum\limits_{l=1}^{T}Blink_{(i-1)S+l}\); \(YF_{i}=\frac{1}{T}\sum\limits_{l=1}^{T}Yawn_{(i-1)S+l}\); \(NF_{i}=\frac{1}{T}\sum\limits_{l=1}^{T}Nod_{(i-1)S+l}\)

Figure 5: Sliding window model. \(Blink_{t}\) represents the blinking state in the \(t\)-th frame image, \(Yawn_{t}\) represents the yawning state in the \(t\)-th frame image, and \(\ Nod_{t}\) represents the nodding state in the \(t\)-th frame image. The expression \(\lfloor(N-T)/S\rfloor\) denotes rounding down to ensure that the total number of frames \(N\) is not exceeded. ### Feature Fusion Model

Following the normalization, the three evaluation indexes BF, YF, NF are combined into a single fatigue evaluation index \(F_{\text{BYN}}\).