PSO-ACLSTM-based crew fatigue identification method

By combining the PSO-ACLSTM model with channel and self-attention mechanisms to optimize EEG signal features, the problem of the lack of consideration of channel and sample importance in crew fatigue identification is solved, the identification accuracy is improved, and the safe navigation of ships is ensured.

CN121101573APending Publication Date: 2025-12-12DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511482329.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-16
Publication Date
2025-12-12

AI Technical Summary

Technical Problem

Existing technologies fail to effectively consider the importance of different EEG channels and EEG samples in the analysis of crew members' EEG signals, resulting in overfitting during model training and insufficient recognition accuracy.

Method used

A PSO-ACLSTM-based method is adopted to extract EEG signal features through discrete wavelet transform. The hyperparameters of the model are optimized by combining channel attention mechanism, convolutional neural network and self-attention mechanism to improve recognition accuracy.

Benefits of technology

It improves the accuracy of crew fatigue identification, provides effective work and rest time recommendations for ship navigation safety, and reduces the risk of safety accidents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121101573A_ABST
    Figure CN121101573A_ABST
Patent Text Reader

Abstract

The invention discloses a crew fatigue identification method based on PSO-ACLSTM, which comprises the following steps: carrying out discrete wavelet transform on a preprocessed electroencephalogram signal, obtaining a prediction probability of an electroencephalogram signal sample by using an electroencephalogram classification algorithm model based on the transformed electroencephalogram signal, further obtaining a cross entropy error, and then adopting an improved particle swarm optimization algorithm module to identify the crew fatigue of the crew. And optimizing hyper-parameters in the electroencephalogram classification algorithm model, optimizing the electroencephalogram classification algorithm model, and further identifying the electroencephalogram signals of the crew needing fatigue identification based on the optimized electroencephalogram classification algorithm model. According to the method, relevance between channels and relevance between different samples can be extracted, the space and time characteristics of signals are further enriched, the accuracy of recognizing the fatigue state of the crew is improved, and crew fatigue state detection and safety accident prevention are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of ship safety technology, and in particular to a method for identifying crew fatigue based on PSO-ACLSTM. Background Technology

[0002] Crew fatigue detection is crucial for maritime traffic safety. However, extracting discriminative features for EEG fatigue detection remains challenging, and most methods tend to overlook useful channel and temporal information.

[0003] Extensive research has been conducted on EEG information processing and extraction. Examples include using discrete wavelet transform to extract EEG rhythms and deriving statistical features of each rhythm; using convolutional neural networks to extract spatial features and recurrent neural networks to extract temporal features; using compressed excitation networks to reduce channel size and thus reduce modeling complexity, demonstrating that integrating channel attention mechanisms into CNN networks can improve the overall model's detection performance; and integrating self-attention mechanisms into long short-term memory networks to model the dependencies between different locations in time-series data, assigning different weights to each element in the time series to study the importance of different EEG samples.

[0004] In the algorithms of the above-mentioned existing technologies, the importance of different EEG channels and different EEG samples in the crew's EEG data is not considered simultaneously when performing EEG signal analysis. Furthermore, the subjective randomness of manual selection during the training process is relatively high, which can easily lead to overfitting. Summary of the Invention

[0005] This invention discloses a method for identifying crew fatigue based on PSO-ACLSTM to overcome the aforementioned technical problems.

[0006] To achieve the above objectives, the technical solution of the present invention is as follows: A method for identifying crew fatigue based on PSO-ACLSTM includes the following steps: S1: Obtain raw EEG signal samples from crew members, perform preprocessing, and obtain preprocessed EEG signals; S2: Perform discrete wavelet transform on the preprocessed EEG signal to obtain the EEG signal after discrete wavelet transform; S3: Establish an EEG classification algorithm model to obtain the predicted probability of EEG signal samples; the EEG classification algorithm model includes a channel-based attention mechanism module, a convolutional neural network module, an LSTM module, and a self-attention mechanism module; S4: Obtain the cross-entropy error based on the predicted probability of the EEG signal sample; S5: Based on the cross-entropy error, the hyperparameters in the EEG classification algorithm model are optimized using the improved particle swarm optimization algorithm module to obtain the optimized EEG classification algorithm model; the hyperparameters include the learning rate, batch size, and the number of hidden layer neurons in the LSTM. S6: Based on the optimized EEG classification algorithm model, obtain the predicted probability of the EEG signals of crew members who need to be identified for fatigue detection, so as to identify the EEG signals of crew members who need to be identified for fatigue detection.

[0007] Furthermore, the formula used to obtain the cross-entropy error is as follows:

[0008]

[0009]

