An Algorithm for Distracted Driving Recognition Based on Pose Features and an Improved KNN

: To reduce safety accidents caused by distracted driving and address issues such as low recognition accuracy and deployment difficulties in current algorithms for distracted behavior detection, this paper proposes an algorithm that utilizes an improved KNN for classifying driver posture features to predict distracted driving behavior. Firstly, the number of channels in the Lightweight OpenPose network is pruned to predict and output the coordinates of key points in the upper body of the driver. Secondly, based on the principles of ergonomics, driving behavior features are modeled, and a set of five-dimensional feature values are obtained through geometric calculations. Finally, considering the relationship between the distance between samples and the number of samples, this paper proposes an adjustable distance-weighted KNN algorithm (ADW-KNN), which is used for classification and prediction. The experimental results show that the proposed algorithm achieved a recognition rate of 94.04% for distracted driving behavior on the public dataset SFD3, with a speed of up to 50FPS, superior to mainstream deep learning algorithms in terms of accuracy and speed. The superiority of ADW-KNN was further verified through experiments on other public datasets.


Introduction
According to data released by the World Health Organization, car accidents are the leading cause of death after diseases and wars.Globally, approximately 1.35 million people die in car accidents each year, and tens of millions more are disabled [1].Road traffic accidents are typically caused by subjective and objective factors.Subjective factors refer to the driver's driving behavior, while objective factors often involve uncontrollable and unpredictable elements such as the environment and road conditions [2].Many studies on the causes of car accidents [3][4][5] have identified distracted driving as a significant factor.Paper [3] indicates that approximately 45% of car accidents are directly caused by drivers' lack of attention or drivers engaging in non-driving activities.Paper [6] mentions that using a mobile phone or answering calls while driving can slow down the driver's reaction time, increasing the risk of accidents by four times.Paper [7], analyzing a large amount of accident data, suggests that young males are more prone to traffic accidents, possibly due to their tendency to engage in distracted behaviors such as chatting, smoking, and driving under the influence of alcohol.Until vehicles are fully autonomous, drivers will remain the direct decision-makers in the transportation system.Therefore, the accurate and rapid recognition of distracted driving behaviors is a crucial research direction for intelligent and safe driving [8].
Methods for detecting distracted driving can be broadly classified into three categories: based on driver physiological parameters, based on driving environment characteristics, and based on deep learning.Early scholars primarily used sensors to collect physiological signals from drivers to analyze distracted driving behaviors.For instance, Lin et al. conducted extensive research on the relationship between electroencephalography (EEG) and distracted driving [9][10][11] and found that when drivers are distracted, the power of theta and beta waves in the frontal region of the brain increases, with the magnitude reflecting the degree of distraction.Deshmukh et al. [12] greatly improved the ability to discriminate distracted driving by applying wavelet packet transform to electrocardiogram (ECG) signals.
Monitoring vehicle driving environment parameters is an indirect but accurate detection method.Kountouriotis et al. [13] conducted experiments on a driving simulator and concluded that visual distraction can increase the lateral deviation of the vehicle, especially during turns.Li et al. [14] collected and compared operational parameters such as steering wheel, throttle, and brake control under distracted and normal driving conditions, as well as vehicle driving parameters.Their results showed that drivers frequently compensate for driving parameters when distracted, leading to instability in the vehicle's driving state.
In recent years, deep learning has achieved significant success in areas such as image classification and object recognition.Many scholars have attempted to use deep learning models to detect distracted driving behaviors [15], including ResNet and VGG [16,17].Zhang et al. [18] compared the performance of ResNet-50 and VGG-16 in distracted driving recognition and ultimately constructed a detection model using an improved VGG-16.Ruthuparna et al. [19] developed a CNN model with only 9.5 MB of parameters that could effectively recognize distracted driving behaviors involving hand movements.Luo et al. [20] introduced a lightweight backbone network, GhostNet and GSConv, and YOLOv5 to reduce network parameters and achieve faster and more accurate recognition of common distracted behaviors such as answering phone calls, smoking, and drinking water.Li et al. [21] combined visual transformers (VITs) and convolutional neural networks (CNNs) to more fully capture local and global image features.Wei et al. [22] constructed a graph convolutional network using a driver's skeletal model and fused key target information, achieving an accuracy of 86% on a self-constructed distracted driving dataset.
Overall, sensor-based methods are direct and effective but limited by their high hardware costs and inconvenience for passengers and drivers.Deep learning models offer high accuracy and recognition speeds but pose challenges for hardware deployment due to their large model parameters.Therefore, this paper proposes an algorithm that utilizes deep learning to extract driver posture features and combines them with an improved KNN for classification, as shown in Figure 1.This approach combines the feature extraction capabilities of deep learning models with the rapid classification and recognition abilities of machine learning.Our work is roughly as follows: (1) Extract key points of a driver's body using a lightweight pose detection framework to construct a sequence diagram of the driver's behavioral skeleton.

