## 2 Algorithm and Methodology
### Evaluation Indexes  
In this study, Dlib was used to extract 68 facial key points related to the eyes, mouth, and facial contours. These landmarks are illustrated in Figure 2a, and their actual detection results on video frames are shown in Figure 2b. The extracted feature points serve as the basis for calculating fatigue-related indicators and subsequent facial behavior analysis. Vertical head movement, particularly downward nodding, is widely recognized as a key behavioral indicator of driver fatigue. As illustrated in Figure 3, head pose is described by three rotational angles: roll, pitch, and yaw. Among these, the pitch angle is most directly associated with vertical head motion and was therefore adopted as the primary evaluation metric for fatigue detection in this study. Head pose estimation is performed based on facial landmark detection using the Dlib toolkit, which extracts 2D image feature points corresponding to predefined 3D facial model coordinates. Combined with the intrinsic parameters of the camera, the Perspective-n-Point (PnP) [36] algorithm is employed to solve for the rotation vector. This vector is then converted into a rotation matrix via the Rodrigues transformation [37]. The pitch angle, denoted as \(\mathrm{HEA}\alpha\) (head Euler angle \(\alpha\)), is calculated from the elements of the rotation matrix using the following formula:  
\[\mathrm{HEA}\alpha=\mathrm{arctan2}(-R_{31},\sqrt{R_{32}^{2}+R_{33}^{2}}) \tag{1}\]  
where \(R_{31}\), \(R_{32}\), \(R_{33}\) are the elements in the third row of the rotation matrix [37]. This angle effectively captures vertical head movements, which are highly indicative of drowwissens-related behavior. The function \(\mathrm{arctan2}(v,u)\) used here denotes the two-argument inverse tangent function, which calculates the angle between the point (\(v\),\(u\)) and the horizontal axis. It returns values in the range (\(-\pi\),\(\pi\)]. Unlike the traditional \(\mathrm{arctan}(u/v)\), the \(\mathrm{arctan2}\) function takes into account the sign of both arguments to determine the correct quadrant of the angle, thereby avoiding division-by-zero errors. According to the biomechanical literature [38], the natural pitch angle range of the human head spans approximately from \(-50^{\circ}\) to \(45^{\circ}\). In this study, abnormal nodding is defined as any instance where \(\mathrm{HEA}\alpha\) falls within the lowest 30% of this range, specifically  
Figure 3: Head pose estimation for three rotation angles, i.e., roll, pitch, and yaw [35]. Figure 2: (a) Dlib facial feature points and (b) actual detected facial feature points. between \(-50^{\circ}\) and \(-35^{\circ}\). When HEA\(\alpha\) enters this range and meets certain temporal continuity or frequency conditions, it is identified as an abnormal nodding event and used as an indicator of driver fatigue. To model the opening and closing states of the eyes and mouth, parabolic fitting is applied to their contour curves. This method captures the essential vertical shape variation using limited facial landmarks and ensures a good trade-off between fitting accuracy and computational efficiency. It is well-suited for real-time fatigue detection tasks. Specifically, the right eye contour curve is segmented into upper and lower parts by nodes 43 and 46, while the left eye contour curve is segmented into upper and lower parts by nodes 37 and 40. Similarly, the mouth contour curve is divided into upper and lower parts by nodes 49 and 55. The upper part of the contour curve is represented by \(F_{1}(x)\) in Equation (2), while the lower part is represented by \(F_{2}(x)\) in Equation (2). \[\left\{ \begin{aligned} & F_{1}(x)=a_{1}x^{2}+b_{1}x+c_{1},\\ & F_{2}(x)=a_{2}x^{2}+b_{2}x+c_{2},\\ & a_{1}<0,a_{2}>0\end{aligned} \right. \tag{2}\]  
The data of the upper and lower parts of the nodes of the left eye, the right eye, and the mouth are inputted into \(F_{1}(x)\) and \(F_{2}(x)\), respectively.