[0010] In the formula: The cross-entropy of the training set. This refers to the cross-entropy of the test set. This refers to the cross-entropy error returned to the particle swarm optimization algorithm; The number of samples in the training set; The number of samples in the test set; This represents the total number of samples; The training set sample number; The sample number in the test set; For the first Predicted probability of EEG samples in a test set sample; For the first The predicted probability of EEG samples in a training set sample; Refers to the first EEG sample labels in the training set samples; Refers to the first EEG sample labels in a test set.

[0011] Furthermore, the iterative formula for updating the particle swarm velocity in the improved particle swarm optimization algorithm module is expressed as follows:

[0012] In the formula: It is the first Individual particles The speed of time; It is inertial weight; It is the first Individual particles The speed of time; It is an individual learning factor. This refers to the global learning factor; and All are random factors between [0,1]; Indicates the first As of [date], [number] particles The optimal position is found at all times; It is the first Individual particles The position at that moment; Indicates the entire population up to The optimal position is found at all times; Indicates the index number of the particle; in,

[0013] In the formula: Indicates inertia weight; and These represent the maximum and minimum values ​​of the inertia weight, respectively. It is the maximum number of iterations. This is the current iteration number.

[0014] Furthermore, the method for obtaining the predicted probability of EEG signal samples is as follows: S31: Based on the EEG signal after discrete wavelet transform and the channel-type attention mechanism module, obtain the channel attention features of the EEG signal sample signal to obtain the EEG signal after channel transformation; S32: Based on the EEG signal after channel transformation, the convolutional neural network is used to obtain the final EEG signal after extracting spatial features; S33: Based on the EEG signal after the final extraction of spatial features, the LSTM module is used to obtain the EEG signal after the extraction of temporal features, so as to obtain the temporal feature vector of the EEG signal sample. S34: Based on the time feature vector of the EEG signal sample, the self-attention mechanism module is used to obtain the prediction probability of the EEG signal sample.

[0015] Furthermore, the method used to obtain the channel attention features of EEG sample signals is as follows: First, the average pooling vector of the EEG signal samples after discrete wavelet transform is obtained using the following formula:

[0016] In the formula: This represents the average pooling vector of the EEG signal sample after discrete wavelet transform. Indicates the first The first EEG sample The average value of each channel; Indicates the index number of the EEG sample; Index of channels representing EEG samples; This indicates the total number of channels in the EEG sample; Secondly, based on the average pooling vector of the EEG signal samples after discrete wavelet transform, the attention weight vector extracted from channel attention is obtained, using the following formula:

[0017] In the formula: This represents the attention weight vector extracted from channel attention. It is an activation function; This represents the weight matrix of the second fully connected layer; This represents the weight matrix of the first fully connected layer; This represents the bias vector of the first fully connected layer; This represents the bias vector of the second fully connected layer; This represents the average pooling vector of the EEG signal sample after discrete wavelet transform. Finally, based on the attention weight vector extracted from channel attention, the extracted first... The first EEG sample signal The formula used for each channel to focus on features is as follows:

[0018] In the formula: Indicates the extracted first The first EEG sample Pay attention to the characteristics of each channel; Indicates the first The first EEG sample One channel.

[0019] Furthermore, the method used to obtain the predicted probability of EEG samples is as follows: First, the attention feature score vector of the EEG sample signal is obtained using the following formula:

[0020] In the formula: Indicates the first The self-attention feature score vector of each EEG sample; It indicates the first Similarity function of individual EEG samples; It is the first Temporal feature vector of each EEG sample The alignment pattern vector generated by linear transformation has the same dimension as the feature vector. Indicates the first Temporal feature vectors of individual EEG samples; It is the activation function of the self-attention mechanism; express The weight matrix; , Both 2 are weight parameters. Indicates the first Bias vectors for individual EEG samples; Represents the bias matrix; Indicates transpose; Secondly, based on the attention feature score vector of the EEG sample signal, the probability distribution corresponding to the EEG sample is obtained, using the following formula: In the formula: Indicates the first Probability distribution of each EEG sample; Then, the features extracted by the attention mechanism module are obtained using the following formula:

[0021]

[0022] In the formula: Indicates the first Self-attention characteristics of individual EEG samples; This represents the features extracted by the self-attention mechanism module; Finally, the predicted probability of the EEG sample is obtained:

[0023] in, This represents the predicted probability set of EEG samples. Indicates the first The predicted probability of the category to which each EEG sample belongs; and These are the weight and bias terms of the softmax function, respectively.

[0024] Furthermore, the formula used for discrete wavelet transform of the preprocessed EEG signal is as follows:

[0025] In the formula: Represents the discrete wavelet transform result of the electroencephalogram (EEG) signal; It represents the number of times the filter was applied. It is the scaling factor that determines the wavelet's position; It is the scaling factor that determines the width and height of the wavelet; Represents absolute value; This represents a preprocessed EEG signal sample; These are wavelet basis functions; Indicates time; Represents an integer.

