Cross-individual EEG driving fatigue detection method based on multi-feature contrast learning
By using a multi-feature contrastive learning method, a cross-individual EEG driving fatigue detection model was constructed, which solved the problem of decreased recognition accuracy in cross-individual application scenarios and achieved high accuracy and robustness of the model on different driver data.
Patent Information
- Application Number
- CN202511466208.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-14
- Publication Date
- 2026-01-23
AI Technical Summary
Existing fatigue driving detection models based on EEG signals show a significant decrease in accuracy in cross-individual application scenarios, making it difficult to meet the robustness requirements of models in complex driving environments.
A multi-feature contrastive learning approach is adopted, which extracts power spectral density and differential entropy features by constructing a feature extraction module, a single feature discriminator, a contrastive learning module, a multi-feature fusion module, and a multi-feature decision maker. This is used to perform cross-individual EEG driving fatigue detection, and the Transformer multi-head attention network is used for feature fusion. The feature representation is optimized by using a contrastive loss function.
This improved the model's adaptability to individual differences, enhanced its generalization ability and robustness in detection, and improved the accuracy of cross-individual fatigue detection.
Smart Images

Figure CN121370188A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to neurophysiological signal analysis technology in the field of brain cognitive computing, specifically to a cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning. Background Technology
[0002] With the continuous increase in traffic flow density and the rapid development of the logistics industry, intelligent transportation systems are placing more stringent demands on the high-precision identification of driver fatigue, urgently requiring detection methods with strong generalization capabilities and real-time performance to ensure traffic safety. Current fatigue driving detection methods mainly rely on data such as vehicle behavior characteristics, video image features, and physiological signals. Among these, electroencephalogram (EEG) signals are widely considered the "gold standard" for fatigue monitoring because they directly reflect the driver's brain activity. However, EEG signals exhibit significant individual variability; different drivers show considerable differences in EEG spectral characteristics, spatial distribution patterns, and neural dynamic response mechanisms. This variability leads to a general decrease in the accuracy of existing EEG-based detection models in cross-individual scenarios, severely restricting the promotion and application of related technologies in real-world driving environments.
[0003] To address the challenge of model generalization caused by differences in cross-individual data distribution, several related fields have conducted fruitful research. In computer vision, researchers have improved model generalization capabilities through feature space alignment techniques. For example, the MixStyle method generates diverse representations by mixing channel statistical features from different samples, improving the classification accuracy of multi-source data by 1.7%. In human motion recognition research in wearable devices, standardized preprocessing of individual data and sensor coordinate system calibration have increased the accuracy of leave-one-out cross-validation from 68% to 78%. In EEG emotion recognition, a contrastive learning strategy is employed to maximize the consistency of cross-individual feature representations, achieving 80% cross-individual recognition accuracy on datasets such as SEED (The SJTU Emotion EEGDataset). These techniques collectively demonstrate that feature mixing, signal calibration, and contrastive alignment can effectively alleviate the performance degradation caused by data distribution shifts, providing important insights into solving the problem of individual differences in EEG signals.
[0004] While existing research has made some progress in cross-individual EEG (electroencephalogram) fatigue detection, most methods focus on macroscopic global domain alignment. Even recent hybrid models combining graph convolution and Transformer, although capable of characterizing the spatial topological relationships of EEG channels, rely on fixed adjacency matrices and struggle to capture the dynamic changes in temporal and frequency domain features that occur with varying driving states. In practice, it has been shown that when these models are deployed to new drivers, their detection performance often drops significantly, failing to meet the stringent robustness requirements of models in complex driving environments. Designing EEG signal feature alignment schemes that adapt to different individual drivers and constructing detection models with cross-individual robustness has become a key technical challenge that urgently needs to be overcome in the field of fatigue driving detection. Summary of the Invention
[0005] The purpose of this invention is to address the problem of significantly reduced accuracy in cross-individual application scenarios using existing EEG-based fatigue driving detection models, and to propose a cross-individual EEG-based fatigue driving detection method based on multi-feature contrastive learning. This method aims to improve the model's adaptability to individual differences, thereby enhancing its generalization ability and detection robustness.
[0006] To achieve the above objectives, the technical solution provided by this invention is as follows:
[0007] A cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning includes:
[0008] Obtain EEG signal sample data and fatigue index from different individuals, and label the EEG signal sample data with real labels based on the fatigue index;
[0009] Power spectral density features and differential entropy features were obtained based on EEG signal sample data;
[0010] A feature extraction module is constructed, and the shallow power spectral density semantic features, shallow differential entropy semantic features, deep power spectral density semantic features, and deep differential entropy semantic features are extracted from the power spectral density features and differential entropy features.
[0011] Construct a single-feature discriminator, input the deep power spectral density semantic features and the deep differential entropy semantic features into the single-feature discriminator respectively, and obtain the power spectral density prediction classification label and the differential entropy prediction classification label respectively. Calculate the power spectral density feature prediction loss and the differential entropy feature prediction loss.
[0012] A contrastive learning module is constructed, which predicts classification labels based on power spectral density, differential entropy, and true labels. Positive sample pairs, negative sample pairs, and semi-positive sample pairs are defined, and the contrastive loss function is calculated based on deep power spectral density semantic features and deep differential entropy semantic features.
[0013] A multi-feature fusion module is constructed to concatenate shallow power spectral density semantic features and shallow differential entropy semantic features to obtain a preliminary fusion representation. The preliminary fusion representation, deep power spectral density semantic features, and deep differential entropy semantic features are then input into the multi-feature fusion module to obtain a fusion feature vector.
[0014] Construct a multi-feature decision-maker, input the fused feature vector into the multi-feature decision-maker to obtain the probability value of the sample belonging to the true category, and calculate the prediction loss function of the fused feature vector based on the probability value;
[0015] The model is trained based on power spectral density feature prediction loss, differential entropy feature prediction loss, contrast loss function and fusion feature vector prediction loss function, and fatigue classification label of the sample to be detected is obtained using the trained model.
[0016] Furthermore, the construction of the feature extraction module extracts shallow power spectral density semantic features, shallow differential entropy semantic features, deep power spectral density semantic features, and deep differential entropy semantic features from the power spectral density features and differential entropy features, including:
[0017] The feature extraction module consists of two symmetrical branches, namely the first branch and the second branch. Each branch consists of two cascaded convolutional modules, namely the first convolutional module and the second convolutional module.
[0018] The power spectral density features are input into the first branch and passed through the first convolution module of the first branch to obtain shallow power spectral density semantic features. The shallow power spectral density semantic features are then passed through the second convolution module of the first branch to obtain deep power spectral density semantic features.
[0019] The differential entropy features are input into the second branch and passed through the first convolution module of the second branch to obtain shallow differential entropy semantic features. The shallow differential entropy semantic features are then passed through the second convolution module of the second branch to obtain deep differential entropy semantic features.
[0020] Furthermore, the construction of the single-feature discriminator involves inputting the deep power spectral density semantic features and the deep differential entropy semantic features into the single-feature discriminator, respectively, to obtain the power spectral density predicted classification label and the differential entropy predicted classification label, including:
[0021] The single-feature discriminator comprises three fully connected layers and one Dropout layer. The deep power spectral density semantic features and deep differential entropy semantic features are sequentially processed through fully connected transformation, ReLU activation, Dropout regularization, a second fully connected transformation, ReLU activation, and a third fully connected transformation to obtain the final linear classification mapping. Finally, through… The function outputs power spectral density to predict classification labels and differential entropy to predict classification labels.
[0022] Furthermore, the power spectral density feature prediction loss and the differential entropy feature prediction loss are calculated using the following formulas:
[0023] ;
[0024] ;
[0025] ;
[0026] ;
[0027] in, This represents the power spectral density feature prediction loss. This represents the difference entropy feature prediction loss. The total number of samples, Indicates the first The true label of each sample Indicates the first The predicted probability of a sample on the first branch Indicates the first The predicted probability of a sample on the second branch It is the conditional probability formula. A collection of real labels. It is a set of semantic features of deep power spectral density. It is a set of semantic features derived from deep differential entropy. Given the semantic features of deep power spectral density, this represents the predicted probability distribution output by a single-feature discriminator. Given the semantic features of deep differential entropy, this is the predicted probability distribution output by a single-feature discriminator.
[0028] Furthermore, the construction of the contrastive learning module, based on power spectral density prediction of classification labels, differential entropy prediction of classification labels, and the true label, defines positive sample pairs, negative sample pairs, and semi-positive sample pairs, including:
[0029] When the power spectral density predicted classification label, the differential entropy predicted classification label, and the true label are all the same, the deep power spectral density semantic feature and the deep differential entropy semantic feature are defined as positive sample pairs.
[0030] When the power spectral density predicted classification label, the differential entropy predicted classification label, and the true label are all different, the deep power spectral density semantic feature and the deep differential entropy semantic feature are defined as negative sample pairs.
[0031] When the power spectral density prediction classification label and the differential entropy prediction classification label are different, the deep power spectral density semantic features and the deep differential entropy semantic features are defined as semi-positive sample pairs.
[0032] Furthermore, the calculation of the contrastive loss function based on deep power spectral density semantic features and deep differential entropy semantic features includes:
[0033] The contrastive loss function is constructed as shown in the following formula:
[0034] ;
[0035] in, This represents the contrastive loss function. Describes the set of positive sample pairs. This represents the set of semi-positive sample pairs. Denotes the set of all sample pairs. Indicates the first Deep power spectral density semantic features in a sample pair Indicates the first Deep differential entropy semantic features in a sample pair Indicates the first The cosine values of the deep power spectral density semantic features and deep differential entropy semantic features of each sample pair. This represents the temperature coefficient.
[0036] Furthermore, the preliminary fusion representation, deep power spectral density semantic features, and deep differential entropy semantic features are input into the multi-feature fusion module to obtain a fused feature vector, including:
[0037] The preliminary fusion representation, deep power spectral density semantic features, and deep differential entropy semantic features are respectively used as the key vector, query vector, and value vector of the Transformer multi-head attention network.
[0038] Perform a residual connection and normalization on the output of the multi-head attention network;
[0039] The residual concatenation and normalized output are input into a circuit consisting of two layers of linear transformation and... The feedforward network formed by this network can be expressed by the following formula:
[0040] ;
[0041] in, Indicates a feedforward network. This represents the output of the first residual connection and normalization. , and , These represent the weights and biases of the two layers within the feedforward network. For activation functions;
[0042] The output of the feedforward network is subjected to residual connections and layer normalization to obtain the fused feature vector.
[0043] Furthermore, the construction of the multi-feature decision-maker involves inputting the fused feature vector into the multi-feature decision-maker to obtain the probability value of a sample belonging to the true category, including:
[0044] The multi-feature decision builder consists of three fully connected layers and one Dropout layer. The fused feature vectors are sequentially processed through fully connected transformation, ReLU activation, Dropout regularization, a second fully connected transformation, ReLU activation, and a third fully connected transformation to obtain the final linear classification mapping. The function outputs a fatigue classification label, and the Softmax function outputs the probability value of the sample belonging to the true category.
[0045] Furthermore, the loss function for predicting the fused feature vector based on probability values is expressed by the following formula:
[0046] ;
[0047] in, This represents the loss function for predicting using fused feature vectors. The total number of samples, It is the first The true label of each sample Indicates the first The probability value of a sample belonging to the true category.
[0048] Compared with the prior art, the significant advantages of this invention are:
[0049] 1. This invention introduces a single-feature prediction task, where each extracted feature is independently predicted and classified, enabling the model to automatically evaluate the effectiveness of each piece of information and suppress noise interference. By focusing on useful signal features, the model learns key information more accurately during training, thereby improving the accuracy of fatigue driving detection and reducing classification errors caused by invalid signals or noise.
[0050] 2. A cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning is proposed. This method guides contrastive learning for modality alignment using PSD and DE feature classification labels, deeply exploring the similarities between different signals under the same driving state, effectively reducing the impact of individual differences on model performance. This strategy effectively reduces performance fluctuations caused by individual EEG differences, enhances the model's generalization ability on different driver data, and thus improves the accuracy of cross-individual fatigue detection. Attached Figure Description
[0051] Figure 1 This is a schematic diagram of the overall framework of the present invention;
[0052] Figure 2This is a diagram of the feature extraction network structure of the present invention;
[0053] Figure 3 This is a flowchart of the comparative learning module of the present invention;
[0054] Figure 4 This is a spatial distribution diagram of the PCA features of the present invention;
[0055] Figure 5 This is the confusion matrix diagram of the present invention;
[0056] Figure 6 This refers to the accuracy of each subject in the leave-one-out cross-validation method of this invention;
[0057] Figure 7 Brain region heatmap of subject 1 in leave-one-out cross-validation;
[0058] Figure 8 The brain region heatmap of subject 22 in leave-one-out cross-validation. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0060] To address the significant decline in accuracy of existing EEG-based driver fatigue detection models in cross-individual application scenarios, this invention provides a cross-individual EEG driver fatigue detection method based on multi-feature contrastive learning. This method aims to improve the model's adaptability to individual differences, thereby enhancing its generalization ability and detection robustness. To achieve the above objective, this invention provides a cross-individual EEG driver fatigue detection method based on multi-feature contrastive learning. This method constructs a cross-individual EEG driver fatigue detection model based on multi-feature contrastive learning (hereinafter referred to as the model), which includes: a feature extraction module, a single-feature discriminator, a contrastive learning module, a multi-feature fusion module, and a multi-feature decision maker. This method first preprocesses the acquired multi-channel raw EEG signals, and then inputs the processed data into the feature extraction module. This module extracts semantic features through a convolutional neural network and generates preliminary classification labels based on these features. During the model learning phase, a contrastive learning module is introduced, using the obtained classification labels to guide contrastive loss to mine the similarity between similar samples and the differences between dissimilar samples, optimizing feature representation to address significant differences between individuals. Then, in the multi-feature fusion module, multi-scale semantic features are weighted and fused to obtain a fused feature vector. Finally, based on this fused feature vector, a multi-feature decision-maker is used to identify fatigue states and output a driver's state prediction label to accurately determine driver fatigue.
[0061] like Figures 1-3 As shown, the present invention provides a cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning, the specific steps of which are as follows:
[0062] Step 1) Construction of EEG Feature Labels for Fatigue Driving. The fatigue driving EEG dataset used in this invention is the publicly available dataset SEED-VIG (a subset of the SEED dataset). In this dataset, multiple healthy individuals with good driving experience were asked to drive a car in a simulated driving system, and EEG signals were collected at 1000Hz. After preprocessing, the signals were downsampled to 200Hz. The EEG signals of each individual were segmented using an 8-second sliding window, resulting in 885 samples. The number of EEG data acquisition channels was 17. The extracted frequency bands (number of frequency bands was 25) and channel dimensions were concatenated to obtain 885×17×25 dimensional sample data. The dataset also provides a fatigue index calculated based on the open and closed-eye EEG baselines, with values ranging from 0 to 1, where a higher value indicates greater fatigue. To map this continuous index to discrete labels, a fatigue index greater than 0.35 is defined as a fatigued state for the subject; otherwise, the subject is defined as conscious, and the data is labeled with the true fatigue state.
[0063] Specifically, the formula for calculating the power spectral density (PSD) feature based on the input EEG signal is as follows:
[0064] ;
[0065] ;
[0066] in, This represents the frequency domain characteristics obtained after the Fourier transform of a time-domain signal. Indicates power spectral density characteristics, Represents frequency variables. yes EEG signals at any given time It is a Fourier transform operator used to transform time-domain signals to the frequency domain.
[0067] The formula for calculating differential entropy (DE) features based on the input EEG signals is shown below:
[0068] ;
[0069] in, Represents the differential entropy feature. Therefore Logarithmic function with base 0. yes The variance.
[0070] The fatigue index and fatigue label are calculated using the following formulas:
[0071] ;
[0072] ;
[0073] in, The fatigue index was obtained from a centralized EEG dataset of fatigued driving. For the time the eyes are closed, For the total test time, Labels representing actual fatigue levels. At that time, the driver was not fatigued. At that time, the driver was fatigued.
[0074] Using the formulas for calculating power spectral density and differential entropy, a set of PSD features can be obtained. (i.e., in the formula) The set of features of DE and DE (i.e., in the formula) ), .in, Denotes the set of all real numbers. and These represent the number of channels and the number of frequency bands, respectively.
[0075] Step 2) Construct a feature extraction module based on a convolutional network, including a PSD (Power Spectral Density) feature extraction submodule and a DE (Differential Entropy) feature extraction submodule. The input is a driving fatigue sample labeled with the actual fatigue state (the original sample after power spectral density and differential entropy calculations), specifically containing the calculated PSD features. ,in Represents the set of PSD feature vectors for all samples. Indicates the first PSD features of each sample Total number of samples; DE features ,in Represents the set of DE feature vectors for all samples. Indicates the first DE features of each sample; labels of true fatigue states ,in, Indicates the first The true fatigue state label of each sample.
[0076] The structure of the feature extraction module of this invention is as follows: Figure 2 As shown, the feature extraction module consists of two symmetrical branches (the first branch and the second branch), which extract features from the PSD data respectively. and DE features Semantic features are extracted from the input feature map. Each branch consists of two cascaded convolutional modules: ConvBlock1 (the first convolutional module) and ConvBlock2 (the second convolutional module). Through multi-layer convolutional operations, normalization, and activation functions, they achieve efficient feature transformation and enhancement of the input feature map. In the initial stage of feature extraction, the input PSD or DE features first enter the ConvBlock1 module. For a one-dimensional time-series signal with an input feature dimension of 25, ConvBlock1 progressively expands the feature channels through three convolutional layers. The first layer uses a 1×1 convolutional kernel to increase the number of channels from the original 25 to 32. The second and third layers use 3×3 convolutional kernels with a stride of 1 and padding of 1, further expanding the number of channels to 64. At this point, the input PSD features... The shallow power spectral density semantic features are obtained after passing through a Convblock1 layer. Then, ConvBlock2 expands the number of channels to 128 based on the 64-channel features output by ConvBlock1 using a 3×3 convolutional kernel; and then extracts the deep power spectral density semantic features using a second layer with the same 3×3 convolutional kernel. Similarly, the input DE features Shallow differential entropy semantic features can be obtained. and deep differential entropy semantic features .
[0077] Step 3) Generation of classification labels for deep EEG semantic features. The single-feature discriminator mainly consists of three fully connected layers and one Dropout layer. The input features are sequentially processed through fully connected transformation, ReLU activation, Dropout regularization, a second fully connected transformation, ReLU activation, and a third fully connected transformation to obtain the final linear classification mapping. Finally, the classification is performed using... The function outputs the final classification result. Specifically, the single-feature discriminator receives an input vector with a dimension of 128 and extracts high-order abstract features step by step through three fully connected layers, each with 128 hidden units. A Dropout layer with a dropout probability of 0.1 is introduced between the first and second layers, combined with the ReLU activation function to achieve non-linear mapping, suppressing neuronal co-adaptation and improving the model's generalization ability. The third layer maps the features to a two-dimensional output space, directly generating the classification probability distributions for fatigued and non-fatigue states. The resulting deep semantic features are then processed. and The samples are fed into a single-feature discriminator and processed separately. The power spectral density prediction classification label is obtained after the function. Sum of difference entropy to predict classification labels , , Here, the loss functions for PSD feature prediction and DE feature prediction are:
[0078] ;
[0079] ;
[0080] ;
[0081] ;
[0082] in, This represents the PSD feature prediction loss. This represents the feature prediction loss for DE. Indicates the first The true label of each sample Indicates the first The predicted probability of a sample on the PSD branch (first branch). Indicates the first The predicted probability of a sample on the DE branch (second branch). It is the conditional probability formula. A collection of real labels. For a given feature Under the given conditions, the predicted probability distribution output by the single-feature discriminator, For a given feature Under the given conditions, the predicted probability distribution output by the single-feature discriminator.
[0083] Step 4) Deep Semantic Feature Enhancement Based on Contrastive Learning. A contrastive learning module is constructed for the predicted classification labels based on deep PSD semantic features and the predicted classification labels based on deep DE semantic features. First, the deep PSD semantic features... and deep DE semantic features L2 normalization is performed separately to ensure that the feature dimensions of each sample are unified within a single hyperspherical space, preventing the amplitude differences between different information from interfering with similarity calculations. To distinguish between positive, negative, and semi-positive sample pairs, the contrastive learning module first calculates the similarity based on the predicted classification labels. , and real labels The mask matrix is constructed using the three-way relationship. The contrastive learning strategy structure of this invention is as follows: Figure 3 As shown, the predicted classification label obtained for a certain sample , and real labels Define when predicting class labels , and real labels When they are all the same, the features and For positive sample pairs; defined as when the predicted classification label... , and real labels When they are all different, features and For negative sample pairs; defined as when the predicted classification label is... and When they are different, features and These are semi-positive sample pairs; that is:
[0084] ;
[0085] ;
[0086] ;
[0087] in, , and These represent positive sample pairs, negative sample pairs, and semi-positive sample pairs, respectively.
[0088] The contrastive loss function is defined as follows:
[0089] ;
[0090] in, This represents the contrastive loss function. Denotes the set of all sample pairs. , Indicates the first Deep power spectral density semantic features in a sample pair Indicates the first Deep differential entropy semantic features in a sample pair It is the first Each sample pair was obtained through different feature extraction modules. and The cosine value, It is the temperature coefficient, which is taken as 0.07 in this invention.
[0091] Step 5) Construct the multi-feature fusion module. The multi-feature fusion structure is as follows: Figure 1 As shown, the shallow semantic features extracted from the two branches in the first stage are first... and By splicing them together, a preliminary fused representation containing information in the time and frequency domains is formed. After that, And what I got before , These are respectively used as the Key (K), Query (Q), and Value (V) of the Transformer multi-head attention network and fed into it. K, Q, and V are calculated as follows:
[0092] ;
[0093] ;
[0094] ;
[0095] in, , and The first Each attention head can learn a parameter matrix of Key, Query, and Value. For the first The key vector of each attention head. For the first A query vector with attention heads. For the first The value vector of each attention head.
[0096] This Transformer multi-head attention network uses four attention heads internally, with a feedforward network dimension of 40. Each head performs a scaled dot product operation on Q, K, and V, and the result is scaled to stabilize training. The output of each attention head is calculated using the following formula:
[0097] ;
[0098] in, For the first The output of each attention head, This is a scaling factor used to prevent gradient vanishing or exploding. The attention score is calculated and then... function after and Multiplication yields the contextual representation of each input feature; then the outputs of all attention heads are concatenated and projected back to the original dimensions:
[0099] ;
[0100] in, This is the final output of the multi-head attention network. For the number of attention heads, It is the linear transformation matrix after multi-head attention.
[0101] Subsequently, First, perform a residual join and normalization:
[0102] ;
[0103] after The input is fed into a system consisting of two linear transformations and The feedforward network consists of:
[0104] ;
[0105] The output of the feedforward network is also subjected to residual connections and layer normalization to further enhance its expressive power and obtain the fused features. The calculation formula is as follows:
[0106] ;
[0107] in, Represents the fused feature vector. This represents the output of the first residual connection and normalization. It is a normalization function. It is a feedforward network. , and , These represent the weights and biases of the two layers within the feedforward network. This is the activation function.
[0108] Step 6) Construct a multi-feature decision generator. The multi-feature decision generator has the same structure as the single-feature discriminator, consisting of three fully connected layers and one Dropout layer. The input features are sequentially processed through fully connected transformation, ReLU activation, Dropout regularization, a second fully connected transformation, ReLU activation, and a third fully connected transformation to obtain the final linear classification mapping. Finally, the mapping is passed through... The function outputs the final classification result, and the Softmax function outputs the probability value of a sample belonging to the true class. The probability value of a sample belonging to the true class is obtained by feeding it into a multi-feature decision maker. The loss function for predicting the fused feature vectors is defined as follows:
[0109] ;
[0110] in, This represents the loss function for predicting using fused feature vectors. It is the first The true label of each sample Indicates the first The probability value corresponding to the true class of each sample. It is a fusion feature vector go through The obtained label prediction distribution.
[0111] Step 7) Model training and classification result output. Based on the loss function obtained in steps 3), 4), and 6), the overall optimization objective of the model is obtained:
[0112] ;
[0113] in, Represents the total loss function. It is the loss coefficient that balances the prediction loss and the multi-feature contrast loss, and is set to 0.1 in this invention.
[0114] Furthermore, five-fold cross-validation and leave-one-out cross-validation were used for model training and testing. Five-fold cross-validation divided all samples proportionally into five parts, using one part as the test set and the remaining four parts as the training set in each round, repeating this process five times and combining the results of each round to evaluate the model. Leave-one-out cross-validation, on the other hand, selected all data from one of the N participants in each round as the test set and the data from the remaining participants as the training set, thus testing the model's generalization ability on entirely new individuals.
[0115] During the model training phase, all experiments in this embodiment were conducted within the PyTorch deep learning framework. The training parameters were as follows: initial learning rate of 0.001, weight decay of 0.01, maximum training epochs of 80, learning adjustment epochs of 5, and learning rate adjustment factor of 0.5. Model training is a technique well-known to those skilled in the art and will not be described in detail here.
[0116] In EEG driver fatigue detection, the distribution differences of six key features between awake and drowsy states are compared, for example... Figure 4 As shown in the figure, each subplot presents the feature distribution as a histogram. The horizontal axis represents the standardized feature values, and the vertical axis maps the probability density of the feature values. The blue and red areas correspond to the awake and drowsy states, respectively, and the blue and red dashed lines mark the means of the two groups. It can be seen that the mean of the awake group is generally skewed to the left, while the mean of the drowsy group is more skewed to the right, meaning that the values of these EEG features are generally higher when drowsy. Meanwhile, the discrimination of all six features exceeds 1.5, reflecting minimal overlap between the two groups. These features, possessing both numerical differences and discrimination, naturally have good potential for fatigue differentiation, providing core support for the model to accurately capture driving fatigue states, and further confirming the effectiveness of this framework in mining EEG fatigue patterns.
[0117] Figure 5The confusion matrix presents the model's identification results of EEG driver fatigue states using both true and predicted labels. Of the 1455 truly awake samples, 1190 were correctly predicted as awake, and 265 were misclassified as drowsy. Of the 2616 truly drowsy samples, 2576 were accurately identified as drowsy, and only 40 were misclassified as awake. The model demonstrates extremely high prediction accuracy for drowsy states, effectively capturing a large number of drowsy samples with a very low risk of missed detection. It also maintains good recognition ability for awake states, with a relatively limited number of misclassifications. The prediction performance in both states intuitively demonstrates the model's accurate identification ability of dangerous states in driver fatigue detection, as well as the overall reliability of its judgments.
[0118] Figure 6 This paper presents the accuracy distribution of the present invention on 23 subjects using leave-one-out cross-validation. The evaluation results show that the average accuracy of the present invention on the 23 subjects' data is 80.6%, with the lowest accuracy being 73.2% for subject 9 and the highest being 85.6% for subject 16. Thirteen subjects achieved an accuracy exceeding 80%, only four were below 78%, and the remaining six ranged between 79% and 84%. These results fully demonstrate that the model has a highly consistent recognition ability across different individuals and can reliably and stably detect driving fatigue.
[0119] Figure 7 and Figure 8 The power distribution and differences in EEG frequencies between alert and fatigue states are presented in a five-row, three-column format under leave-one-out cross-validation. The five rows correspond to... Wave (Delta, 1–4Hz) Wave (Theta, 4–8Hz) Wave (Alpha, 8–13Hz), Wave (Beta, 13–30 Hz) and The model is divided into five frequency bands (Gamma, 30–50 Hz); the three columns represent the difference between alertness, fatigue, and the difference between the two (Alert–Fatigue). The figures show that in a fatigued state, the power of Theta and Alpha waves in the posterior brain is significantly increased, indicating that subjects experience decreased attention and deeper relaxation when fatigued. Simultaneously, Beta and Gamma waves are significantly reduced in the posterior brain, suggesting that high-frequency cognitive activity is more active in an alert state. These frequency bands and spatial distribution characteristics are highly consistent with the electrophysiological patterns of fatigued driving, validating that the proposed model can effectively capture the electrophysiological markers related to fatigued driving.
[0120] This study conducts experimental validation of the proposed framework on the public benchmark dataset SEED-VIG.
[0121] Table 1. Comparison of five-fold cross-validation with baseline methods on the SEED-VIG dataset.
[0122] method Accuracy Recall rate accuracy KNN 73.44% 24.37% 46.18% LR 68.90% 50.53% 69.60% SVM 74.81% 39.23% 72.61% ViT 71.59% 68.19% 73.20% TSception 77.23% 79.66% 77.04% FCN_Wang 80.78% 81.15% 79.91% SFT-Net 88.20% 92.20% 87.10% The model presented in this paper (without a comparison learning module) 93.03% 93.45% 94.34% This article's model 94.05% 94.08% 95.20%
[0123] Table 1 shows the results of the five-fold cross-validation strategy. Among traditional machine learning methods, SVM (Support Vector Machine) performed best, achieving precision, recall, and accuracy of 74.81%, 39.23%, and 72.61%, respectively. KNN (k-Nearest Neighbors) followed closely, with accuracy of 73.44%, 24.37%, and 46.18%. LR (Logistic Regression) performed relatively poorly, with precision of 68.90%, recall of 50.53%, and accuracy of 69.60%. Overall, deep learning methods outperformed traditional methods. Among them, TSception (a multi-scale convolutional neural network method specifically designed for emotion recognition based on EEG signals, whose core design lies in simultaneously capturing the temporal dynamics of EEG signals and the spatial asymmetry of brain activity to achieve end-to-end emotion classification) achieved 77.23% precision, 79.66% recall, and 77.04% accuracy; FCN_Wang (Fully Convolutional Network) further improved upon this, with the three metrics being 80.78%, 81.15%, and 79.91%, respectively; SFT-Net (Spatial-Frequency-Temporal Network) performed even better, with 88.20% precision, 92.20% recall, and 87.10% accuracy. The two model versions proposed in this paper performed exceptionally well. The model without the contrastive learning module achieved precision, recall, and accuracy of 93.03%, 93.45%, and 94.34%, respectively, while the complete model achieved precision of 94.05%, recall of 94.08%, and accuracy of 95.20%, demonstrating significant performance advantages.
[0124] In leave-one-out cross-validation, the performance of traditional methods declines significantly.
[0125] Table 2 Comparison of Leave-One-Out Cross-Validation and Baseline Methods on the SEED-VIG Dataset
[0126] method Accuracy Recall rate accuracy KNN 71.06% 67.14% 60.48% LR 63.62% 64.38% 63.62% SVM 71.65% 62.94% 57.71% ViT 58.94% 48.84% 64.00% TSception 62.10% 37.50% 61.65% FCN_Wang 61.87% 42.07% 62.19% SFT-Net 69.98% 73.94% 69.14% The model presented in this paper (without a comparison learning module) 61.44% 62.18% 70.88% This article's model 63.61% 64.96% 80.64%
[0127] Table 2 shows that KNN's precision dropped to 71.06%, recall to 67.14%, and accuracy to 60.48%; LR's precision and accuracy both fell to 63.62%, and recall to 64.38%; SVM's three metrics were 71.65%, 62.94%, and 57.71%, respectively. Deep learning methods were also significantly affected: TSception's precision and accuracy dropped to 62.10% and 61.65%, respectively, with a recall of 37.50%; FCN_Wang's precision was 61.87%, recall to 42.07%, and accuracy to 62.19%; SFT-Net remained relatively stable, maintaining 69.98% precision, 73.94% recall, and 69.14% accuracy. Although the performance of the model in this paper is somewhat reduced, it still has significant advantages compared with other models. The precision, recall and accuracy of the model without using the contrastive learning module are 61.44%, 62.18% and 70.88%, respectively, while the full model achieves 63.61% precision, 64.96% recall and 80.64% accuracy. This shows that the contrastive learning module has a positive effect on improving the model's generalization ability.
[0128] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.
Claims
1. A cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning, characterized in that, include: Obtain EEG signal sample data and fatigue index from different individuals, and label the EEG signal sample data with real labels based on the fatigue index; Power spectral density features and differential entropy features were obtained based on EEG signal sample data; A feature extraction module is constructed, and the shallow power spectral density semantic features, shallow differential entropy semantic features, deep power spectral density semantic features, and deep differential entropy semantic features are extracted from the power spectral density features and differential entropy features. Construct a single-feature discriminator, input the deep power spectral density semantic features and the deep differential entropy semantic features into the single-feature discriminator respectively, and obtain the power spectral density prediction classification label and the differential entropy prediction classification label respectively. Calculate the power spectral density feature prediction loss and the differential entropy feature prediction loss. A contrastive learning module is constructed, which predicts classification labels based on power spectral density, differential entropy, and true labels. Positive sample pairs, negative sample pairs, and semi-positive sample pairs are defined, and the contrastive loss function is calculated based on deep power spectral density semantic features and deep differential entropy semantic features. A multi-feature fusion module is constructed to concatenate shallow power spectral density semantic features and shallow differential entropy semantic features to obtain a preliminary fusion representation. The preliminary fusion representation, deep power spectral density semantic features, and deep differential entropy semantic features are then input into the multi-feature fusion module to obtain a fusion feature vector. Construct a multi-feature decision-maker, input the fused feature vector into the multi-feature decision-maker to obtain the probability value of the sample belonging to the true category, and calculate the prediction loss function of the fused feature vector based on the probability value; The model is trained based on power spectral density feature prediction loss, differential entropy feature prediction loss, contrast loss function and fusion feature vector prediction loss function, and fatigue classification label of the sample to be detected is obtained using the trained model.
2. The cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning according to claim 1, characterized in that, The aforementioned feature extraction module extracts shallow power spectral density semantic features, shallow differential entropy semantic features, deep power spectral density semantic features, and deep differential entropy semantic features from power spectral density features and differential entropy features, including: The feature extraction module consists of two symmetrical branches, namely the first branch and the second branch. Each branch consists of two cascaded convolutional modules, namely the first convolutional module and the second convolutional module. The power spectral density features are input into the first branch and passed through the first convolution module of the first branch to obtain shallow power spectral density semantic features. The shallow power spectral density semantic features are then passed through the second convolution module of the first branch to obtain deep power spectral density semantic features. The differential entropy features are input into the second branch and passed through the first convolution module of the second branch to obtain shallow differential entropy semantic features. The shallow differential entropy semantic features are then passed through the second convolution module of the second branch to obtain deep differential entropy semantic features.
3. The cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning according to claim 1, characterized in that, The construction of the single-feature discriminator involves inputting the deep power spectral density semantic features and the deep differential entropy semantic features into the single-feature discriminator, respectively, to obtain the power spectral density predicted classification label and the differential entropy predicted classification label, including: The single-feature discriminator comprises three fully connected layers and one Dropout layer. The deep power spectral density semantic features and deep differential entropy semantic features are sequentially processed through fully connected transformation, ReLU activation, Dropout regularization, a second fully connected transformation, ReLU activation, and a third fully connected transformation to obtain the final linear classification mapping. Finally, through… The function outputs power spectral density to predict classification labels and differential entropy to predict classification labels.
4. The cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning according to claim 1, characterized in that, The power spectral density feature prediction loss and the difference entropy feature prediction loss are calculated using the following formulas: ; ; ; ; in, This represents the power spectral density feature prediction loss. This represents the difference entropy feature prediction loss. The total number of samples, Indicates the first The true label of each sample Indicates the first The predicted probability of a sample on the first branch Indicates the first The predicted probability of a sample on the second branch It is the conditional probability formula. A collection of real labels. It is a set of semantic features of deep power spectral density. It is a set of semantic features derived from deep differential entropy. Given the semantic features of deep power spectral density, this represents the predicted probability distribution output by a single-feature discriminator. Given deep differential entropy semantic features, this is the predicted probability distribution output by a single-feature discriminator.
5. The cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning according to claim 1, characterized in that, The construction of the contrastive learning module, based on power spectral density prediction of classification labels, differential entropy prediction of classification labels, and the true label, defines positive sample pairs, negative sample pairs, and semi-positive sample pairs, including: When the power spectral density predicted classification label, the differential entropy predicted classification label, and the true label are all the same, the deep power spectral density semantic feature and the deep differential entropy semantic feature are defined as positive sample pairs. When the power spectral density predicted classification label, the differential entropy predicted classification label, and the true label are all different, the deep power spectral density semantic feature and the deep differential entropy semantic feature are defined as negative sample pairs. When the power spectral density prediction classification label and the differential entropy prediction classification label are different, the deep power spectral density semantic features and the deep differential entropy semantic features are defined as semi-positive sample pairs.
6. The cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning according to claim 1, characterized in that, The calculation of the contrastive loss function based on deep power spectral density semantic features and deep differential entropy semantic features includes: The contrastive loss function is constructed as shown in the following formula: ; in, This represents the contrastive loss function. Describes the set of positive sample pairs. This represents the set of semi-positive sample pairs. Represents the set of all sample pairs. Indicates the first Deep power spectral density semantic features in a sample pair Indicates the first Deep differential entropy semantic features in a sample pair Indicates the first The cosine values of the deep power spectral density semantic features and deep differential entropy semantic features of each sample pair. This represents the temperature coefficient.
7. The cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning according to claim 1, characterized in that, The process involves inputting the preliminary fusion representation, deep power spectral density semantic features, and deep differential entropy semantic features into a multi-feature fusion module to obtain a fused feature vector, including: The preliminary fusion representation, deep power spectral density semantic features, and deep differential entropy semantic features are respectively used as the key vector, query vector, and value vector of the Transformer multi-head attention network. Perform a residual connection and normalization on the output of the multi-head attention network; The residual concatenation and normalized output are input into a circuit consisting of two layers of linear transformation and... The feedforward network formed by this network can be expressed by the following formula: ; in, Indicates a feedforward network. This represents the output of the first residual connection and normalization. , and , These represent the weights and biases of the two layers within the feedforward network. For activation functions; The output of the feedforward network is subjected to residual connections and layer normalization to obtain the fused feature vector.
8. The cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning according to claim 1, characterized in that, The construction of the multi-feature decision-maker involves inputting the fused feature vector into the multi-feature decision-maker to obtain the probability value of a sample belonging to the true category, including: The multi-feature decision maker consists of three fully connected layers and one Dropout layer. The fused feature vectors are sequentially processed through fully connected transformation, ReLU activation, Dropout regularization, a second fully connected transformation, ReLU activation, and a third fully connected transformation to obtain the final linear classification mapping. The function outputs a fatigue classification label, and the Softmax function outputs the probability value of the sample belonging to the true category.
9. The cross-individual EEG driving fatigue detection method based on multi-feature contrastive learning according to claim 1, characterized in that, The probability-based calculation of the fused feature vector prediction loss function is expressed by the following formula: ; in, This represents the loss function for predicting using fused feature vectors. The total number of samples, It is the first The true label of each sample Indicates the first The probability value of a sample belonging to the true category.
Citation Information
Cited By
Train driver gesture and fatigue driving multi-task fusion detection method and system
CN122176760A