Pose Estimation
Human pose estimation can be described as a method that reconstructs the human skeleton by extracting information on the locations of key points on the human body and estimating the relationships between these key points.Pose estimation has important ap-

Pose Estimation
Human pose estimation can be described as a method that reconstructs the human skeleton by extracting information on the locations of key points on the human body and estimating the relationships between these key points.Pose estimation has important applications in areas such as action recognition, action tracking, human-computer interaction, and so on.Among them, typical pose estimation algorithms include DeepPose [23], CMPs (convolutional pose machines) [24], OpenPose [25], and others.

Lightweight OpenPose
Lightweight OpenPose [26] is a classic, lightweight version of OpenPose that significantly improves the model's running speed at the cost of almost negligible accuracy loss.The general process is outlined as follows: Firstly, an image is fed into the feature extraction network, MobileNet, to extract shallow semantic information and obtain feature map F. This feature map then enters the first stage, where it undergoes a series of CNN operations, ultimately outputting two branches.The first branch, S 1 , is responsible for generating part confidence maps (PCMs) around the joint points in the image, indicating the level of confidence.The second branch, L 1 , predicts part affinity fields (PAFs), which represent the position and possible connection directions of the joint points in vector form.
From the second stage onward, the network's input integrates three components from the previous stage: F, S n−1 , and L n−1 , as shown in Equation (1).Within the second stage, the consolidated input features undergo numerous convolutions with kernel sizes of 1 × 1 and 3 × 3, connected by skip structures.This process iterates through n − 1 such CNN structures.The losses of each branch are calculated using the L2 loss function, and the positions of each joint are output once the losses converge.The Hungarian matching algorithm is then employed to find the best adjacent joint points and, finally, all suitable joint points are connected in order to output the human skeleton structure.The general process is schematically illustrated in Figure 2.