[0026] Beneficial Effects: This invention provides a PSO-ACLSTM-based method for identifying crew fatigue. It performs discrete wavelet transform on preprocessed EEG signals, and based on the transformed EEG signals, uses an EEG classification algorithm model to obtain the predicted probability of EEG signal samples, thereby acquiring the cross-entropy error. Then, an improved particle swarm optimization algorithm module is used to optimize the hyperparameters in the EEG classification algorithm model, thus optimizing the model. Finally, based on the optimized EEG classification algorithm model, the EEG signals of crew members requiring fatigue identification are identified. This invention considers the fact that different EEG channels and samples represent different information. By combining convolutional neural network and LSTM modules, it extracts the correlations between different channels and samples, further enriching the spatial and temporal features of the signal, thereby improving the accuracy of identifying crew fatigue states and providing corresponding suggestions for planning the work and rest times of crew members during ship navigation. This is beneficial for crew fatigue detection and the prevention of safety accidents. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 This is a flowchart of the crew fatigue identification method based on PSO-ACLSTM of the present invention; Figure 2 This is a schematic diagram of the 7-layer wavelet decomposition of the EEG signal in an embodiment of the present invention; Figure 3 This is a structural diagram of the PSO-ACLSTM model in an embodiment of the present invention; Figure 4 This is a schematic diagram of the PSO algorithm optimization process in an embodiment of the present invention; Figure 5 This is a schematic diagram of the internal structure of the LSTM network in an embodiment of the present invention; Figure 6 This is a schematic diagram showing the average accuracy of PSO-ACLSTM for 10 subjects in an embodiment of the present invention. Figure 7 This is a schematic diagram of the average channel weight on the fatigue database in an embodiment of the present invention; Figure 8 This is a schematic diagram of the decoding results of EEG signals extracted from a fatigue dataset with time windows of 0.5 s, 1.5 s, and 1 s in an embodiment of the present invention. Figure 9 This is a schematic diagram of the visualization results of the model in the embodiments of the present invention; Figure 10 This is a schematic flowchart of the crew fatigue identification method based on PSO-ACLSTM in an embodiment of the present invention. Detailed Implementation

[0029] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0030] This embodiment introduces a method for identifying crew fatigue based on PSO-ACLSTM, including the following steps: Figure 1 and Figure 10 As shown: S1: During the fatigue driving experiment, the raw EEG signal samples of the crew members were obtained and preprocessed to obtain the preprocessed EEG signals. Specifically, in this embodiment, a crew fatigue driving experiment was conducted on the Yu Kun ship at Dalian Maritime University to obtain raw EEG signal samples from the crew and perform preprocessing. Specifically, in this embodiment, the EEGLAB toolbox is used to preprocess the raw EEG signal sequentially with 50Hz notch filtering, 1Hz high-pass filtering, and 40Hz low-pass filtering. Next, Independent Component Analysis (ICA) is used to remove artifacts such as eye movement and heartbeat from the raw EEG signal. Finally, the EEG signal is checked for significant baseline shifts, and data segments with large baseline shifts and artifacts are manually removed.

[0031] Specifically, in this embodiment, 30 electrode channels from 10 pre-processed subjects were selected as research electrodes. A total of 18 minutes of stable raw EEG signals were acquired for each subject, with each segment of the EEG signal lasting 6 minutes. The acquired data were categorized into two types: alert and fatigued, based on the KSS scale. Then, using a 1-second interval time window, the signals were divided into non-overlapping samples, resulting in a total of 10*3*360 EEG signal samples (10 subjects, 3 time periods, and 360 time windows). Each EEG signal sample was represented as a 30*500 matrix (30 channels, each channel including 500 sampling points).

[0032] S2: Perform discrete wavelet transform on the preprocessed EEG signal to obtain the EEG signal after discrete wavelet transform; Specifically, after preprocessing the raw EEG signals of the crew members, the Discrete Wavelet Transform (DWT) was selected as the method. The method described above extracts the rhythm from the preprocessed EEG signal and performs a 7-level discrete wavelet transform decomposition on the EEG signal. The formula used for the discrete wavelet transform of the preprocessed EEG signal is as follows: (1) In the formula: Represents the discrete wavelet transform result of the electroencephalogram (EEG) signal; It represents the number of times the filter was applied. It is the scaling factor that determines the wavelet's position; It is the scaling factor that determines the width and height of the wavelet; Represents absolute value; This represents a preprocessed EEG signal sample; For wavelet basis functions, this embodiment selects the Daubechies (dbN) wavelet basis function. In the dbN wavelet basis function, N is the order of the wavelet, which is 7 in this embodiment. db is the abbreviation for Daubechies discrete orthogonal wavelet function. Indicates time; Represents an integer; In this embodiment, the sub-band signals obtained after wavelet transform are as follows: Figure 2 As shown. Figure 2 middle, and These are a high-pass filter and a low-pass filter, respectively. Where CA represents the approximation coefficient, CD represents the detail coefficient, CA7 falls exactly within the Delta wave range (0.2~4Hz), CD7 is within the Theta wave range (4~7Hz), CD6 is within the Alpha wave range (7~13Hz), CD5 corresponds to the Beta wave frequency (13~34Hz), and CD4 corresponds to the Gamma wave frequency (greater than 34Hz).

