## 2 Algorithm and Methodology
### Sliding Window Model
Its expression is as follows:

\[F_{\text{BYN}}=\sum_{i=1}^{3}W_{i}\times F_{i}\hskip 28.452756 pt\sum_{n=1}^{3}W_{i }=1 \tag{9}\]

The expression indicates that \(F_{i}\) represents the \(i\)-th evaluation index, and \(W_{i}\) represents the distribution weight of the \(i\)-th index. According to the importance and practicability of each physiological behavior in reflecting the fatigue degree, and incorporating the continuously updated \(W_{i}\) from the experimental validation in Section 3.6, the values of the \(W\) were distributed as: The value of \(W_{1}\) is maximized (valued as 0.4) because research and experimental observations indicate that BF is typically considered one of the most important indicators in fatigue driving detection. A significant increase in BF may indicate that the driver is experiencing fatigue. Additionally, by matching the personalized \(\eta_{NAE}\) threshold for different drivers, the impact of eye size is effectively eliminated, thereby justifying a higher weight for BF. YF and NF are regarded as secondary indicators. Although they can also reflect fatigue, their changes may not be as significant or frequent as those of BF Therefore, they are assigned lower weights (\(W_{2}\) = 0.3, \(W_{3}\) = 0.3) to reflect their relative importance in detecting fatigue while driving. Assigning weights of 0.4, 0.3, and 0.3 maintains the dominant role of blink frequency while appropriately considering the contributions of yawning and nodding, ensuring that the fatigue driving detection system remains sensitive and accurate under various conditions. Figure 6: Flowchart of calculating evaluation indexes using the sliding window model. ### Fatigue Classification Based on Fuzzy Logic

Fatigue is a gradual, continuous, and subjective process influenced by physiological and psychological fluctuations. Traditional classification methods often segment fatigue into discrete levels--such as awake, mild, moderate, and severe--by applying fixed thresholds to a composite fatigue index. However, such rigid boundaries can lead to classification instability, especially near the threshold regions where small input variations cause abrupt state transitions. To address this limitation, a fuzzy logic-based classification approach is employed in this study. The normalized fatigue score \(F_{\text{BYN}}\in[0,1]\) is mapped to overlapping fuzzy sets, each corresponding to a fatigue level. These sets are defined by triangular or trapezoidal membership functions, allowing a single input to simultaneously belong to multiple states with varying degrees of membership. The final fatigue level is determined by selecting the label with the highest membership value, as described in Algorithm 2. ```
0: Normalized fatigue evaluation score \(F_{\text{BYN}}\in[0,\,1]\). 0: driver\({}^{\prime}\)s fatigue level \(Y\in\{\text{Awake, Mild, Moderate, Severe}\}\). 1: Define fuzzy membership functions:
2:\(\mu_{\text{Awake}}(F_{\text{BYN}}),\mu_{\text{Mild}}(F_{\text{BYN}}),\mu_{ \text{Moderate}}(F_{\text{BYN}}),\mu_{\text{Severe}}(F_{\text{BYN}})\)
3: Initialize fatigue level \(Y\gets null\)
4:for each fatigue score \(F_{\text{BYN}}\)do
5: Compute \(\mu_{\text{Awake}}\)\(\leftarrow\) membership degree of \(F_{\text{BYN}}\) to Awake
6: Compute \(\mu_{\text{Mild}}\)\(\leftarrow\) membership degree of \(F_{\text{BYN}}\) to Mild Fatigue
7: Compute \(\mu_{\text{Moderate}}\)\(\leftarrow\) membership degree of \(F_{\text{BYN}}\) to Moderate Fatigue
8: Compute \(\mu_{\text{Severe}}\)\(\leftarrow\) membership degree of \(F_{\text{BYN}}\) to Severe Fatigue
9: Construct dictionary \(\mu_{\text{dict}}\)\(\leftarrow\) {
10: \"Awake\": \(\mu_{\text{Awake}}\),
11: \"Mild\": \(\mu_{\text{Mild}}\),
12: \"Moderate\": \(\mu_{\text{Moderate}}\)
13: \"Severe\": \(\mu_{\text{Severe}}\)
14: }
15: Determine output \(Y\leftarrow\)argmax(\(\mu_{\text{dict}}\))
16:endfor
17:return\(Y\)
```

**Algorithm 2** Fatigue Classification Based on Fuzzy Logic

Let \(F_{\text{BYN}}\in[0,1]\) denote the normalized fatigue score.