Skeleton Pruning
The original pose estimation framework was trained based on the COCO dataset, which detected 18 key points on the human body, following the COCO annotation format (as shown in Figure 3, left).However, the target of detection was a driver inside a vehicle, and driving behaviors are generally expressed through upper body movements.Due to the driving environment, the lower body parts of the driver may be inevitably occluded, and certain body parts may be difficult to detect effectively due to individual differences among drivers.Therefore, to eliminate these effects, this study did not identify key points that could cause interference or that did not contribute to the judgment of distracted driving behaviors.It discarded all lower body parts (8-13) as well as the left ear ( 16) and right ear (17).Instead, pose estimation was only performed on 10 key points of the upper body (as shown in Figure 3

Skeleton Pruning
The original pose estimation framework was trained based on the COCO dataset, which detected 18 key points on the human body, following the COCO annotation format (as shown in Figure 3, left).However, the target of detection was a driver inside a vehicle, and driving behaviors are generally expressed through upper body movements.Due to the driving environment, the lower body parts of the driver may be inevitably occluded, and certain body parts may be difficult to detect effectively due to individual differences among drivers.Therefore, to eliminate these effects, this study did not identify key points that could cause interference or that did not contribute to the judgment of distracted driving behaviors.It discarded all lower body parts (8-13) as well as the left ear (16) and right ear (17).Instead, pose estimation was only performed on 10 key points of the upper body (as shown in Figure 3 driving behaviors.It discarded all lower body parts (8-13) as well as the left ear ( 16) and right ear (17).Instead, pose estimation was only performed on 10 key points of the upper body (as shown in Figure 3, right), specifically the following 10 key points: (0) nose, (1) neck, (2) right shoulder, (3) right elbow, (4) right wrist, (5) left shoulder, (6) left elbow, (7) left wrist, (14) right eye, and (15) left eye.
By reducing the original 19 heatmaps, including the background, to 11 and then feeding them into the branches for training, several benefits were achieved: (1) The number of key points calculated by the PCMs was reduced from 18 to 10, meaning that the number of channels in branch 1 became 10. (2) The number of output channels in PAFs equaled the number of bone segments multiplied by 2, which represented the number of bones times two.Therefore, the number of channels in branch 2 was reduced to 22, significantly fewer than the original 38.This reduction in the number of parameters during multi-stage CNN operations accelerated the detection speed.

Feature Extraction
According to the principles of anthropometry, utilizing the angles and distances between key points can result in a better representation of a driver's driving state [27].Taking By reducing the original 19 heatmaps, including the background, to 11 and then feeding them into the branches for training, several benefits were achieved: (1) The number of key points calculated by the PCMs was reduced from 18 to 10, meaning that the number of channels in branch 1 became 10. ( 2) The number of output channels in PAFs equaled the number of bone segments multiplied by 2, which represented the number of bones times two.Therefore, the number of channels in branch 2 was reduced to 22, significantly fewer than the original 38.This reduction in the number of parameters during multi-stage CNN operations accelerated the detection speed.

Feature Extraction
According to the principles of anthropometry, utilizing the angles and distances between key points can result in a better representation of a driver's driving state [27].Taking the skeleton sequence diagram of a single driver's normal driving state as an example, as shown in Figure 4, the coordinates of key point i were denoted as (x i , y i ) and the Euclidean distance between two key points could be expressed as Electronics 2024, 13, x FOR PEER REVIEW 5 of 16 the skeleton sequence diagram of a single driver's normal driving state as an example, as shown in Figure 4, the coordinates of key point i were denoted as  ,  and the Euclidean distance between two key points could be expressed as The angle between two segments of bones could be calculated using the cosine theorem: Most of the research on distracted driving includes behaviors such as using a mobile phone, eating, making phone calls, etc. [28,29].These behaviors are typically expressed through the upper body.By calculating and abstracting the driver's skeletal sequence diagram into a set of five-dimensional feature values  ,  ,  ,  , and  , combined features could effectively describe abnormal behaviors in various body parts.The calculation methods for each feature value are given by Equations ( 4)- (8).The angle between two segments of bones could be calculated using the cosine theorem: Most of the research on distracted driving includes behaviors such as using a mobile phone, eating, making phone calls, etc. [28,29].These behaviors are typically expressed through the upper body.By calculating and abstracting the driver's skeletal sequence diagram into a set of five-dimensional feature values r 0 , r 1 , r 2 , r 3 , and r 4 , combined features could effectively describe abnormal behaviors in various body parts.The calculation methods for each feature value are given by Equations ( 4)- (8).
By defining placing both hands on the steering wheel, maintaining an upright posture, and keeping the head facing forward as the standard for normal driving status, the fivedimensional characteristic values of normal driving were set as standard quantities ▲▲.When there were one or three triangles, the corresponding feature values were smaller or larger than under normal driving conditions.The characteristic patterns under different driving behaviors were established as shown in Table 1.▲▲ ▲/▲▲▲ ▲▲ ▲

Classification Algorithms
While currently mainstream deep learning algorithms exhibit excellent performance in classification tasks, most of them achieve feature extraction through the deep stacking of convolutional neural networks and then output class confidence through a classification function [30][31][32].However, these extensive computations place higher demands on the computational power of devices.Traditional machine learning theory has been highly developed over a long period of time, possessing strong interpretability and practical application value.Based on sufficient feature engineering, classification results can be obtained through rapid numerical calculations.

KNN
KNN is a classical machine learning method that is widely used for solving classification and regression problems due to its simple principle and excellent performance.Its main idea is to iterate through the K nearest values in the training set and conduct voting, with the predicted result being the category that receives the majority of votes, as shown in Figure 5.
plication value.Based on sufficient feature engineering, classification results can be obtained through rapid numerical calculations.

KNN
KNN is a classical machine learning method that is widely used for solving classification and regression problems due to its simple principle and excellent performance.Its main idea is to iterate through the K nearest values in the training set and conduct voting, with the predicted result being the category that receives the majority of votes, as shown in Figure 5.In the KNN algorithm, commonly used distance metrics mainly include Euclidean distance and Manhattan distance.The mathematical expressions for these metrics are given by Equations ( 9) and ( 10), respectively, where V represents the number of feature value dimensions.
The value of K in the KNN algorithm is a parameter that requires repeated validation as its selection greatly affects the performance on the test set.When the chosen K value is too small, the voting objects are limited to a very small region, and the prediction result depends heavily on the most similar values between the training set and the test set, which can be easily influenced by outliers.Conversely, when the chosen K value is too large, the In the KNN algorithm, commonly used distance metrics mainly include Euclidean distance and Manhattan distance.The mathematical expressions for these metrics are given by Equations ( 9) and ( 10), respectively, where V represents the number of feature value dimensions.
The value of K in the KNN algorithm is a parameter that requires repeated validation as its selection greatly affects the performance on the test set.When the chosen K value is too small, the voting objects are limited to a very small region, and the prediction result depends heavily on the most similar values between the training set and the test set, which can be easily influenced by outliers.Conversely, when the chosen K value is too large, the range of voting objects increases, which not only increases the computational burden of the algorithm but also raises the risk of overfitting.Therefore, it is crucial to select an appropriate K value based on the characteristics of the dataset for accurate predictions.Generally, we need to start with a small odd value of K (usually K = 1) and gradually increase it for experiments to select the appropriate K value.

ADW-KNN
However, the traditional KNN algorithm simply considers the importance of the majority proportion among voters, while ignoring the specific positional relationships among them.This can lead to issues such as the following: As shown in Figure 5, if only the majority proportion of votes is considered to determine the predicted value, then the predicted result would be a triangle.In reality, considering the positions of the voters and the predicted value, the predicted result often tends to be a circle.Furthermore, in traditional KNN, K is generally only taken as an odd number.The reason for this is that when K is an even number, there is a high possibility of a draw situation where the number of votes for each category is the same, as illustrated in Figure 6.
To address the aforementioned issues, this paper proposes an adjustable parameter KNN classification method (ADW-KNN) that incorporates distance as a basis for voting.The main idea is to no longer rely solely on majority voting to determine the predicted result but instead to combine category counts and distances as indicators for prediction.By introducing an adjustable parameter P, different weights can be assigned to these two indicators to finalize the output.The benefit of this approach is that it introduces positional references among voters, which helps to mitigate the influence of outliers when the value of K is small and enables more accurate identification of training data with the highest similarity to the predicted value.Additionally, it effectively resolves ties when K is an even number.
the majority proportion of votes is considered to determine the predicted value, then the predicted result would be a triangle.In reality, considering the positions of the voters and the predicted value, the predicted result often tends to be a circle.Furthermore, in traditional KNN, K is generally only taken as an odd number.The reason for this is that when K is an even number, there is a high possibility of a draw situation where the number of votes for each category is the same, as illustrated in Figure 6.To address the aforementioned issues, this paper proposes an adjustable parameter KNN classification method (ADW-KNN) that incorporates distance as a basis for voting.The main idea is to no longer rely solely on majority voting to determine the predicted result but instead to combine category counts and distances as indicators for prediction.By introducing an adjustable parameter P, different weights can be assigned to these two indicators to finalize the output.The benefit of this approach is that it introduces positional references among voters, which helps to mitigate the influence of outliers when the value of K is small and enables more accurate identification of training data with the highest similarity to the predicted value.Additionally, it effectively resolves ties when K is an even number.
The main calculation process (Figure 7) of ADW-KNN involved selecting the K nearest voters, calculating the category contribution ratio   and distance contribution ratio   for each category among the voters.The category contribution ratio was defined as the ratio of the total number of votes for each category to the total number of voters (K).The distance contribution ratio was defined as the ratio of the reciprocal sum of distances for each category to the reciprocal sum of distances for all voters.Finally, the overall weight w was calculated, and the category with the highest weight was output as the predicted result.The main calculation process (Figure 7) of ADW-KNN involved selecting the K nearest voters, calculating the category contribution ratio C class and distance contribution ratio C dist for each category among the voters.The category contribution ratio was defined as the ratio of the total number of votes for each category to the total number of voters (K).The distance contribution ratio was defined as the ratio of the reciprocal sum of distances for each category to the reciprocal sum of distances for all voters.Finally, the overall weight w was calculated, and the category with the highest weight was output as the predicted result.The formula representation of the main parameters involved in the above process is as follows: The distance calculation involved in ADW-KNN is obtained based on Euclidean distance (such as Formula ( 9)).P is an adjustable parameter between 0 and 1, it is used to adjust the weights of category contribution and distance contribution.When P = 1, it cor- The formula representation of the main parameters involved in the above process is as follows: The distance calculation involved in ADW-KNN is obtained based on Euclidean distance (such as Formula ( 9)).P is an adjustable parameter between 0 and 1, it is used to adjust the weights of category contribution and distance contribution.When P = 1, it corresponds to the traditional KNN algorithm.

Introduction to the Dataset
Currently, there are relatively few publicly available distracted driving behavior datasets, and their quality varies greatly.Therefore, the experimental data used in this article were derived from the large-scale dataset State Farm Distracted Driver Detection (SFD3) [33], which is publicly available on the well-known machine learning competition website Kaggle.Eight types of high-risk distracted behaviors were selected for the experiment, totaling over 18,000 images with a uniform size of 640 × 480 RGB.Part of the dataset is shown in Figure 8, and the processed dataset is shown in Figure 9.All images were randomly divided into training and testing sets in an 8:2 ratio, as shown in Table 2.The following table shows the number of images in the training and testing sets for each category.

Experimental Environment
The experiment was conducted on a desktop computer running Windows 10.The model code was developed using the Python-PyTorch software package (Python version 3.9.13 and PyTorch version 1.8.1).Some parts of the code were written in the Cython language, with Cython version 3.0.0.The computer had the following specifications: CPU Model: Core i5-7300HQ; RAM: 8 GB; GPU Model: GTX 1050ti; VRAM: 4 GB.

Evaluation Index
Accuracy is generally used as an evaluation indicator for the predictive ability a model.The calculation formula is below: TP represents positive samples predicted as positive, TN represents negative samples predicted as negative, FP represents negative samples predicted as positive, and FN represents positive samples predicted as negative.
To measure the detection speed of a model, FPS is generally used as an evaluation metric, defined as the number of images detected by the model per second, measured in Hz.FPS = image num elapsed time (15)

Experimental and Results Analysis 6.1. Comparison Experiment between KNN and ADW-KNN
The goal was to validate the superiority of ADW-KNN compared to the traditional KNN algorithm.The feature vectors obtained were classified using both the KNN and ADW-KNN algorithms.The specific experimental parameters were as follows: K ranges from 1 to 8 with a step size of 1. Adjustable parameter P ranges from 0.2 to 0.8 with a step size of 0.2.
Figure 10 compares the accuracy of the two algorithms.It can be observed that the KNN algorithm achieved the optimal classification result when K = 1 and 3, with an accuracy of 93.62%.However, the accuracy gradually decreased as K increased beyond 3, reaching a minimum of 92.26%.By adjusting the values of P and K to find the optimal parameters, Figure 10 shows that the highest prediction accuracy of 94.04% was achieved when K = 6 and P = 0.2.This was an improvement of 0.42% compared to the best accuracy of the KNN algorithm and a 1.28% increase compared to the accuracy when K = 6.As P increased with a step size of 0.2, it was found that the accuracy remained unchanged for K = 1 and 2 regardless of the value of P. For other values of K, the curve exhibited a general downward trend, with a more significant decrease as P approached 1.The experiments demonstrated that the ADW-KNN algorithm outperformed the KNN algorithm for the given range of P values, indicating that the improved algorithm achieves better classification results.
increased with a step size of 0.2, it was found that the accuracy remained unchanged for K = 1 and 2 regardless of the value of P. For other values of K, the curve exhibited a general downward trend, with a more significant decrease as P approached 1.The experiments demonstrated that the ADW-KNN algorithm outperformed the KNN algorithm for the given range of P values, indicating that the improved algorithm achieves better classification results.To further investigate the classification performance of both the KNN and ADW-KNN algorithms for various distracted driving behaviors, a comparison was made between their respective best and worst performances.The resulting confusion matrices are presented in Figure 11.To further investigate the classification performance of both the KNN and ADW-KNN algorithms for various distracted driving behaviors, a comparison was made between their respective best and worst performances.The resulting confusion matrices are presented in Figure 11.The analysis of the confusion matrices showed that the two algorithms had poor recognition rates for the three behaviors of (a) drinking, (d) texting right, and (f) calling right.The reason is that these three behaviors all occur in the right hand, resulting in small differences in characteristics between the behaviors and easy confusion among the three behaviors.Therefore, the recognition accuracy was lower than for other behaviors.Ana- The analysis of the confusion matrices showed that the two algorithms had poor recognition rates for the three behaviors of (a) drinking, (d) texting right, and (f) calling right.The reason is that these three behaviors all occur in the right hand, resulting in small differences in characteristics between the behaviors and easy confusion among the three behaviors.Therefore, the recognition accuracy was lower than for other behaviors.Analyzing the confusion matrix in Figure 11, under the same K value, ADW-KNN showed a significant improvement in accuracy compared to KNN for both (d) texting right and (f) calling right.Overall, the accuracy of the improved algorithm was better than that of the original algorithm.

Comparison Experiment between ADW-KNN and Other Machine Learning Algorithms
To validate the superiority of the proposed ADW-KNN algorithm compared to other machine learning algorithms, classification experiments were conducted on the feature set obtained from the SFD3 dataset using algorithms such as decision tree (DT), support vector machine (SVM), and logistic regression (LR).Accuracy and computation time were compared across these algorithms.The best performance parameters for KNN and ADW-KNN were K = 1 and K = 6 with P = 0.2.For the decision tree algorithm, the entropy criterion was tested using Gini, cross-entropy, and log functions.SVM was evaluated using three kernel functions: rbf, linear, and sigmoid.For logistic regression, both L2 and L1 penalty functions were compared.The experimental results are presented in Figure 12, Table 3 shows the performance distribution of each algorithm under various conditions.
Electronics 2024, 13, x FOR PEER REVIEW 12 of 16 obtained from the SFD3 dataset using algorithms such as decision tree (DT), support vector machine (SVM), and logistic regression (LR).Accuracy and computation time were compared across these algorithms.The best performance parameters for KNN and ADW-KNN were K = 1 and K = 6 with P = 0.2.For the decision tree algorithm, the entropy criterion was tested using Gini, cross-entropy, and log functions.SVM was evaluated using three kernel functions: rbf, linear, and sigmoid.For logistic regression, both L2 and L1 penalty functions were compared.The experimental results are presented in Figure 12, Table 3 shows the performance distribution of each algorithm under various conditions.Based on the comprehensive analysis presented above, the ADW-KNN algorithm exhibits significant advantages in both accuracy and speed compared to other machine learning algorithms.Therefore, it was reasonable and effective to choose the KNN algorithm as the baseline for classification and further improvement.The ADW-KNN algorithm's performance demonstrated its suitability for addressing the problem of distracted driving behavior recognition, offering a reliable and efficient solution.

The Generalization Experiment of ADW-KNN
To validate the generalization capability of the proposed ADW-KNN algorithm, we selected two representative, publicly available, machine learning datasets from the Kaggle website for performance testing.
(1) Wine Quality Dataset [34]: This dataset consists of approximately 4900 wine samples,  Based on the comprehensive analysis presented above, the ADW-KNN algorithm exhibits significant advantages in both accuracy and speed compared to other machine learning algorithms.Therefore, it was reasonable and effective to choose the KNN algorithm as the baseline for classification and further improvement.The ADW-KNN algorithm's performance demonstrated its suitability for addressing the problem of distracted driving behavior recognition, offering a reliable and efficient solution.

The Generalization Experiment of ADW-KNN
To validate the generalization capability of the proposed ADW-KNN algorithm, we selected two representative, publicly available, machine learning datasets from the Kaggle website for performance testing.Both datasets were randomly divided into training and testing sets in an 8:2 ratio.KNN and ADW-KNN algorithms were employed for experimental analysis, and the results are presented in Figure 13.For ADW-KNN, the parameter P was set with a step size of 0.2.From Figure 13a , it can be seen that when P = 0.2 and K = 8, ADW-KNN exhibited the highest accuracy of 64.3%, while KNN with the same K value only achieved an accuracy of 50.2%.When K was set to 1, KNN demonstrated its best accuracy of 60.7%.Overall, the improved KNN algorithm, ADW-KNN, performed relatively well on multi-class classification tasks.
Figure 13b illustrates that the performance of ADW-KNN remained consistent across various P values.It outperformed the KNN algorithm when K was set to 2 and 6.Both algorithms achieved the highest accuracy of 94.7%.In classification tasks with fewer categories, the ADW-KNN algorithm was not sensitive to changes in the P value.Adjusting the parameters did not lead to significantly better results than KNN, but it could outperform KNN in some cases when K was set to an even number.

Comparison Experiment between Our Algorithm and Other Algorithms
To validate the superiority of our algorithm, comparative experiments were conducted with some classic neural network models, such as VGG16, VGG19, and ResNet50, as well as algorithms proposed in recent years.
According to the experimental data in Table 4, compared with some classic CNN algorithms, the algorithm proposed in this paper has advantages in both accuracy and speed, especially in terms of accuracy, which is more powerful than that of CNNs.From Figure 13a, it can be seen that when P = 0.2 and K = 8, ADW-KNN exhibited the highest accuracy of 64.3%, while KNN with the same K value only achieved an accuracy of 50.2%.When K was set to 1, KNN demonstrated its best accuracy of 60.7%.Overall, the improved KNN algorithm, ADW-KNN, performed relatively well on multi-class classification tasks.
Figure 13b illustrates that the performance of ADW-KNN remained consistent across various P values.It outperformed the KNN algorithm when K was set to 2 and 6.Both algorithms achieved the highest accuracy of 94.7%.In classification tasks with fewer categories, the ADW-KNN algorithm was not sensitive to changes in the P value.Adjusting the parameters did not lead to significantly better results than KNN, but it could outperform KNN in some cases when K was set to an even number.

Comparison Experiment between Our Algorithm and Other Algorithms
To validate the superiority of our algorithm, comparative experiments were conducted with some classic neural network models, such as VGG16, VGG19, and ResNet50, as well as algorithms proposed in recent years.
According to the experimental data in Table 4, compared with some classic CNN algorithms, the algorithm proposed in this paper has advantages in both accuracy and speed, especially in terms of accuracy, which is more powerful than that of CNNs.Table 5 compares our algorithm with other algorithms.Paper [36] employed a Mo-bileNet model based on transfer learning as the backbone for feature extraction, achieving approximately 90% accuracy while demonstrating a significant speed advantage with up to 100 FPS.The algorithm described in paper [37] innovatively utilizes ResNet50 for image feature extraction and then employs SVM for classification, resulting in the ReSVM algorithm achieving a high accuracy rate.However, the cascading of multiple models slows down the detection speed.In contrast, paper [38] lightweighted YOLOv8n and introduced an attention mechanism to create YOLOv8-LBS, demonstrating a good balance between accuracy and speed in experimental results.

Conclusions and Future Outlook
Currently, most algorithms for detecting driver distraction behaviors employ endto-end deep learning models, while traditional machine learning algorithms struggle to handle such complex tasks.This paper innovatively proposes the use of deep learning as a means of feature extraction, combined with the rapid and accurate classification capabilities of machine learning for prediction output.This approach significantly addresses the cumbersome training and parameter-tuning processes of deep learning, as well as the requirement for high-performance hardware.The KNN algorithm has achieved good results in application, possibly due to the distinct features between different distracted driving behaviors, and has a strong ability to find similar features.Furthermore, the ADW-KNN algorithm proposed in this paper demonstrated excellent performance on a large dataset.However, a limitation is the need to adjust parameters through testing to find the appropriate values for P and K. Often, the K value for ADW-KNN is larger than that for the KNN algorithm, resulting in increased computational complexity.
Future work will focus on three main areas: (1) Constructing a dataset captured from the driver's frontal view, enabling the pose estimation network to more easily extract driver pose features.(2) Embedding the algorithm into an in-vehicle image capture device to achieve end-to-end deployment and application.(3) Exploring the use of excellent ensemble learning algorithms, such as random forests, for feature classification, as experiments have shown that decision trees also exhibit promising classification performance and execution speed.

Figure 4 .
Figure 4. Schematic diagram of the angle and spacing of relevant joint points.

Figure 4 .
Figure 4. Schematic diagram of the angle and spacing of relevant joint points.

Figure 5 .
Figure 5.The results of traditional KNN prediction.

Figure 5 .
Figure 5.The results of traditional KNN prediction.

Figure 6 .
Figure 6.The occurrence of a draw situation.

Figure 6 .
Figure 6.The occurrence of a draw situation.

Figure 12 .
Figure 12.Performance comparison of machine learning algorithms.

Figure 12 .
Figure 12.Performance comparison of machine learning algorithms.

( 1 )
Wine Quality Dataset[34]: This dataset consists of approximately 4900 wine samples, with 11 physicochemical properties as evaluation indicators.The quality of each wine is rated on a scale of 3-9, with a total of seven levels.(2)Wisconsin Breast Cancer Dataset[35]: This dataset comprises around 570 instances of patient information, with 30 clinical examinations and medical imaging data for each patient.The ultimate evaluation of a tumor is benign or malignant.

Electronics 2024 ,Figure 13 .
Figure 13.(a) Test results of wine quality dataset.(b) Test results of breast cancer dataset.

Figure 13 .
Figure 13.(a) Test results of wine quality dataset.(b) Test results of breast cancer dataset.

Table 1 .
The regularity of characteristic values of various driving behaviors.

Table 3 .
Performance comparison of various algorithms under optimal parameters.

Table 3 .
Performance comparison of various algorithms under optimal parameters.

Table 4 .
Comparison results between the algorithm in this article and neural network algorithms.

Table 4 .
Comparison results between the algorithm in this article and neural network algorithms.

Table 5 .
Performance of different algorithms on the SFD3 dataset.