[0033] Five statistical features were extracted from each subband: differential entropy, maximum value, minimum value, root mean square, and mean value. These features were then concatenated to form the final feature vector, which is 25-dimensional for each EEG sample. This vector was used as the input signal for the classification model.

[0034] Next, the EEG signal samples (i.e., the final feature vectors) were divided into training and test sets, and then 10-fold cross-validation was used. This involved dividing the data into 10 equal subsets, with one subset used as the test set and the other nine subsets forming the training set. This process was repeated 10 times. For the data in this embodiment, each subject had 972 training samples and the remaining 108 samples were used as test samples.

[0035] S3: Establish an EEG classification algorithm model to obtain the predicted probability of EEG signal samples; the EEG classification algorithm model includes a channel-based attention mechanism module, a convolutional neural network module (CNN), an LSTM module, and a self-attention mechanism module; Specifically, the EEG classification algorithm model includes a channel-based attention mechanism module, a CNN, an LSTM module, and an attention mechanism module. The overall structure of the PSO-ACLSTM model in this embodiment is as follows: Figure 3 As shown. First, the model parameters of the ACLSTM model are initialized, and the ACLSTM model is initially trained using the input set.

[0036] S31: Based on the EEG signal after discrete wavelet transform and the channel-type attention mechanism module, obtain the channel attention features of the EEG signal sample signal to obtain the EEG signal after channel transformation; Specifically, Figure 3 The left side shows the spatial feature extraction module. In actual EEG signal acquisition, different EEG channels in multi-channel devices often contain redundant or irrelevant information. To improve the accuracy and efficiency of fatigue recognition and reduce signal processing time and cost, a channel-based attention mechanism is first applied to the EEG signal. This allows information from all channels to be considered simultaneously, and weights are assigned to different channels according to their importance. In the framework of the PSO-ACLSTM model in this embodiment, average pooling is first performed on each channel of the discrete wavelet transform EEG sample to obtain the channel weights, as shown below: (2) In the formula: This represents the average pooling vector of the EEG signal sample after discrete wavelet transform. Indicates the first The first EEG sample The average value of each channel; Indicates the index number of the EEG sample; Index of channels representing EEG samples; This indicates the total number of channels in the EEG sample; Specifically, to reduce model complexity and improve generalization, the channel-based attention mechanism module in this embodiment adds two fully connected (FC) layers before and after the nonlinear activation function, namely: one with parameters of and bias terms The dimensionality reduction layer has a dimensionality reduction ratio of . The activation function is The function; the other is a function with parameters. and The dimension-adding layer. Therefore, the gating mechanism of channel-based attention is described as follows: (3) In the formula: This represents the attention weight vector extracted from channel attention. It is an activation function; This represents the weight matrix of the second fully connected layer; This represents the weight matrix of the first fully connected layer; This represents the bias vector of the first fully connected layer; This represents the bias vector of the second fully connected layer; This represents the average pooling vector of the EEG signal sample after discrete wavelet transform. Specifically, The activation function transforms the importance of channels into a probability distribution. , Indicates the first The probability distribution corresponding to each channel represents the importance of different channels. Subsequently, the probabilities are used as weights to re-encode the information from the EEG samples of each channel. Therefore, the information extracted through the channel-based attention mechanism... The attention channel features are represented as follows: (4) In the formula: Indicates the extracted first The first EEG sample Pay attention to the characteristics of each channel; Indicates the first The first EEG sample One channel; This represents the attention weight vector extracted from channel attention. S32: Based on the EEG signal after channel transformation, the convolutional neural network (CNN) is used to extract spatial features from the EEG signal to obtain the final EEG signal after extracting spatial features. Specifically, after channel transformation of the EEG signal, CNN is used to further extract the spatial information of the EEG signal. The Exponential Linear Unit (ELU) function is used as the activation function in the convolution operation. Therefore, after convolution and activation operations, from the first... Individual channel attention features The first Spatial features .

[0037] Next, pooling layers are used to reduce the number of parameters and further extract features. After pooling, the... The spatial characteristics of an EEG signal are represented as follows: .

[0038] in, This indicates the final extraction result of the CNN network. Spatial characteristics of individual EEG samples; This represents the max pooling operation; This represents the spatial features obtained after convolution and activation operations in a CNN network. This represents the total number of EEG samples; To facilitate understanding of the temporal feature extraction operations of LSTM, the spatial features obtained by CNN networks are... Renumbered Furthermore, since the division of each EEG sample is strictly based on chronological order, the sample numbering also follows chronological order; the order and number of data remain unchanged before and after renumbering. However, the meaning changes. This represents the spatial characteristics at time t.

[0039] S33: Based on the final EEG signal after extracting spatial features, the LSTM module is used to extract the temporal features of the EEG signal to obtain the EEG signal after extracting the temporal features, so as to obtain the temporal feature vector of the EEG signal sample. Specifically, Figure 3 The right side of the structure diagram shows the time feature extraction module, which consists of a two-layer LSTM module and a self-attention mechanism. The LSTM module can learn contextual information from time-series data, enabling it to learn features from time-dependent EEG data. For example... Figure 5 As shown, an LSTM unit needs to accept three inputs: the input of the LSTM model at the current time t. The cell state at time t-1 And representing the hidden state at time t-1. Next, the LSTM unit outputs two values: the current time. Cell state and current time LSTM output value An LSTM unit contains three gates: the input gate, the forget gate, and the output gate, controlled by sigmoid and tanh activation functions. Although the training and test datasets are temporally different and discontinuous, the encoded samples contain spatial information after passing through the spatial feature extraction module. Simultaneously, the input gate weights contain spatial information, and the forget gate weights contain temporal information. The input and forget gates respectively input new information into the unit or retain the current temporal information, thus fully extracting spatiotemporal features.

[0040] The model has 2 LSTM layers. The t-th output of the LSTM network is the hidden state of the second recursive layer. ;in, Indicates the first One time feature vector; Indicates the functions used by the LSTM module; S34: Based on the time feature vector of the EEG signal sample, the self-attention mechanism module is used to obtain the prediction probability of the EEG signal sample.

[0041] Specifically, to delve deeper into the distinctive features of EEG data over time, the model incorporates a self-attention mechanism. Weights are assigned to each EEG signal sample by exploring the intrinsic importance of each sample.

[0042] Specifically, after obtaining the EEG signal with extracted time features, the attention feature score vector of the EEG sample signal is obtained. Furthermore, the model's self-attention mechanism module adds two bias terms, one inside and one outside the activation function. Attention feature score vector of each EEG sample It is expressed as follows: (5) In the formula: Indicates the first The self-attention feature score vector of each EEG sample; It indicates the first Similarity function of individual EEG samples; It is the first Temporal feature vector of each EEG sample The alignment pattern vector generated by linear transformation has the same dimension as the feature vector. Indicates the first Temporal feature vectors of individual EEG samples; It is the activation function of the self-attention mechanism; express The weight matrix; , Both 2 are weight parameters. Indicates the first Bias vectors for individual EEG samples; Represents the bias matrix; This indicates transpose; the activation function used here is the Exponential Linear Unit (ELU).

[0043] also, This represents the probability distribution corresponding to each EEG sample, the th... The probability distribution of each EEG sample is represented as follows: (6) In the formula: Indicates the first Probability distribution of each EEG sample; at last, This represents the features extracted by the self-attention mechanism module, specifically the extracted first... The self-attention characteristics of each EEG sample are calculated using the following formula: (7) In the final part of the PSO-ACLSTM framework, a softmax layer is used as a classifier to extract the self-attention features of the EEG samples. The softmax classifier receives these extracted features as input to identify fatigue states, as shown below: (8) in, This represents the predicted probability set of EEG samples. Indicates the first The predicted probability of the category to which each EEG sample belongs; and These are the weight and bias terms of the softmax function, respectively.

[0044] S4: Obtain the cross-entropy error based on the predicted probability of the EEG signal sample; Preferably, the formula used to obtain the cross-entropy error is as follows: (9) (10) (11) In the formula: The cross-entropy of the training set. This refers to the cross-entropy of the test set. This refers to the cross-entropy error returned to the particle swarm algorithm, which is also used as a basis for fatigue identification accuracy. The number of samples in the training set; The number of samples in the test set; This represents the total number of samples; The training set sample number; The sample number in the test set; For the first Predicted probability of EEG samples in a test set sample; For the first The predicted probability of EEG samples in a training set sample; Refers to the first EEG sample labels in the training set samples; Refers to the first EEG sample labels in a test set.

[0045] Specifically, cross-entropy error The smaller the value, the higher the accuracy of fatigue recognition. The cross-entropy error value is calculated. Then, it is returned to the particle swarm optimization algorithm as the basis for optimization.

[0046] S5: Based on the cross-entropy error, the hyperparameters in the ACLSTM model are optimized using the improved particle swarm optimization algorithm module to obtain an optimized EEG classification algorithm model; the hyperparameters include the learning rate, batch size, and the number of neurons in the hidden layer of the LSTM. Preferably, the iterative formula for updating the particle swarm velocity in the improved particle swarm optimization algorithm module is expressed as follows: (12) In the formula: It is the first Individual particles The speed of time; It is inertial weight; It is the first Individual particles The speed of time; It is an individual learning factor. This refers to the global learning factor, which is set to 0.5 here to balance the algorithm's local and global search capabilities. and All are random factors between [0,1]; Indicates the first As of [date], [number] particles The optimal position found at any given time (individual optimal); It is the first Individual particles The position at that moment; Indicates the entire population up to The optimal position found at any given time (global optimal); Indicates the index number of the particle; The inertia weight is: (13) In the formula: Indicates inertia weight; and These represent the maximum and minimum values ​​of the inertia weight, respectively. It is the maximum number of iterations. This is the current iteration number.

[0047] In this embodiment, the population size is set to 30, and the maximum number of iterations is set to 40. The learning rate range is set to [1e-5, 2e-3], and the batch size range is [32, 64]. The position and velocity information of the population are randomly initialized, and each particle represents a potential combination of ACLSTM parameters to prepare for finding the globally optimal hyperparameters of the attention-based convolutional recurrent network model (ACLSTM). There are three hyperparameters to be optimized (including: learning rate, batch size, and the number of hidden layer neurons in each LSTM).

[0048] Based on the current iteration count, this embodiment calculates the inertia weight using the linearly decreasing inertia weight formula in the improved particle swarm optimization algorithm. According to the inertia weight and the particle swarm velocity update formula, the position and velocity of each particle are calculated and updated. The updated position and velocity of each particle are used as a new parameter combination for the ACLSTM model, and the cross-entropy function is recalculated; this process continues until the maximum iteration count is reached. Based on the cross-entropy function calculation results, the globally optimal position is selected as the optimal parameter combination for the ACLSTM model. The PSO algorithm optimization process is as follows: Figure 4 As shown.

[0049] Based on the obtained training and test set data, the optimized ACLSTM model is trained and used for data prediction, and the predictive performance of the fatigue detection model is verified.

[0050] In this embodiment, the PSO-ACLSTM model is implemented using the PyTorch framework. The Adam optimizer is used to minimize the cross-entropy loss function, and dropout regularization is set to 0.5. Batch normalization is employed to achieve better performance during training. The convolutional kernel height is set to 3, the width to 5, and the stride to 1. The pooling layer size is... 0, step size is 3.

[0051] S6: Based on the optimized EEG classification algorithm model, obtain the predicted probability of the EEG signals of crew members who need to be identified for fatigue detection, so as to identify the EEG signals of crew members who need to be identified for fatigue detection.

[0052] Specifically, Figure 6As can be seen, the PSO-ACLSTM model in this embodiment is stable across the entire dataset, with all accuracies exceeding 85%. The average accuracy is 91.08%, and the standard deviation (STD) is 3.17%. Three subjects showed significant differences in accuracy compared to the average. Besides factors beyond our control, these differences in accuracy may be attributed to the subjects' physical condition and the ship's cockpit environment. Reviewing the recorded experimental videos revealed that the fourth and sixth subjects exhibited mild fatigue at the start of the experiment but reported fatigue 10 minutes after the onset of symptoms. The eighth subject remained almost alert throughout the experiment but reported mild fatigue half an hour before its end. These three subjects did not adequately report the degree of subjective fatigue, which contributed to their lower accuracy in fatigue identification. These results suggest that subjects should be reminded to report their actual physical condition during the experiment. Figure 6 The results demonstrate that the method of this embodiment has a strong ability to learn effective information from EEG samples for crew fatigue identification.

[0053] To further analyze the contribution of channel attention, channel weights of EEG signals from a channel attention meter were used. Figure 7 The average channel weights in the dataset of this embodiment are displayed. Figure 7 The results showed that the channel weights on the EEG channels F3, FC5, P3, and C4 were significantly higher than those on other channels. This result is consistent with other studies. The higher channel weights also indicate that the given channels are more associated with fatigue and are more important in EEG signals.

[0054] Furthermore, decoding EEG signals involves analyzing and interpreting brain electrical activity recorded in specific time patterns. The choice of decoding time period affects the information extracted from the EEG signal. To explore the impact of time period selection, experiments were conducted on EEG signals extracted from different time periods. Window durations of 0.5 s and 1.5 s were used to extract and decode EEG signals. Because the model's classification accuracy is rarely affected by window increments, a fixed overlapping increment window of 1 s was used for all tests.

[0055] Figure 8 This paper presents the results of decoding EEG signals extracted from different time periods on a crew member EEG dataset. It can be seen that this embodiment achieves better performance when decoding EEG signals extracted within a 1-second time window. Furthermore, a t-test was performed, and the results showed a significant difference (p<0.05) in the average accuracy across the three time windows. In summary, the 1-second time window is more suitable for this model and has a more favorable impact on fatigue detection research.

[0056] The experimental results of this model on the dataset used were visualized and analyzed using a confusion matrix, such as... Figure 9 As shown in the figure, the horizontal axis represents the model's validation results on the test set, and the vertical axis represents the actual labels. The figure shows that the alert state is easier to identify than the fatigued state, and the feature information of the fatigued state is easily confused. This is also related to the relatively limited fatigued state data during the experiment. However, overall, the recognition results in both states demonstrate the model's superior performance.

[0057] Specifically, the basic idea of ​​this embodiment is to simultaneously integrate channel-based and self-attention mechanisms into CNN-LSTM, and introduce the PSO parameter optimization method to efficiently and accurately extract the spatial and temporal features of EEG signals (as follows). Figure 1 (As shown). First, the preprocessed EEG signal data is divided into training samples and test samples. Second, the proposed EEG classification algorithm model PSO-ACLSTM is trained using the training samples, the cross-entropy loss is calculated, and the network parameters are updated using particle swarm optimization. Finally, the trained fatigue recognition model is validated using test samples, and the classification accuracy is used as the final criterion for judging the model.

[0058] This embodiment employs an optimized particle swarm optimization-based electroencephalogram (EEG) classification algorithm model (PSO-ACLSTM) to rapidly extract effective discriminative features from EEG signals, improving the accuracy of fatigue identification. First, a channel attention mechanism is used to adaptively allocate weights for different EEG channels, and a CNN is used to extract spatial information from the EEG signals. Second, a self-attention mechanism is integrated into an LSTM to extract temporal information from different EEG samples. Finally, the obtained spatiotemporal attention features are used for crew fatigue identification. Simultaneously, a particle swarm optimization algorithm is used to adjust the hyperparameters of the neural network training to find the optimal parameters. This model leverages the advantages of multiple algorithm fusions to extract more comprehensive crew fatigue-related information, which is beneficial for crew fatigue detection and safety accident prevention.

[0059] This embodiment presents an end-to-end deep learning method for EEG fatigue recognition, rationally considering and utilizing the spatial, temporal, and attentional information of EEG signals. Channel-based attention is integrated into a CNN to extract attentional information between EEG channels, and further spatial attention features are extracted. Self-attention is also integrated into an LSTM to extract attention information based on the importance of each sample. Furthermore, considering the subjective randomness in selecting model hyperparameters, the PSO parameter optimization method is introduced to select the optimal parameters. The method scientifically and effectively extracts fatigue-related features of crew members, ultimately improving the accuracy of fatigue state recognition. This method can solve the problem of insufficient and unreasonable information extraction in previous fatigue recognition models, and is expected to significantly improve navigation safety and crew health. On the one hand, it can better help captains understand the fatigue status of the entire team, plan the work and rest time of crew members, improve work quality and efficiency, and ensure safe navigation. On the other hand, it can also prevent potential occupational health problems among crew members.

[0060] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for identifying crew fatigue based on PSO-ACLSTM, characterized in that, Includes the following steps: S1: Obtain raw EEG signal samples from crew members, perform preprocessing, and obtain preprocessed EEG signals; S2: Perform discrete wavelet transform on the preprocessed EEG signal to obtain the EEG signal after discrete wavelet transform; S3: Establish an EEG classification algorithm model to obtain the predicted probability of EEG signal samples; the EEG classification algorithm model includes a channel-based attention mechanism module, a convolutional neural network module, an LSTM module, and a self-attention mechanism module; S4: Obtain the cross-entropy error based on the predicted probability of the EEG signal sample; S5: Based on the cross-entropy error, the hyperparameters in the EEG classification algorithm model are optimized using the improved particle swarm optimization algorithm module to obtain the optimized EEG classification algorithm model; the hyperparameters include the learning rate, batch size, and the number of hidden layer neurons in the LSTM. S6: Based on the optimized EEG classification algorithm model, obtain the predicted probability of the EEG signals of crew members who need to be identified for fatigue detection, so as to identify the EEG signals of crew members who need to be identified for fatigue detection.

2. The method for identifying crew fatigue based on PSO-ACLSTM according to claim 1, characterized in that, The formula used to obtain the cross-entropy error is as follows: In the formula: The cross-entropy of the training set. This refers to the cross-entropy of the test set. This refers to the cross-entropy error returned to the particle swarm optimization algorithm; The number of samples in the training set; The number of samples in the test set; This represents the total number of samples. The training set sample number; The sample number in the test set; For the first Predicted probability of EEG samples in a test set sample; For the first The predicted probability of EEG samples in a training set sample; Refers to the first EEG sample labels in the training set samples; Refers to the first EEG sample labels in a test set.

3. The method for identifying crew fatigue based on PSO-ACLSTM according to claim 1, characterized in that, The iterative formula for updating the particle swarm velocity in the improved particle swarm optimization algorithm module is expressed as follows: In the formula: It is the first Individual particles The speed of time; It is inertial weight; It is the first Individual particles The speed of time; It is an individual learning factor. This refers to the global learning factor; and All are random factors between [0,1]; Indicates the first As of [date], [number] particles The optimal position is found at all times; It is the first Individual particles The position at that moment; Indicates the entire population up to The optimal position is found at all times; Indicates the index number of the particle; in, In the formula: Indicates inertia weight; and These represent the maximum and minimum values ​​of the inertia weight, respectively. It is the maximum number of iterations. This is the current iteration number.

4. The method for identifying crew fatigue based on PSO-ACLSTM according to claim 1, characterized in that, The method for obtaining the predicted probability of EEG signal samples is as follows: S31: Based on the EEG signal after discrete wavelet transform and the channel-type attention mechanism module, obtain the channel attention features of the EEG signal sample signal to obtain the EEG signal after channel transformation; S32: Based on the EEG signal after channel transformation, the convolutional neural network is used to obtain the final EEG signal after extracting spatial features; S33: Based on the EEG signal after the final extraction of spatial features, the LSTM module is used to obtain the EEG signal after the extraction of temporal features, so as to obtain the temporal feature vector of the EEG signal sample. S34: Based on the time feature vector of the EEG signal sample, the self-attention mechanism module is used to obtain the prediction probability of the EEG signal sample.

5. The method for identifying crew fatigue based on PSO-ACLSTM according to claim 4, characterized in that, The method used to obtain the channel attention features of EEG sample signals is as follows: First, the average pooling vector of the EEG signal samples after discrete wavelet transform is obtained using the following formula: In the formula: This represents the average pooling vector of the EEG signal sample after discrete wavelet transform. Indicates the first The first EEG sample The average value of each channel; Indicates the index number of the EEG sample; Index of channels representing EEG samples; This indicates the total number of channels in the EEG sample; Secondly, based on the average pooling vector of the EEG signal samples after discrete wavelet transform, the attention weight vector extracted from channel attention is obtained, using the following formula: In the formula: This represents the attention weight vector extracted from channel attention. It is an activation function; This represents the weight matrix of the second fully connected layer; This represents the weight matrix of the first fully connected layer; This represents the bias vector of the first fully connected layer; This represents the bias vector of the second fully connected layer; This represents the average pooling vector of the EEG signal sample after discrete wavelet transform. Finally, based on the attention weight vector extracted from channel attention, the extracted first... The first EEG sample signal The formula used for each channel to focus on features is as follows: In the formula: Indicates the extracted first The first EEG sample Pay attention to the characteristics of each channel; Indicates the first The first EEG sample One channel.

6. The method for identifying crew fatigue based on PSO-ACLSTM according to claim 5, characterized in that, The method used to obtain the predicted probability of EEG samples is as follows: First, the attention feature score vector of the EEG sample signal is obtained using the following formula: In the formula: Indicates the first The self-attention feature score vector of each EEG sample; It indicates the first Similarity function of individual EEG samples; It is the first Temporal feature vector of each EEG sample The alignment pattern vector generated by linear transformation has the same dimension as the feature vector. Indicates the first Temporal feature vectors of individual EEG samples; It is the activation function of the self-attention mechanism; express The weight matrix; , Both 2 are weight parameters. Indicates the first Bias vectors for individual EEG samples; Represents the bias matrix; Indicates transpose; Secondly, based on the attention feature score vector of the EEG sample signal, the probability distribution corresponding to the EEG sample is obtained, using the following formula: In the formula: Indicates the first Probability distribution of each EEG sample; Then, the features extracted by the attention mechanism module are obtained using the following formula: In the formula: Indicates the first Self-attention characteristics of individual EEG samples; This represents the features extracted by the self-attention mechanism module; Finally, the predicted probability of the EEG sample is obtained: in, This represents the predicted probability set of EEG samples. Indicates the first The predicted probability of the category to which each EEG sample belongs; and These are the weight and bias terms of the softmax function, respectively.

7. The method for identifying crew fatigue based on PSO-ACLSTM according to claim 1, characterized in that, The formula used for performing discrete wavelet transform on the preprocessed EEG signal is as follows: In the formula: Represents the discrete wavelet transform result of the electroencephalogram (EEG) signal; It represents the number of times the filter was applied. It is the scaling factor that determines the wavelet's position; It is the scaling factor that determines the width and height of the wavelet; Represents absolute value; This represents a preprocessed EEG signal sample; These are wavelet basis functions; Indicates time; Represents an integer.