A kind of fatigue detection method, system, device and medium based on cuckoo algorithm
By using an improved Cuckoo algorithm for fatigue detection, this method selects features and configures classifiers for EEG signals, solving the problems of high computational complexity and low detection accuracy caused by feature redundancy in existing technologies, and achieving efficient and accurate fatigue detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- STATE GRID ZHEJIANG ELECTRIC POWER CO LTD
- Filing Date
- 2026-02-28
- Publication Date
- 2026-06-09
AI Technical Summary
Existing fatigue detection methods based on EEG signals suffer from high computational complexity and reduced classifier performance due to the large number of features extracted, which are often redundant or correlated, thus affecting detection accuracy.
A fatigue detection method based on the Cuckoo algorithm is adopted. Multi-dimensional feature extraction is performed on EEG signal data to construct an original feature pool. The improved Cuckoo algorithm is then used to jointly iteratively optimize the binary feature mask vector and the initial hyperparameters of the classifier. Feature subsets are selected and the classifier is configured to construct a fatigue detection model.
It improves the accuracy and efficiency of fatigue detection, ensures operational safety and work efficiency, enhances the model's discrimination and generalization capabilities, reduces interference from redundant features, dynamically adjusts feature selection paths and hyperparameter configurations, and balances model complexity and recognition performance.
Smart Images

Figure CN122163214A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of fatigue detection technology, specifically to a fatigue detection method, system, device, and medium based on the Cuckoo algorithm. Background Technology
[0002] As various industries increasingly prioritize workplace safety, real-time monitoring and early warning of worker fatigue have become crucial for ensuring production safety. Electroencephalogram (EEG) signals, as important physiological indicators reflecting the activity of the human central nervous system, can directly reflect changes in the degree of fatigue; therefore, fatigue detection methods based on EEG signals have been widely applied.
[0003] Current technologies typically extract various types of features, such as time-domain features and frequency-domain features, from acquired electroencephalogram (EEG) signals. A classifier is then used to categorize these extracted features to determine the individual's fatigue state. To improve classification accuracy, a large number of features are often extracted to comprehensively characterize the EEG signals.
[0004] However, due to the large number of extracted features and the redundancy or correlation between different features, this not only increases the computational complexity but may also lead to a decline in classifier performance, making it difficult to guarantee the optimality of the selection results and thus affecting the accuracy of fatigue detection. Summary of the Invention
[0005] This application provides a fatigue detection method, system, device, and medium based on the Cuckoo algorithm, which solves the technical problems of high computational complexity and decreased classifier performance in current fatigue detection methods based on electroencephalogram (EEG) signals due to the large number of extracted features and the redundancy or correlation between features, thereby improving the accuracy of fatigue detection.
[0006] The first aspect of this application provides a fatigue detection method based on the cuckoo algorithm, the method comprising: The brainwave signal data of the person to be tested is acquired, and feature extraction is performed on the brainwave signal data to obtain an original feature pool, which includes multiple signal features. Individuals to be optimized are randomly generated based on the original feature pool. Each individual to be optimized includes a binary feature mask vector in the original feature pool and initial hyperparameters for configuring a preset classifier. The binary feature mask vector includes a binary feature mask value corresponding to each signal feature. The binary feature mask value is used to characterize the feature selection state of the signal feature. Based on the preset improved cuckoo algorithm, the binary feature mask vectors of multiple individuals to be optimized and the initial hyperparameters are jointly iteratively optimized to obtain the target detection individual, wherein the target detection individual includes the target binary feature mask vector and the target hyperparameters; A feature subset is determined based on the target binary feature mask vector, and a fatigue detection model is constructed based on the feature subset and the target hyperparameter configuration classifier. The electroencephalogram (EEG) signal data is input into the fatigue detection model to obtain the fatigue index; An early warning signal is generated based on the fatigue index.
[0007] Optionally, feature extraction is performed on the electroencephalogram (EEG) signal data to obtain an original feature pool, specifically including: The EEG signal data is subjected to bandpass filtering and power frequency notch filtering to obtain a filtered signal; The filtered signal is divided into multiple time windows according to a preset time length, and the mean, variance, peak-to-peak value, zero crossover rate, waveform length and Hjorth parameter of the filtered signal in each time window are determined as time-domain features. The filtered signal is divided into frequency bands δ, θ, α, β, and γ, and the absolute spectral power, relative spectral power, spectral entropy, and edge frequency of each frequency band are calculated to obtain the frequency domain characteristics. The sample entropy, permutation entropy, approximate entropy, and Lempel-Ziv complexity of the filtered signal are determined as nonlinear features; The connectivity characteristics are obtained by calculating the coherence, phase lock value, and transfer entropy between signals from different channels within each time window. The time-domain features, frequency-domain features, nonlinear features, and connectivity features are combined to form the original feature pool.
[0008] Optionally, before performing joint iterative optimization of the binary feature mask vector and the initial hyperparameters of the individual to be optimized based on the preset improved cuckoo algorithm to obtain the target detection individual, the method further includes: Calculate the importance score of the signal features in the original feature pool, and determine the signal features whose importance score is greater than a preset importance threshold as key features; The preset improved cuckoo algorithm is constructed based on the key features and the standard cuckoo algorithm.
[0009] Optionally, the preset improved cuckoo algorithm is constructed based on the key features and the standard cuckoo algorithm, specifically including: The first improved cuckoo algorithm is obtained by replacing the single-objective fitness function of the standard cuckoo algorithm with a preset multi-objective fitness function. In the first improved cuckoo algorithm, a feature selection constraint is set to ensure that the selection ratio of the key features during the joint iterative optimization process is less than or equal to the preset retention rate, thus obtaining the second improved cuckoo algorithm. In the joint iterative optimization process of the second improved cuckoo algorithm, the first preset repair strategy and the second preset repair strategy are executed alternately based on the preset repair strategy to obtain the preset improved cuckoo algorithm.
[0010] Optionally, a preset multi-objective fitness function is provided, which includes: Where J(x) is the preset multi-objective fitness function, and x is the individual to be optimized. The classification accuracy score of the signal features is given by |S| / N, where |S| is the feature size coefficient, |S| is the number of selected features, N is the total number of features in the original feature pool, Stab is the feature group stability score, which is the Bootstrap-Jaccard index, Latency(S) is the latency score, and α, β, γ, δ and η are preset weight coefficients.
[0011] Optionally, the target detection individual is obtained by jointly iteratively optimizing the binary feature mask vector of the individual to be optimized and the initial hyperparameters based on a preset improved cuckoo algorithm, specifically including: Initialize a group of individuals to be optimized, wherein the group of individuals to be optimized includes multiple individuals to be optimized; The following operations are performed repeatedly within a preset number of iterations, and the loop terminates when the number of iterations equals the preset number of iterations or when the updated group of individuals to be optimized meets the preset termination iteration condition: Based on the Levy flight mechanism of the preset improved cuckoo algorithm, the binary feature mask vector and the initial hyperparameters of each individual to be optimized are perturbed to obtain multiple first target individuals to be optimized; Based on a preset redundancy suppression operator, the binary feature mask value corresponding to the redundant features in multiple first target individuals to be optimized is modified to zero, and the binary feature mask value corresponding to the filler signal feature in the original feature pool is modified to one, thereby obtaining multiple second target individuals to be optimized. The filler signal feature is the signal feature that has the same feature type as the redundant feature but a different feature channel and the highest correlation with the redundant feature among the signal features that were not selected in the target individuals to be optimized except for the redundant feature. Based on a preset group / hierarchical crossover operator, multiple individuals to be optimized for the second target are combined to obtain candidate optimized individuals. Then, the candidate optimized individuals are subjected to feasibility repair based on preset feature selection constraints to obtain the first target candidate optimized individuals. Based on a preset repair strategy cycle, the first preset repair strategy and the second preset repair strategy are alternately executed on the first target candidate optimization individual to obtain the second target candidate optimization individual; The population of individuals to be optimized is updated based on the preset multi-objective fitness function to obtain the updated population of individuals to be optimized. When the number of iterations equals the preset number of iterations or the updated group of individuals to be optimized meets the preset termination iteration condition, the individual with the lowest fitness in the updated group of individuals to be optimized is determined as the target detection individual.
[0012] Optionally, the group of individuals to be optimized is updated based on the preset multi-objective fitness function to obtain an updated group of individuals to be optimized, specifically including: The candidate fitness of the second target candidate optimization individual is calculated according to the preset multi-objective fitness function; The candidate fitness is compared with the target fitness of the individual to be optimized corresponding to the second target candidate optimization individual in the individual to be optimized group. If the candidate fitness is less than the target fitness, the individual to be optimized corresponding to the second target candidate optimization individual in the individual to be optimized group is replaced with the second target candidate optimization individual to obtain the updated individual to be optimized group.
[0013] Secondly, embodiments of this application provide a fatigue detection system based on the Cuckoo algorithm. The fatigue detection system based on the Cuckoo algorithm includes: one or more processors and a memory; the memory is coupled to the one or more processors and is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the fatigue detection system based on the Cuckoo algorithm to perform the method described in the first aspect and any possible implementation thereof.
[0014] Thirdly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a fatigue detection system based on the cuckoo algorithm, cause the fatigue detection system based on the cuckoo algorithm to perform the method described in the first aspect and any possible implementation thereof.
[0015] Fourthly, embodiments of this application provide a computer program product containing instructions that, when the computer program product is run on a fatigue detection system based on the cuckoo algorithm, cause the fatigue detection system based on the cuckoo algorithm to perform the method described in the first aspect and any possible implementation thereof.
[0016] In summary, one or more technical solutions provided in this application have at least the following technical effects or advantages: 1. By extracting multi-dimensional features from EEG signal data, a rich original feature pool was constructed, providing a comprehensive data foundation for subsequent modeling. Addressing the potential for redundant and strongly correlated features in the original feature pool, an individual model to be optimized was constructed, containing a binary feature mask vector and initial hyperparameters for the classifier. The binary feature mask vector precisely controls the selection of each signal feature in the final model, while the hyperparameters adjust the classifier's performance. Subsequently, a pre-designed improved Cuckoo algorithm was used for joint iterative optimization of multiple individuals to be optimized. During the optimization process, the global optimality of feature selection and classifier hyperparameter configuration was considered simultaneously, improving the discriminative and generalization abilities of the model corresponding to the target detection individual. A feature subset was determined using the target binary feature mask vector, and combined with the target hyperparameters to construct an optimized fatigue detection model, achieving efficient extraction and accurate discrimination of fatigue state information from EEG signals. The detection results are output in the form of a fatigue index, effectively ensuring the operational safety and efficiency of workers and improving the accuracy of fatigue detection.
[0017] 2. By calculating the importance scores of each signal feature in the original feature pool and selecting key features with importance scores greater than a preset importance threshold, the feature space is preliminarily compressed and ranked in terms of value. This effectively reduces the interference of redundant features on the subsequent optimization process, improving optimization efficiency and stability. Based on the key features, a preset improved cuckoo algorithm is constructed. By replacing the single-objective fitness function in the standard cuckoo algorithm with a preset multi-objective fitness function, and comprehensively considering performance indicators such as model accuracy, feature subset size, and computational cost, a first improved cuckoo algorithm is formed, which improves the comprehensiveness of the optimization objective from the algorithm level. Furthermore, feature selection constraints are introduced on this basis, limiting the selection ratio of key features to no more than a preset retention rate, thereby avoiding the overfitting of the model to specific feature dimensions due to excessive reliance on key features, forming a second improved cuckoo algorithm. Finally, a preset repair strategy is introduced in the joint iterative optimization process. The first and second preset repair strategies are periodically executed alternately to dynamically adjust the feature selection path and hyperparameter configuration, improving search diversity and local search accuracy, ultimately forming a pre-improved cuckoo algorithm with a complete structure and balanced performance. Through the above multi-level optimization mechanism, the solution balances model complexity and recognition performance while ensuring the effective preservation of key features. It can more accurately construct fatigue detection models and improve the response speed and recognition accuracy of fatigue state changes in EEG signal data, further enhancing the practicality and intelligence of the system.
[0018] 3. By introducing a joint iterative optimization process incorporating mechanisms such as Levy flight perturbation, redundancy suppression, group / hierarchical crossover, and patching strategies, the collaborative optimization of the binary feature mask vector and the initial hyperparameters of the classifier was achieved within the framework of the improved Cuckoo algorithm. By replacing redundant features with complementary signal features from different channels but highly correlated, the information representation capability of the feature subset was improved. Furthermore, by combining feature selection constraints and periodic patching strategies, the contradiction between feature compression and model performance was effectively balanced. Finally, the optimization process converged under the guidance of a multi-objective fitness function, resulting in target detection individuals with superior discriminative ability and generalization performance, thus constructing a fatigue detection model that combines accuracy and efficiency. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating a fatigue detection method based on the cuckoo algorithm in an embodiment of this application. Figure 2 This is a flowchart illustrating the process of constructing the preset improved cuckoo algorithm in an embodiment of this application; Figure 3 This is a schematic diagram of a fatigue detection system based on the cuckoo algorithm in an embodiment of this application.
[0020] Explanation of reference numerals in the attached drawings: 301, Central Processing Unit; 302, Read-Only Memory; 303, Random Access Memory; 304, Bus; 305, Input / Output Interface; 306, Input Section; 307, Output Section; 308, Storage Section; 309, Communication Section; 310, Driver; 311, Removable Media. Detailed Implementation
[0021] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0022] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.
[0023] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0024] Figure 1 This is a flowchart illustrating a fatigue detection method based on the cuckoo algorithm in an embodiment of this application.
[0025] Please see Figure 1 This application provides a fatigue detection method based on the cuckoo algorithm, which includes: S101. Obtain the EEG signal data of the person to be tested, extract features from the EEG signal data to obtain an original feature pool, wherein the original feature pool includes multiple signal features; Real-time EEG monitoring of individuals is performed using a multi-lead EEG acquisition device deployed based on the international 10-20 system. This device supports 8 to 32 channels with a sampling rate of 256 Hz or 512 Hz to ensure signal temporal resolution. During acquisition, optional eye-tracking electrodes (EOG) can be used for subsequent artifact suppression. The acquired signals undergo synchronous gain processing via analog-to-digital conversion and amplifier modules, and are recorded as raw time-series signals. This signal directly reflects the synchronous firing activity of neuronal populations in the cerebral cortex.
[0026] To improve signal quality and the effectiveness of subsequent feature extraction, a series of preprocessing steps are required after data acquisition. The EEG signal is subjected to 50Hz power frequency notch filtering to suppress power grid interference, and a bandpass filter is used to retain effective components in the 0.5Hz to 45Hz range. Subsequently, independent component analysis or an adaptive artifact suppression algorithm combined with the EOG channel is used to identify and remove non-brain-derived components such as blinking and eye movements, further improving signal purity. After artifact processing, the signal undergoes a rereference operation, using a common average reference or binaural reference method to reduce artifacts introduced by reference electrode bias.
[0027] The processed signal will be segmented according to a preset sliding window strategy, with a window length of 2 seconds, a step size of 1 second, and an overlap rate of 50%, to ensure the continuity of state changes and the temporal resolution of sampling. Taking a night shift operator as an example, the system continuously collects EEG signals during their work and converts the raw signals into high-quality analysis signals through the above preprocessing steps.
[0028] After preprocessing the EEG signal, further feature extraction is required to construct an original feature pool containing multiple neural information dimensions. The purpose of this step is to convert the complex time-series signal into a multi-dimensional feature vector with discriminative capabilities, which can then be used by a subsequent classifier for fatigue state modeling. Specifically, this includes the following steps: bandpass filtering and power frequency notch filtering are applied to the EEG signal data to obtain a filtered signal; the filtered signal is divided into multiple time windows according to a preset time length, and the mean, variance, peak-to-peak value, zero-crossing rate, waveform length, and Hjorth parameter of the filtered signal within each time window are determined as time-domain features; the filtered signal is divided into multiple frequency bands, and the absolute spectral power, relative spectral power, spectral entropy, and edge frequencies of each frequency band are calculated to obtain frequency-domain features; the sample entropy, permutation entropy, approximate entropy, and Lempel-Ziv complexity of the filtered signal are determined as nonlinear features; the coherence, phase-locking value, and propagation entropy between different channels within each time window are calculated to obtain connectivity features; and the time-domain features, frequency-domain features, nonlinear features, and connectivity features are combined into the original feature pool.
[0029] In practical implementation, EEG signals are often mixed with noise components such as power frequency interference, low-frequency drift, and high-frequency electromyography. Therefore, a bandpass filter is used to retain the effective neural components in the 0.5Hz to 45Hz frequency band, while a notch filter is used to suppress power frequency noise at a fixed frequency of 50Hz. In actual operation, digital filters with FIR or IIR structures can be used to implement the filtering process. The filter parameters are determined through pre-experiments based on the target hardware platform and noise level. The filtered signal has a clearer waveform structure and frequency components, which facilitates the subsequent extraction of the signal's statistical, spectral, and dynamic characteristics at different time scales. For example, in an industrial monitoring scenario, the original signal is severely affected by electromagnetic interference from nearby equipment. After filtering, the energy in the main frequency band is significantly restored, and the signal quality can be improved.
[0030] EEG signals are non-stationary and time-varying. Using a sliding window approach for segmented processing preserves their dynamic characteristics. The preset time length is determined based on the spectral characteristics of the EEG signal, the real-time requirements of practical applications, and engineering experience. In this embodiment, a window length of 2 seconds is chosen, achieving a practical balance between ensuring the integrity of frequency domain features and meeting real-time detection requirements. Within each time window, the mean refers to the average value of all sampling points within that time window. The DC component reflects the overall deviation trend of the signal and is used to determine whether the signal deviates from the baseline and detect changes in background level. Variance represents the average deviation of the signal from its mean, measuring the magnitude of signal amplitude fluctuations; a larger variance usually indicates more active neural activity and higher energy. Peak-to-peak value refers to the difference between the maximum and minimum values of the signal within a time window, reflecting the extreme amplitude range of the signal and used to capture abnormal discharges or high-amplitude neural responses. Zero-crossing rate indicates the number of times the signal crosses zero (i.e., positive-to-negative switching) within a window, reflecting the frequency characteristics of the signal; the higher the frequency, the more zero-crossings. Waveform length is the sum of the absolute values of the differences between all adjacent sampling points within a time window, comprehensively reflecting the complexity and activity level of the signal; a larger value indicates more intense signal fluctuations. Hjorth parameters include Activity (signal energy), which is the variance of the signal, representing overall energy and measuring the intensity of neural activity; Mobility (frequency fluctuation), which is the ratio of the square root of activity to the square root of the derivative of activity, reflecting frequency changes; a higher value indicates faster signal changes; and Complexity (morphological complexity) is the ratio of Mobility... The ratio of the derivative of the signal to Mobility measures the complexity of the signal morphology; a higher ratio indicates a more complex signal structure. These three parameters combined can comprehensively describe the dynamic characteristics of EEG signals. These features are computationally simple and highly real-time, suitable for online processing scenarios, and are therefore used as time-domain features. For example, a person on duty may have low variance and high zero-crossing rate within a window in the initial stage, but after entering a fatigue state, the variance increases and the waveform length significantly increases, reflecting changes in cognitive rhythm.
[0031] The filtered signal was divided into frequency bands δ', θ', α', β', and γ', and the absolute spectral power, relative spectral power, spectral entropy, and edge frequencies of each band were calculated to obtain frequency domain characteristics. This was done to quantify the energy distribution of EEG signals under different cognitive states from a spectral perspective. EEG activity in different frequency bands has specific physiological significance. δ' waves (0.5–4 Hz) are associated with deep sleep, θ' waves (4–8 Hz) reflect cognitive load, α' waves (8–13 Hz) typically increase in the awake, closed-eye state, β' waves (13–30 Hz) are associated with attention and tension, and γ' waves (30–45 Hz) are associated with higher cognitive activities. When performing frequency domain analysis on the EEG signals within each time window, the Welch power spectral density estimation method was first used to calculate the signal spectrum. This method obtains a stable and noise-resistant power spectral density distribution by segmenting the signal within the window, windowing, performing a Fast Fourier Transform (FFT), and averaging. The spectrum was then divided into five predefined frequency bands: δ' (0.5–4Hz), θ' (4–8Hz), α' (8–13Hz), β' (13–30Hz), and γ' (30–45Hz). The integral area in the spectrum of each band was calculated, which is the absolute spectral power of each band, reflecting the energy intensity of neural activity in that band. Dividing the absolute spectral power of a frequency band by the total power (the sum of power within the 0.5–45Hz range) yields the relative spectral power of that band, used to eliminate differences in overall EEG intensity between individuals. Based on the overall power spectral density distribution, the power of each frequency point was further normalized, and its spectral entropy was calculated using the information entropy formula, reflecting the uniformity of frequency component distribution; a higher entropy indicates a more dispersed energy distribution and a more complex state. Finally, based on the cumulative power curve on the frequency axis, the frequency point where the total power reaches 95% was determined as the edge frequency of the window, representing the upper frequency range where the signal spectral energy is mainly concentrated. These frequency domain features comprehensively quantify the energy distribution and complexity of the EEG signal at different frequency components, helping to identify changes in cognitive states. These frequency domain features have a strong discriminative power for classifiers. For example, when a night shift operator enters a period of fatigue, the θ' / α' ratio increases significantly and the spectral entropy decreases, suggesting a decline in their cognitive regulation ability.
[0032] The sample entropy, permutation entropy, approximate entropy, and Lempel-Ziv complexity of the filtered signal are identified as nonlinear features in order to capture the dynamic system behavior and complexity changes in EEG signals that cannot be revealed by traditional statistical features. EEG signals originate from the nonlinear coupling activity of the brain's neuronal network, an activity characterized by chaos and high complexity.
[0033] Sample entropy calculates the negative logarithmic probability of pattern continuity by counting the number of matches of a subsequence of length m within a tolerance range in the signal, and further comparing the matching rate of a subsequence of length m+1. A higher value indicates a more irregular signal. Permutation entropy constructs local permutation patterns based on the relative magnitude of signal values, calculates the entropy value after statistically analyzing the probability distribution of different permutation patterns, reflects the complexity of the short-term ordering structure of the signal, and has strong noise resistance. Approximate entropy is similar in principle to sample entropy but includes a self-matching term, measuring the continuity of similar sequences in the signal; a higher value indicates a more chaotic system. Lempel-Ziv complexity converts the signal into a binary symbol sequence, evaluates the speed at which the signal generates new information by scanning the symbol sequence and counting the number of newly added unique substrings; a higher complexity indicates a more incompressible and complex signal. All of the above nonlinear features are extracted from a single time window by setting appropriate embedding dimensions, tolerances, or symbolization thresholds, which can effectively reveal the chaotic and dynamic characteristics of EEG signals under fatigue.
[0034] Within each time window, to construct the connectivity characteristics of EEG signals, it is necessary to analyze the signal relationships between all selected channels and calculate three indicators: coherence, phase lock value, and transfer entropy. These indicators reflect the information interaction patterns between different brain regions from different perspectives and are important means of identifying changes in brain networks under fatigue conditions.
[0035] Coherence is calculated based on frequency domain analysis. First, the energy distribution of the signals from both channels is extracted in the frequency domain, and then the degree of spectral overlap between them is analyzed. If two signals have similar frequency components and trends in a certain frequency band, their coherence is high. The value of coherence ranges from 0 to 1; a higher value indicates a stronger functional connection between the two brain regions, suggesting that they may be in a state of co-activation within that time window.
[0036] Phase-Lock Value (PLV) calculations focus on the phase synchronization relationship between signals from a time-domain perspective. By extracting the instantaneous phase information of each channel signal, it observes whether the phase difference between the two channels is stable and consistent at each sampling point. If the phase difference between a pair of channels changes very little throughout the time window, it indicates that they are highly synchronized, and their PLV value is close to 1. PLV is particularly suitable for detecting coupling relationships between signals, even if their amplitude differences are large, it can reveal hidden synchronization patterns.
[0037] Transfer entropy is an asymmetric metric based on information theory, used to measure whether information from one channel flows to another in a certain way. In its calculation, the system analyzes whether the past signal states of one channel can improve the predictive ability of the future state of another channel. If the historical record of one channel significantly influences subsequent changes in another channel, information transfer is considered to have occurred. Transfer entropy can not only determine whether connections exist between brain regions but also identify the directionality of these connections, which is particularly valuable in understanding changes in dominant brain regions caused by fatigue.
[0038] In practice, the system combines all channel pairs and calculates the three types of connectivity metrics within each time window. Due to the large number of channels, a sparsity strategy is adopted to avoid computational redundancy and feature dimension explosion, retaining only connections with high metric values and those spanning brain regions. The resulting set of connectivity features not only characterizes the degree of co-activation between brain regions but also captures neurophysiological phenomena such as weakened network coupling, decreased synchronization, or changes in information flow direction caused by fatigue.
[0039] The purpose of combining the time-domain features, frequency-domain features, nonlinear features, and connectivity features into the original feature pool is to construct a multimodal, high-dimensional, and information-rich feature set that comprehensively covers multi-level EEG information expression from local statistics to whole-brain networks. In actual construction, the above four types of features on all selected channels within each time window are concatenated to form a fixed-length feature vector, which is then used to construct the original feature pool in the form of a two-dimensional matrix across all windows and samples.
[0040] S102. Randomly generate individuals to be optimized based on the original feature pool. The individuals to be optimized include a binary feature mask vector in the original feature pool and initial hyperparameters for configuring a preset classifier. The binary feature mask vector includes a binary feature mask value corresponding to each signal feature. The binary feature mask value is used to characterize the feature selection state of the signal feature. In step S102, individuals to be optimized need to be generated for subsequent iterative optimization. This step aims to provide a diverse starting search point for improving the Cuckoo algorithm, helping the algorithm to fully explore the solution space, avoid getting trapped in local optima, and ensure a broad initial coverage for exploring different feature combinations and classifier configurations.
[0041] Specifically, each individual to be optimized represents a complete candidate solution, carrying two key types of information about how to construct the fatigue detection model: first, a binary feature mask vector, indicating which signal features to select from the original feature pool; and second, initial hyperparameters, used to configure the preset classifier to be used. This design, which combines feature selection and classifier parameter configuration within a single individual to be optimized, forms the basis for joint optimization and better captures the coupling relationship between feature subsets and classifier performance.
[0042] To generate these individuals to be optimized, binary feature mask vectors are first constructed from all signal features in the acquired original feature pool. The original feature pool gathers all potential discriminative signal features extracted from the EEG signal data [a total of D features were extracted from the EEG signal data through time domain, frequency domain, time-frequency, nonlinear, and connectivity analysis]. Each binary feature mask vector is a binary sequence of length D. Each binary feature mask value in this vector corresponds to the signal feature at its corresponding position, and its function is to represent the selection state of that signal feature: if a binary feature mask value is 1, it indicates that the signal feature is selected to be included in the model; if it is 0, it indicates that the signal feature is excluded. When generating the initial individuals to be optimized, for most individuals, each binary feature mask value is independently and randomly set to 1 or 0 with a 50% probability to ensure the randomness and diversity of the initial solution set, covering as many feature subset combinations as possible. At the same time, in order to introduce domain prior knowledge and accelerate the convergence process of optimization, for some initial individuals, their binary feature mask vectors are generated based on the EEG prior guidance mechanism, that is, according to the sampling probability of each signal feature. [This probability is calculated by combining the discriminative power of the feature itself and the quality score of its channel] to determine whether the corresponding binary feature mask value is 1 or 0.
[0043] Subsequently, initial hyperparameters are configured for each generated individual to be optimized. These initial hyperparameters are adjustable parameters used to configure a preset classifier, such as a Support Vector Machine (SVM) classifier, and their values directly affect the classifier's performance. For example, if an SVM is chosen as the preset classifier, its initial hyperparameters might include a penalty coefficient C and a kernel width γ. When generating individuals to be optimized, these initial hyperparameters are randomly sampled within their preset numerical ranges. For continuous hyperparameters, such as the penalty coefficient C [between [0.1, 100]] and the kernel width γ [between [0.001, 10]], they are typically randomly selected using a uniform or log-uniform distribution; for discrete hyperparameters, they are randomly selected from their candidate set.
[0044] In this way, each individual to be optimized fully embodies a fatigue detection scheme consisting of a specific subset of signal features (determined by the binary feature mask vector) and a specific preset classifier configuration (determined by the initial hyperparameters). Generating a certain number of such individuals to be optimized—for example, a total of 50 individuals to be optimized—constitutes the initial population of the improved Cuckoo algorithm, serving as the starting point for iterative optimization. This lays the foundation for subsequent joint optimization of feature selection and classifier configuration, allowing the optimization process to simultaneously consider the interaction between the feature subset and the model configuration, thereby improving the overall performance of the final fatigue detection model.
[0045] For example, if the original feature pool contains 100 signal features, and the preset initial hyperparameters C of the SVM classifier range from [0.1, 100] to [0.001, 10], then an individual to be optimized might be encoded as: a binary feature mask vector of length 100 [1, 0, 1, ..., 1] and a set of initial hyperparameters C=23.5 and gama=0.057. This step will generate, for example, 20-50 such individuals to be optimized as the initial nest for the Cuckoo algorithm.
[0046] S103. Based on the preset improved cuckoo algorithm, the binary feature mask vectors of multiple individuals to be optimized and the initial hyperparameters are jointly iteratively optimized to obtain the target detection individual, wherein the target detection individual includes the target binary feature mask vector and the target hyperparameters; To further improve the efficiency and accuracy of the joint iterative optimization process, before step S103, the method includes the following steps: Figure 2 This is a flowchart for constructing a pre-defined improved cuckoo algorithm, combined with... Figure 2 This paper provides a detailed explanation of the construction of the pre-defined improved cuckoo algorithm.
[0047] S201. Calculate the importance score of the signal features in the original feature pool, and determine the signal features with the importance score greater than a preset importance threshold as key features; In this embodiment, to improve the search efficiency and convergence performance of the Cuckoo Algorithm during subsequent optimization, feature importance scores are calculated for the signal features contained in the original feature pool. A pre-screening mechanism identifies key features with significant discriminative power in fatigue state identification. The original feature pool consists of multiple time-domain, frequency-domain, nonlinear, and connectivity features, exhibiting high dimensionality and strong redundancy among them. Directly participating in feature selection and hyperparameter joint optimization without screening would result in an excessively large search space, increasing the number of algorithm iterations and reducing the convergence speed of the optimal solution. Therefore, a feature importance measurement method is introduced before algorithm optimization to preliminarily assess the contribution of each feature to classification performance from a global perspective, selecting a set of key features to assist in constructing an improved search strategy for the Cuckoo Algorithm.
[0048] In practical implementation, the Extreme Random Forest (Extra-Trees) algorithm from the ensemble learning framework is adopted as the feature importance evaluation model. This algorithm is a nonlinear feature evaluation method based on stochastic decision tree ensemble, which can evaluate the contribution of high-dimensional features to the target variable without feature normalization. Specifically, all signal features in the original feature pool are used as input variables, and the labeled fatigue state is used as the output variable to train an extreme random tree model. During tree construction, the model randomly selects feature split points and calculates the total contribution of each feature in the splitting process using information gain or the Gini coefficient. Finally, the results of all trees are averaged to obtain the feature importance score corresponding to each signal feature.
[0049] After calculating importance, a preset importance threshold is set based on the score distribution. This threshold is determined using one of two methods: first, setting a fixed percentage threshold, such as retaining the top 30% of highly important features; second, combining cross-validation results to select the score corresponding to the smallest feature set that most significantly improves model accuracy as the threshold. In this embodiment, the second strategy is adopted. By comparing the performance of feature subsets under different thresholds on the validation set, features with an importance score greater than 0.015 are ultimately included as key features in the subsequent optimization process.
[0050] The key features identified in the above manner not only significantly reduce the dimensionality of the search space but also enhance the individual quality of the Cuckoo Algorithm during the initialization phase. Furthermore, the improved Cuckoo Algorithm incorporates the distribution information of key features into population initialization, Lévy flight search range setting, and discovery probability adjustment mechanisms. This makes the search process more inclined to explore subspaces related to key features, thereby improving optimization efficiency and model performance.
[0051] For example, in an initial feature pool containing 256-dimensional signal features, the importance score of each feature is calculated using an extreme random forest model. After sorting, 58 features with an importance score greater than 0.015 are selected as key features. Subsequently, when generating the initial population using the Cuckoo algorithm, these key features are given a mask value of 1, which improves their retention rate in the initial individuals. At the same time, during the iteration process, individuals containing key features are given higher fitness weights, guiding the search process to focus on high-contribution feature combinations, ultimately effectively improving the accuracy and stability of the fatigue detection model.
[0052] S202. Based on the key features and the standard cuckoo algorithm, construct the preset improved cuckoo algorithm.
[0053] In step S202, to further improve the joint optimization effect of feature selection and classifier configuration based on the Cuckoo algorithm, structural improvements need to be made to the standard Cuckoo algorithm. Specifically, this is achieved by introducing a multi-objective fitness function, a feature selection constraint mechanism, and a periodic repair strategy to construct a pre-defined improved Cuckoo algorithm that adapts to the complex requirements of fatigue detection tasks. The reason for constructing an improved Cuckoo algorithm is that while the standard Cuckoo algorithm has global search capabilities, its blind exploration of the solution space is inefficient in high-dimensional, multi-constraint problems, and it is difficult to directly incorporate domain prior knowledge and multi-dimensional performance considerations. The pre-defined improved Cuckoo algorithm effectively utilizes the key feature information identified in the previous step by integrating multi-objective optimization, feature selection constraints, and dynamic repair strategies, while also considering multiple dimensions such as model performance, complexity, and real-time performance. Specifically, this may include the following steps: replacing the single-objective fitness function of the standard cuckoo algorithm with a preset multi-objective fitness function to obtain a first improved cuckoo algorithm; setting feature selection constraints in the first improved cuckoo algorithm, wherein the feature selection constraints are used to ensure that the selection ratio of the key features during the joint iterative optimization process is less than or equal to a preset retention rate to obtain a second improved cuckoo algorithm; during the joint iterative optimization process of the second improved cuckoo algorithm, the first preset repair strategy and the second preset repair strategy are periodically and alternately executed based on a preset repair strategy to obtain the preset improved cuckoo algorithm.
[0054] In the specific implementation process, the single-objective fitness function of the standard cuckoo algorithm is replaced with a preset multi-objective fitness function to obtain the first improved cuckoo algorithm. The preset multi-objective fitness function specifically includes: Where J(x) is the preset multi-objective fitness function, The classification accuracy score of the signal features is given by |S| / N, where |S| is the feature size coefficient, |S| is the number of selected features, N is the total number of features in the original feature pool, Stab is the feature group stability score, which is the Bootstrap-Jaccard index, Latency(S) is the latency score, and α, β, γ, δ and η are preset weight coefficients.
[0055] In standard optimization algorithms, the fitness function typically has only one objective, such as maximizing classification accuracy. However, in practical applications, such as fatigue detection, a good model not only needs high accuracy but also needs to comprehensively consider multiple interrelated yet potentially conflicting dimensions, including model complexity, robustness, reliability of prediction probabilities, and real-time performance. To address this multi-objective optimization problem, this method designs a comprehensive multi-objective fitness function J(x). This function is defined as: Here, x represents an individual to be optimized in the Cuckoo algorithm, which encodes a set of feature selection masks and classifier hyperparameters, while J(x) is the metric for evaluating the quality of the solution represented by this individual. The goal of the algorithm is to minimize J(x).
[0056] The ReceiverOperating Characteristic (ROC) curve is a comprehensive metric used to measure classification performance, employing a weighted combination of the F1 score and the ROC-AUC score. In practice, the model's performance is evaluated during the cross-validation phase (e.g., 10-fold cross-validation). For each cross-validation fold k, the precision (Precision_k = TP_k / (TP_k + FP_k) and recall (Recall_k = TP_k / (TP_k + FN_k)) are calculated first, where TP represents true positives, FP represents false positives, and FN represents false negatives. Then, the F1 score for this fold is calculated as F1_k = 2 * Precision_k * Recall_k / (Precision_k + Recall_k). Simultaneously, the ReceiverOperating Characteristic (ROC) curve is plotted on this fold, and the area under the curve (AUC_k) is calculated. Finally, the F1 scores and AUC values of all cross-validation folds are averaged to obtain F1_mean and AUC_mean. Score_CV is then achieved by linearly weighting and combining these two averages: Score_CV = w_F1 * F1_mean + w_AUC * AUC_mean, where w_F1 is 0.6 and w_AUC is 0.4. This indicates that the F1 score is given a higher weight in fatigue detection because it better balances precision and recall, which is particularly important for fatigue early warning systems that need to avoid false negatives and false negatives. Since the optimization objective is to minimize J(x), ... Through 1- It is incorporated into the objective function, indicating that the worse the classification performance, the higher the fitness value, and vice versa.
[0057] |S| / N is the feature scale coefficient. |S| refers to the number of features selected by the current individual x, and N is the total number of all features in the original feature pool. This term aims to penalize solutions that select too many features and encourage the model to be concise. The fewer the number of features, the lower the model complexity, which can not only reduce the risk of overfitting but also speed up the training and inference speed of the model. By minimizing this term, the algorithm is guided to find a subset that contains the fewest but most discriminative features.
[0058] Stab is the feature group stability score, which is used to measure the degree of consistency of the output feature subset in the feature selection process under the perturbation of training samples. This method uses Bootstrap-Jaccard stability to quantify, and its purpose is to evaluate the robustness of the feature subset S(x) represented by the current individual x. The specific calculation steps are as follows: Obtain the baseline feature subset: First, run a given feature selection process (here referring to the feature selection part of the cuckoo algorithm under the current hyperparameter configuration) on the complete training dataset D once to obtain a baseline feature subset S_base.
[0059] Set the number of bootstrap iterations: Set the number of bootstrap (Bootstrap) iterations B, for example, take B = 30 times.
[0060] Generate bootstrap datasets and feature subsets: For each iteration from b = 1 to B, construct a bootstrap dataset D_b by sampling with replacement from the dataset D. Then, run the same feature selection process as in step 1 on each D_b to obtain a feature subset S_b.
[0061] Calculate the Jaccard index: Calculate the Jaccard index J(S_i,S_j)=|S_i∩S_j| / |S_i∪S_j| for all possible pairwise combinations (S_i,S_j) (where i < j). The Jaccard index measures the similarity between two sets, and its value ranges from 0 to 1, where 1 means the two sets are exactly the same and 0 means completely different.
[0062] Calculate the overall stability index: Take the average of all pairwise Jaccard values to obtain an index Stab=(2 / (B*(B - 1)))*Σ_{i<j}J(S_i,S_j) that reflects the overall robustness of the feature selection.
[0063] Assessing the stability of the current individual: When evaluating the stability of the current optimized individual x (whose feature set is S(x)), it is compared with the B bootstrap results S_b mentioned above. We define Stab(x) = (1 / B)*Σ_{b=1..B}J(S(x),S_b). The higher this Stab(x) value, the more similar the feature subset selected by the current individual x is to the subset obtained from the perturbed dataset, indicating better robustness to data changes. Therefore, in the fitness function, we minimize 1-Stab to promote the stability of feature selection.
[0064] CalErr is the calibration error, which measures the consistency between the fatigue probability predictions output by the model and the actual event frequencies, i.e., how confident the model is in its own predictions. This method defines it as the expected calibration error (ECE). The calculation process for ECE is as follows: Collect predicted probabilities and true labels: On all validation samples from the cross-validation folds, collect the predicted positive (fatigue) probability p̂_n from the classifier output and the corresponding true label y_n. The total number of labeled samples is N.
[0065] Set bins and divide the probability range: Set the number of bins M (e.g., M=10), and divide the probability interval [0,1] evenly into M sub-intervals I_m=[(m-1) / M,m / M].
[0066] Calculate confidence and precision: For each bin I_m (m=1,...,M), construct a set B_m of samples whose predicted probabilities p̂_n fall within I_m. Calculate the number of samples n_m in B_m. Define the confidence of the bin as the average of all p̂_n in B_m, and the precision of the bin as the average of all true labels y_n in B_m (i.e., the proportion of positive samples).
[0067] Calculate ECE: Summarize the results of all binning to obtain the ECE value: CalErr = ECE = Σ_{m=1..M}(n_m / N)*|acc_m-conf_m|. The lower the ECE value, the closer the model's predicted probability is to the actual event frequency, and the more reliable its output fatigue index is, which is crucial for the reliability of fatigue early warning.
[0068] Latency(S) is the latency score, representing an estimate of the feature extraction time during a single sliding window inference phase, given a selected feature subset S. This term directly reflects the real-time response capability of the fatigue detection system. Its estimation process is based on offline benchmark testing and the construction of a linear weighted model: Offline benchmarking phase: First, for each feature class, the computation time is repeatedly measured on the same target hardware platform and with a fixed EEG sliding window length setting as the actual deployment environment. For example, 100 computations are performed on a set containing 20 time-domain features, the average time is calculated, and then divided by 20 to obtain the average unit cost t_time_base for a single time-domain feature. Similarly, t_frequency_base and t_nonlinear_base can be obtained. For connectivity features, the computational cost is related to the number of channel pairs (i.e., the number of edges). Therefore, an "upper triangular plus sparsity threshold" strategy is adopted to control the number of edges, that is, only the upper triangular matrix of channel pairs is considered, and thresholds are set for indicators such as coherence and phase lock value, and only connections with values higher than the threshold are retained (considered as meaningful connections). Under this strategy, the average computational cost per edge of the connectivity feature is measured and denoted as t_conn_base.
[0069] Online estimation phase: Given a feature subset S corresponding to an individual x to be optimized, count the number of each type of feature n_k(S). Then, estimate the window-level latency using a linear model: Latency(S) = Σ_kn_k(S) * t_k_base. Here, k traverses time domain, frequency domain, nonlinearity, etc. The actual latency of connectivity features is covered by n_edge(S) * t_conn_base, where n_edge(S) is the number of edges of connectivity features retained under the "upper triangle plus sparse threshold" strategy. By minimizing Latency(S), the algorithm is guided to select features with lower computational cost, thereby improving the model's real-time performance.
[0070] Finally, α, β, γ, δ, and η are preset weight coefficients used to balance the importance of each objective item in the fitness function. The default settings are α=0.5, β=0.15, γ=0.1, δ=0.1, and η=0.15, which means that the classification performance ( The performance (α) and real-time performance (Latency(S)) are given relatively high weights, while feature size, stability, and calibration error also account for a certain proportion, reflecting the comprehensive requirements of fatigue detection applications in these aspects. To focus more on exploring high-performance solutions in the early stages of optimization and more on optimizing real-time performance in the later stages, this method also introduces a linear annealing mechanism: during the iteration process, the weight of α gradually decreases, while the weight of η gradually increases. For example, α can linearly decrease from 0.5 to 0.3, while η linearly increases from 0.15 to 0.35. This way, when the model converges in the later stages, the algorithm will be more inclined to select solutions that balance high performance and low latency.
[0071] Building upon the first improved cuckoo algorithm, this method further sets a feature selection constraint in the first improved cuckoo algorithm. This constraint ensures that the selection ratio of the key features during the joint iterative optimization process is less than or equal to a preset retention rate, thus obtaining the second improved cuckoo algorithm. This step is to fully utilize the valuable prior knowledge of the "key features" identified through importance scores in the preceding steps. Although the multi-objective fitness function has comprehensively considered various factors, it is necessary to introduce an explicit constraint to ensure that features physiologically and statistically proven to be crucial for fatigue detection are not randomly discarded by the algorithm, or to prevent them from being indiscriminately retained excessively, leading to redundancy. This feature selection constraint works by limiting the number of key features contained in each individual x to be optimized. Specifically, if M key features are identified by the extreme random forest algorithm in the previous step, the system sets a preset retention rate, typically a range (e.g., the proportion of key features in the selected feature subset should be maintained between Rt_min and Rt_max, e.g., Rt_min = 60%, Rt_max = 80%). Each time a new individual to be optimized is generated (whether through Lévy flight producing a new solution or a host bird discovering a new nest), the algorithm checks the number of key features selected for that individual. If the proportion of key features is less than Rt_min, the algorithm randomly selects a subset of the unselected key features with the highest importance scores and forces their binary mask values to be set to 1, until the minimum retention rate requirement is met. If the proportion of key features exceeds Rt_max, a subset of key features with relatively low importance scores is randomly removed and their binary mask values are forced to be set to 0 to avoid redundancy. This constraint mechanism ensures that the algorithm maintains necessary exploratory power and diversity while utilizing the prior knowledge of key features, thereby converging to a high-quality solution more efficiently during the optimization process.
[0072] Finally, to further improve the practicality and adaptability of the fatigue detection model, this method, during the joint iterative optimization process of the second improved cuckoo algorithm, alternately executes the first and second preset repair strategies based on preset repair strategies, thereby obtaining the preset improved cuckoo algorithm. These two repair strategies are fine-tuning adjustments to candidate solutions in the later stages of iteration, aiming to address specific performance or resource constraints. The repair strategies are not executed in every iteration, but are selectively alternated according to a preset period (e.g., every 10 or 20 iterations) or a random triggering mechanism to avoid introducing excessive computational burden.
[0073] The first pre-defined patching strategy is a greedy patching strategy. This strategy ensures that certain "forced selection features," which are physiologically significant and highly important in the field of fatigue detection, are included in the final feature subset. These forced selection features are typically fatigue biomarkers validated by numerous physiological and clinical studies (e.g., the theta / alpha power ratio of certain brain regions, short-range phase-locking values or transfer entropy between certain channels), and they play an irreplaceable core role in identifying fatigue states. During each greedy patching operation, the algorithm checks the feature subset corresponding to the currently optimized individual. If any pre-defined forced selection feature is found to be missing, the greedy patching mechanism immediately forces the binary mask values of these missing features to be set to 1. This strategy has high priority, ensuring the model's physiological interpretability and the "lower bound" of its core discriminative power. Even if these features are missed due to randomness at some stage of the algorithm's exploration, they can be promptly "corrected."
[0074] The second pre-defined patching strategy is a lightweight patching strategy, which focuses on optimizing the deployment efficiency and real-time performance of the model. It is particularly suitable for online detection scenarios with limited resources or requiring extremely low latency. When this strategy is periodically triggered, the algorithm evaluates the features contained in the currently optimized individual, identifying feature sets with high computational complexity or relatively low contribution to classification performance (e.g., through feature contribution analysis, sensitivity analysis, or cost judgment based on the aforementioned Latency(S)). Then, lightweight patching attempts to replace or remove these "heavy" features. Specifically, without significantly sacrificing the fitness value of the current solution J(x) (i.e., within the pre-defined performance loss threshold), it prioritizes alternative features with lower computational cost but similar discriminative power, or directly deletes features deemed redundant. For example, a computationally time-consuming nonlinear feature might be replaced by a computationally simpler temporal feature if such a replacement significantly reduces model inference latency and has a negligible impact on classification performance. By evaluating and adjusting the features in each subset of candidate features, lightweight patching further simplifies the model in the later stages of optimization, reduces online inference latency, and better meets the real-time and resource consumption requirements of practical applications.
[0075] Through three key improvements—redefining the fitness function of the standard Cuckoo algorithm, introducing feature selection constraints, and periodically alternating between greedy patching and lightweight patching—a standard Cuckoo algorithm initially possessing only general search capabilities has been transformed into a powerful "pre-improved Cuckoo algorithm" that integrates domain knowledge, multi-dimensional performance considerations, and dynamic optimization strategies. This enhanced algorithm can more efficiently and accurately find "target detection individuals" that meet the stringent requirements of fatigue detection in the high-dimensional and complex space of feature selection and hyperparameter optimization, laying a solid foundation for the subsequent construction of high-performance and highly reliable fatigue detection models.
[0076] After obtaining the preset improved cuckoo algorithm, step S103 is executed to perform joint iterative optimization on the binary feature mask vectors and the initial hyperparameters of multiple individuals to be optimized based on the preset improved cuckoo algorithm to obtain the target detection individual. The target detection individual includes the target binary feature mask vector and the target hyperparameters.
[0077] In the preceding steps, we have generated a group of individuals to be optimized, containing random feature mask vectors and initial classifier hyperparameters, setting a starting point for model optimization. Building upon this, the core task of step S103 is to perform joint iterative optimization of the binary feature mask vectors and initial hyperparameters of these individuals based on a pre-defined improved Cuckoo algorithm, ultimately obtaining the target detection individuals. This process no longer simply accepts the initial configuration, but utilizes the powerful global search capability and multi-objective optimization mechanism of the improved Cuckoo algorithm to systematically and efficiently find the optimal solution within the vast and complex feature subset and hyperparameter combination space faced by the fatigue detection model. By binding feature selection and classifier hyperparameter configuration in the same optimization process, this method fully considers the interaction between the two, overcoming the local optima problem that may result from separate optimization in traditional methods. The goal of iterative optimization is to continuously improve the fitness of the individuals to be optimized, gradually converging to a feature subset and classifier hyperparameter combination that can construct the optimal fatigue detection model while considering multiple dimensions such as classification performance, model complexity, feature stability, prediction calibration, and real-time performance. The final target detection individuals represent this optimal configuration, providing a solid foundation for the subsequent establishment of the fatigue detection model.Specifically, this may include the following steps: initializing a group of individuals to be optimized, the group comprising multiple individuals to be optimized; performing the following operations cyclically within a preset number of iterations, terminating the loop when the number of iterations equals the preset number of iterations or the updated group of individuals to be optimized meets a preset termination iteration condition; perturbing the binary feature mask vector and the initial hyperparameters of each individual to be optimized based on the Levy flight mechanism of the preset improved cuckoo algorithm to obtain multiple first target individuals to be optimized; modifying the binary feature mask values corresponding to redundant features in the multiple first target individuals to be optimized to zero based on a preset redundancy suppression operator, and modifying the binary feature mask values corresponding to the filler signal features in the original feature pool to one, to obtain multiple second target individuals to be optimized, wherein the filler signal features are the signals in the target individuals to be optimized that are not selected except for the redundant features. Among the features, the signal feature with the same feature type as the redundant feature but different feature channels, and the highest correlation with the redundant feature; multiple second target individuals to be optimized are combined based on a preset group / hierarchical crossover operator to obtain candidate optimization individuals, and the candidate optimization individuals are repaired for feasibility according to preset feature selection constraints to obtain first target candidate optimization individuals; the first target candidate optimization individuals are alternately subjected to a first preset repair strategy and a second preset repair strategy based on a preset repair strategy cycle to obtain second target candidate optimization individuals; the group of individuals to be optimized is updated based on the preset multi-objective fitness function to obtain an updated group of individuals to be optimized; when the number of iterations is equal to the preset number of iterations or the updated group of individuals to be optimized meets the preset termination iteration condition, the individual with the smallest fitness in the updated group of individuals to be optimized is determined as the target detection individual.
[0078] Based on the previously constructed improved cuckoo algorithm and taking over the initial individuals to be optimized generated in S102, this method initiates an iterative optimization loop aimed at selecting the optimal fatigue detection model configuration from the vast space of feature and parameter combinations. This process begins with initializing the population of individuals to be optimized. This typically involves forming an initial population or nest set from the multiple individuals to be optimized generated in S102 (each individual representing a potential fatigue detection solution, including feature mask vectors and classifier hyperparameters). This serves as the starting point for algorithm iterations, ensuring the diversity of the initial search.
[0079] The algorithm iterates through a preset number of iterations, performing the following operations repeatedly. The loop terminates when the number of iterations equals the preset number or when the updated group of individuals to be optimized meets a preset termination condition. The preset number of iterations is the maximum number of iterations pre-set before the optimization algorithm begins execution to limit computational costs and prevent infinite execution. In optimization algorithms, relying solely on "reaching the preset number of iterations" to terminate the loop is sometimes inefficient: the algorithm might converge to a satisfactory solution early on, but continue iterating unnecessarily; or the algorithm might stagnate, unable to find a better solution no matter how many iterations iterates. Therefore, in addition to the number of iterations, other "preset termination conditions" are usually introduced to more intelligently control the algorithm's termination. Preset termination conditions aim to provide a more intelligent and flexible mechanism for stopping the optimization process than simply relying on the number of iterations. It typically includes a series of criteria to determine whether the algorithm has converged, stagnated, or found a solution that meets the preset requirements. Specifically, these conditions can include: when the fitness function value of the optimal individual (i.e., the individual with the lowest preset multi-objective fitness function value) does not significantly improve in several consecutive iterations; when the overall fitness change of the group of individuals to be optimized tends to be stable, indicating that the algorithm has converged; when the diversity in the group of individuals to be optimized decreases significantly, possibly indicating that it has fallen into a local optimum; or when the preset multi-objective fitness function value of a certain individual to be optimized has reached or fallen below a preset performance threshold. The introduction of these conditions avoids unnecessary consumption of computational resources and ensures that the algorithm terminates in a timely manner after finding a sufficiently good solution, thereby improving optimization efficiency and practicality.
[0080] Lévy walks, as a random walk mode with a heavy-tailed probability distribution, are characterized by allowing the algorithm to perform local searches for fine-tuning most of the time, while occasionally making large jumps to explore the global solution space, thus effectively avoiding getting trapped in local optima. Specifically, for continuous hyperparameters, the Mantegna method is used to calculate the Lévy step size, and the step size λ_h can be adaptively adjusted according to the population diversity D (λ_h increases when diversity is low to promote exploration, and decreases when diversity is high to encourage fine-tuning). For binary feature mask vectors, the perturbation process is even more refined: first, Lévy updates are performed on the underlying real-valued representation z, and then it is discretized into a binary mask m through a specific transfer function. The process is divided into two stages. When the ratio of the number of iterations t to the total number of iterations T, t / T, is not greater than 0.5 (early optimization stage), each real value z_i is transformed using the sigmoid function s(z_i)=1 / (1+exp(−kz_i)), where the value of k increases linearly from 3 to 6 during the iteration process. This allows for a wider range of changes in the function in the early stage, while it tends to converge more stably in the later stage. The decision to flip m_i is made by comparing it with the randomly sampled u_i. When t / T is greater than 0.5 (late optimization stage), the process switches to using the vigmoid function v(z_i)=|tanh(z_i)|. Its stronger nonlinear characteristics help to escape potential local optima in the later stage. The decision to flip m_i is also made based on the comparison with u_i. To maintain strong physiological or structural correlations, features within the spectral power group and channel group undergo intra-group consistent flipping: after calculating the bit-by-bit flipping probability based on the transfer function, for each predefined feature group G_g, the feature with the largest static importance Score_stat_i is selected as the group center feature r_g, and its corresponding flipping probability p_group is used as the flipping probability of the entire group. By sampling u_group, it is determined whether all features in the group are flipped or remain unchanged.
[0081] To handle potential feature redundancy and optimize feature subsets, feature optimization is performed based on a pre-defined redundancy suppression operator. This pre-defined redundancy suppression operator is a crucial module in this improved Cuckoo algorithm. Its core function is to optimize feature subsets by identifying and eliminating highly correlated or overlapping features, while simultaneously filling in the gaps with better candidate features. This effectively reduces model complexity, improves generalization ability, and prevents overfitting. This operator is executed independently for each individual in each generation, after mutation and crossover operations, and before group capacity repair. It first iterates through all activated feature pairs in the current individual, using the Pearson correlation coefficient to detect linear redundancy and the Hilbert-Schmidt Independence Criterion (HSIC) to detect nonlinear dependencies. Once |ρ(i,j)| exceeds a threshold τ or HSIC(i,j) exceeds a threshold... The algorithm determines that a feature pair is significantly redundant. For feature pairs deemed redundant, the algorithm further compares their importance scores (a weighted combination of FisherScore and mutual information), marking the feature with the lower score as inferior and setting its corresponding position in the binary feature mask to zero, thus removing it from the current feature subset. To compensate for potential information loss from removed features and maintain the vitality of the feature set, the operator then executes a replacement strategy: for each removed feature, it searches the original feature pool (all inactive features) for candidate features of the same type but belonging to different channels and highly correlated with the removed feature, and selects the best-performing one based on its static importance (Score_stat) for activation replacement. Through this series of processes, the pre-defined redundancy suppression operator ensures that the final feature subset not only has high discriminative power but also avoids information duplication and resource waste, laying the foundation for building an efficient, stable, and highly generalizable fatigue detection model.
[0082] The pre-defined redundancy suppression operator is executed on each newly generated individual in each generation, after mutation and crossover but before group size repair. It first parses the feature set S activated by the current individual, and then iterates through the feature pairs in S using the Pearson correlation coefficient ρ(i,j) and Hilbert-Schmidt Independence Criterion (HSIC(i,j)) calculated and cached offline. If |ρ(i,j)| is found to be greater than a pre-defined threshold τ or HSIC(i,j) is found to be greater than a pre-defined threshold... This means that significant redundancy is determined. For each pair of redundant features, by comparing their weighted FisherScore and mutual information (I_i = b_F·F_i_norm + b_MI·MI_i_norm), the pair with the lower I value is marked as inferior and its mask position is set to zero, thereby removing it from the feature subset. For each deleted redundant feature i_del, the system executes a redundancy replacement strategy: searching for candidate replacement features k* in the set of inactive features. The replacement signal feature is strictly defined as: among the signal features not selected in the target individual to be optimized (excluding the redundant feature), the feature with the same feature type as the redundant feature (e.g., both are time-domain or frequency-domain features) and different feature channels (to avoid reintroducing redundancy in the same channel), and the highest correlation with the redundant feature. In practice, to avoid computationally intensive real-time correlation calculations, all candidate features that meet the conditions of the same type, different channels, and inactivity are usually selected. In this context, based on its pre-calculated static importance... Sort the features from highest to lowest score, select the highest-scoring feature k* for padding, and set its mask position to 1. If there are no suitable candidate features, skip padding.
[0083] The group / hierarchical crossover operator aims to ensure effective feature information exchange and recombination. It employs a hierarchical approach: First, a one-point crossover is performed at the "channel layer," randomly selecting a channel position between two parent individuals and exchanging the entire set of features contained in all channels after that position to preserve the structural relationships between channels. Then, a uniform crossover is performed at the "type layer," exchanging the feature states of the two parent individuals in the corresponding type with a preset probability for different feature types such as time domain, frequency domain, nonlinearity, and connectivity, thereby promoting more diverse feature type combinations. Candidate individuals generated after crossover may be "infeasible" due to not meeting preset physiological or computational constraints. In such cases, feasibility repair is required, one key repair mechanism being "group capacity repair," which is executed immediately after crossover to meet the preset channel limit. With type upper limit The constraints mean that pruning decisions primarily rely on the static importance of features. The specific operation involves counting the number of activated features for each channel, and then... The channel, and all activated features within that channel are... Sort the features from smallest to largest, and then remove the features with the lowest scores one by one until the condition is met. Similarly, repeat this process for each feature type until the number of type activations exceeds [a certain threshold]. At that time, according to Delete in ascending order until the condition is met. Furthermore, as a more general constraint and feasibility fix, the algorithm also ensures that at least one set of key feature templates is retained, such as the θ / α ratio, (θ+α) / β ratio, spectral entropy, sample entropy, and PLV between the frontal and occipital lobes, which are theoretically or empirically crucial for fatigue detection, to safeguard the physiological basis and basic performance of the model.
[0084] Subsequently, to refine and enhance candidate individuals, this method alternately executes a first and a second pre-set repair strategy on the first target candidate optimization individual based on a pre-set repair strategy cycle, resulting in a second target candidate optimization individual. The pre-set repair strategy cycle refers to a pre-defined pattern or frequency arrangement of alternating execution of two repair strategies (greedy repair and lightweight repair) before the algorithm runs, designed to balance the convergence speed and solution quality (i.e., breadth of exploration and depth of development) of the optimization algorithm. The pre-set repair strategy cycle is a dynamic, periodic insertion mechanism in the improved Cuckoo algorithm, aiming to proactively balance the multi-dimensional performance requirements of the model in terms of robustness, physiological interpretability (by forcibly incorporating key physiological feature templates), and real-time performance (by optimizing computational overhead). Its design philosophy stems from the fact that, during optimization, pure feature selection algorithms may, while pursuing maximum performance, neglect the rigid requirements of specific domains for model interpretability and actual deployment efficiency, as well as the need to avoid getting trapped in local optima. Specifically, this strategy periodically repairs the generated candidate individuals alternately, supplemented by adaptability: when the population diversity D is low, its introduction probability... The algorithm will increase to prevent premature convergence. The first pre-set patching strategy is greedy patching. The core function of greedy patching is to forcibly cover the pre-set key physiological feature templates, ensuring that the model always contains feature combinations that are significant to the physiological mechanism of fatigue. Even if these combinations are diluted or lost during evolution, the basic physiological rationality and robustness of the model can be guaranteed by replacing relatively unimportant features. Lightweight patching focuses on reducing the computational latency (Latency(S)) of the model. It identifies features that have high computational cost but relatively low contribution to model performance and attempts to replace them with features that have lower cost and equivalent importance, or even directly deletes such features without significantly impairing performance, thereby optimizing the real-time performance of the model and making it more suitable for actual deployment environments. Through this alternating and adaptive patching strategy, the algorithm can finely adjust in complex optimization landscapes, promoting exploration while continuously guiding the population to converge toward the best solution that takes into account scientific principles, prediction accuracy and engineering practicality, avoiding the bias that may be caused by a single optimization objective, and ultimately producing a more comprehensive and efficient fatigue detection model.
[0085] These two patching strategies aim to dynamically balance the model's robustness, interpretability, and real-time performance. They are periodically inserted into the main loop, for example, once every r=10 generations, and their introduction probability is increased when the population diversity D is low through adaptive parameters and a multi-strategy hybrid mechanism. This is to guide the algorithm out of local optima. Greedy patching aims to force the coverage of key physiological feature templates to ensure that physiological knowledge is reflected in the final solution: it first defines a set of key feature templates. (The following parameters are considered: θ band power, α band power, θ / α ratio, (θ+α) / β ratio, spectral entropy, sample entropy, and PLV between the frontal and occipital lobes, etc.). Then, it is checked whether the current individual has activated features that satisfy each template. If a template is not covered, a candidate set is constructed from the inactive features. This contains all the features that satisfy the template, and according to Product with channel priority Select the feature k* with the highest score. If activating k* will not cause the channel or type to exceed the capacity limit, then activate k* directly; if it will exceed the limit, then replace the affected channel or type first. The lowest and non-critical features are reactivated k*, thereby introducing the key template without violating constraints. Lightweight patching focuses on reducing latency(S) while maintaining classification performance, emphasizing the model's real-time performance and deployment efficiency: it first finds the offline estimation cost of the currently activated features. Next, the overall importance of each feature is calculated. ,in The cross-validation composite score was measured after temporarily removing the feature. The decrease in cost. Then, the cost-importance ratio for each feature is calculated. , A higher value indicates that the feature has a high overhead but relatively low importance, making it a priority target for replacement. The algorithm will then proceed according to... Sort, select the first The proportion of features is used as a high-cost candidate set H. For each feature i in H, it searches for features of the same type and low cost among the inactive features. Lower, and less important Not less than If a replacement feature k* is found, then i is replaced with k*. If the overall Latency(S) is still higher than the preset threshold after replacement, the algorithm can continue to delete non-critical features with the highest R_i from H, provided that... The decrease does not exceed the preset tolerance range.
[0086] The population of individuals to be optimized is updated based on the preset multi-objective fitness function to obtain an updated population of individuals to be optimized. Specifically, this includes the following steps: calculating the candidate fitness of the second target candidate optimization individual according to the preset multi-objective fitness function; comparing the candidate fitness with the target fitness of the individual to be optimized corresponding to the second target candidate optimization individual in the population of individuals to be optimized; if the candidate fitness is less than the target fitness, then replacing the individual to be optimized corresponding to the second target candidate optimization individual in the population of individuals to be optimized with the second target candidate optimization individual, thus obtaining the updated population of individuals to be optimized.
[0087] Specifically, for the "second-objective candidate optimization individual" (which is a novel candidate solution with potential superiority formed by integrating exploratory perturbations of the Levy flight mechanism, feature optimization of a preset redundancy suppression operator, structured recombination of a preset group / hierarchical crossover operator, and dynamic adjustment of a preset repair strategy cycle), the algorithm first calculates its candidate fitness based on the "preset multi-objective fitness function". Preset multi-objective fitness function , is a composite mathematical expression that comprehensively evaluates the classification accuracy score of candidate individuals ( The performance metrics include feature subset size coefficient (|S| / N, i.e., the proportion of features to the total number of features), feature group stability score (Stab), model calibration error (CalErr), and model latency score (Latency(S)). This function is designed to quantify the overall quality of a solution. A lower function value indicates better overall performance, meaning it simultaneously achieves higher classification accuracy, a simpler feature subset, more stable feature selection, smaller calibration error, and lower model latency.
[0088] The algorithm precisely compares the calculated candidate fitness with the target fitness of the corresponding individual in the original population of individuals to be optimized, which then generates this second target candidate. This comparison mechanism reflects the greedy selection principle of evolutionary algorithms: if the candidate fitness of the second target candidate is less than the target fitness value of its predecessor, it indicates that the new candidate solution performs better in terms of overall performance, i.e., the score of the preset multi-objective fitness function. The algorithm then adopts a replacement strategy, using this better second target candidate to replace the corresponding old individual in the original population of individuals to be optimized, thus achieving survival of the fittest and ensuring that better solutions are introduced in each iteration. Conversely, if the new individual performs poorly or shows no significant improvement, the original individual to be optimized is retained and continues to participate in subsequent iterations.
[0089] By pre-setting a multi-objective fitness function for fitness evaluation and selectively replacing individuals based on the comparison results, it is ensured that the group of individuals to be optimized moves towards greater efficiency, stability, and generalization ability in each iteration, ultimately converging to a target detection individual that achieves a good balance among multiple objectives. This not only improves the convergence speed and optimization efficiency of the algorithm, but more importantly, it ensures that the final fatigue detection model accurately meets the stringent requirements of classification performance, model efficiency, and biological interpretability. For example, it ensures that a model can be found that accurately distinguishes fatigue states, uses a small number of key features, and has a fast computation speed. This makes the optimization process not just about finding an optimal solution, but about finding a multi-dimensional equilibrium solution that best meets the needs of practical applications.
[0090] S104. Determine the feature subset based on the target binary feature mask vector, and construct a fatigue detection model based on the feature subset and the target hyperparameter configuration classifier. After executing the joint optimization process based on the preset improved Cuckoo algorithm, to construct a fatigue detection model with high accuracy, high robustness, and good real-time response capabilities, it is necessary to further determine the final feature subset to be used based on the target binary feature mask vector contained in the target detection individual, and configure the classifier in conjunction with its corresponding target hyperparameters. The target binary feature mask vector is a binary sequence with the same length as the original feature pool, where each element represents the selection state of the corresponding signal feature; a value of 1 indicates that the feature is selected, and a value of 0 indicates that it is discarded. By traversing this mask vector, the index positions of all values of 1 are extracted, corresponding to the selected features in the original feature pool, thus forming the feature subset. Subsequently, the classifier is initialized and configured according to the target hyperparameters carried in the target detection individual. Target hyperparameters include various parameters required for the classifier model structure. For example, if a support vector machine is used as the classifier, the target hyperparameters may include the kernel function type, regularization parameter C, and kernel function coefficient γ, etc.; if a lightweight neural network is used, these correspond to the learning rate, batch size, number of network layers, and number of neurons per layer, etc. By deeply coupling the feature space and model structure as described above, the constructed fatigue detection model not only possesses optimal feature representation capabilities but also completes the discrimination and learning of fatigue state patterns in EEG signals with optimal parameter settings. For example, when the target binary feature mask vector contains 30 activated features, and the target hyperparameters specify that the support vector machine uses a Gaussian kernel function with C set to 10, the final constructed model will operate in this 30-dimensional signal feature space and construct the decision boundary with a Gaussian kernel.
[0091] S105. Input the EEG signal data into the fatigue detection model to obtain the fatigue index; After constructing the fatigue detection model, to achieve automatic identification and quantification of fatigue states in EEG signal data, the EEG signal data of the person to be tested needs to be input into the model, and the fatigue index is output as the basis for judgment. The fatigue index is a numerical mapping of the model's classification prediction result for the input signal data, usually representing the individual's current fatigue level in the form of probability value or interval score. The input data needs to undergo the same preprocessing and feature extraction process as in the training phase to extract the feature dimensions corresponding to the target binary feature mask vector, forming a feature vector group consistent with the model input structure. Subsequently, this feature vector is input into the configured fatigue detection model, and the model will output a continuous value based on the discrimination boundary or mapping function learned during its training, representing the discrimination score of the current input sample in the fatigue category. For example, if a probabilistic output is used, the model may output a predicted probability of 0.87 for the fatigue state of 1, representing that the current input has an 87% confidence level of fatigue state. This fatigue index can not only be used for binary classification (fatigue / non-fatigue), but also as a continuous indicator for dynamically monitoring changes in fatigue trends, which helps to generate more flexible early warning strategies.
[0092] S106. Generate an early warning signal based on the fatigue index.
[0093] Based on the fatigue index output by the model, to achieve real-time response and intelligent intervention to individual fatigue states, the system needs to generate early warning signals to prompt users to take necessary rest, switch personnel, or take other safety measures. The early warning signal generation mechanism is based on a set fatigue index threshold strategy, which can be flexibly configured according to the system application scenario. For example, in the transportation field, it can be set to trigger a level one warning when the fatigue index exceeds 0.75 and a level two warning when it exceeds 0.9. After obtaining the fatigue index output by the model, the system compares the value with the preset threshold. If the threshold is exceeded, the corresponding level of warning logic is triggered. Early warning signals can be presented in a multimodal manner, including sound prompts, visual warning interfaces, or vibration feedback, to ensure that drivers or operators can detect their fatigue state and take measures immediately. Through this approach, the system achieves a closed-loop fatigue management process from EEG signal perception and state recognition to behavioral intervention. For example, when the model outputs a fatigue index of 0.82, the system recognizes that it exceeds the first-level warning threshold of 0.75 and immediately issues a voice broadcast saying "Fatigue detected, please pay attention to safety." At the same time, the interface displays a red warning icon and guides the user to take a short rest, thereby effectively reducing the probability of risk events caused by fatigue.
[0094] Please see Figure 3 This is a schematic diagram of a fatigue detection system based on the cuckoo algorithm in an embodiment of this application.
[0095] It should be noted that, Figure 3The structure of the fatigue detection system based on the cuckoo algorithm shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0096] like Figure 3 As shown, a fatigue detection system based on the Cuckoo algorithm includes a central processing unit 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory 302 or a program loaded from a storage section 308 into a random access memory 303, such as executing the method described in the above embodiments. The random access memory 303 also stores various programs and data required for system operation. The central processing unit 301, the read-only memory 302, and the random access memory 303 are interconnected via a bus 304. An input / output interface 305 is also connected to the bus 304.
[0097] The following components are connected to the input / output interface 305: an input section 306 including audio input devices, push-button switches, etc.; an output section 307 including an LCD display, audio output devices, indicator lights, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the input / output interface 305 as needed. A removable medium 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 310 as needed so that computer programs read from it can be installed into the storage section 308 as needed.
[0098] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing computer programs for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by central processing unit 301, it performs the various functions defined in the present invention.
[0099] It should be noted that specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, flash memory, optical fiber, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0100] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those shown in the drawings.
[0101] Specifically, a fatigue detection system based on the cuckoo algorithm in this embodiment includes a processor and a memory. The memory stores a computer program. When the computer program is executed by the processor, it implements a fatigue detection method based on the cuckoo algorithm provided in the above embodiment.
[0102] In another aspect, the present invention also provides a computer-readable storage medium, which may be included in the fatigue detection system based on the cuckoo algorithm described in the above embodiments; or it may exist independently and not assembled into the fatigue detection system based on the cuckoo algorithm. The storage medium carries one or more computer programs, which, when executed by a processor of the fatigue detection system based on the cuckoo algorithm, cause the fatigue detection system to implement the fatigue detection method based on the cuckoo algorithm provided in the above embodiments.
Claims
1. A fatigue detection method based on the cuckoo algorithm, characterized in that, The method includes: The brainwave signal data of the person to be tested is acquired, and feature extraction is performed on the brainwave signal data to obtain an original feature pool, which includes multiple signal features. Individuals to be optimized are randomly generated based on the original feature pool. Each individual to be optimized includes a binary feature mask vector in the original feature pool and initial hyperparameters for configuring a preset classifier. The binary feature mask vector includes a binary feature mask value corresponding to each signal feature. The binary feature mask value is used to characterize the feature selection state of the signal feature. Based on the preset improved cuckoo algorithm, the binary feature mask vectors of multiple individuals to be optimized and the initial hyperparameters are jointly iteratively optimized to obtain the target detection individual, wherein the target detection individual includes the target binary feature mask vector and the target hyperparameters; A feature subset is determined based on the target binary feature mask vector, and a fatigue detection model is constructed based on the feature subset and the target hyperparameter configuration classifier. The electroencephalogram (EEG) signal data is input into the fatigue detection model to obtain the fatigue index; An early warning signal is generated based on the fatigue index.
2. The method according to claim 1, characterized in that, The step of extracting features from the EEG signal data to obtain the original feature pool specifically includes: The EEG signal data is subjected to bandpass filtering and power frequency notch filtering to obtain a filtered signal; The filtered signal is divided into multiple time windows according to a preset time length, and the mean, variance, peak-to-peak value, zero crossover rate, waveform length and Hjorth parameter of the filtered signal in each time window are determined as time-domain features. The filtered signal is divided into multiple frequency bands, and the absolute spectral power, relative spectral power, spectral entropy and edge frequency of each frequency band are calculated to obtain the frequency domain characteristics. The sample entropy, permutation entropy, approximate entropy, and Lempel-Ziv complexity of the filtered signal are determined as nonlinear features; The connectivity characteristics are obtained by calculating the coherence, phase lock value, and transfer entropy between signals from different channels within each time window. The time-domain features, frequency-domain features, nonlinear features, and connectivity features are combined to form the original feature pool.
3. The method according to claim 1, characterized in that, Before performing joint iterative optimization of the binary feature mask vector and the initial hyperparameters of the individual to be optimized based on the preset improved cuckoo algorithm to obtain the target detection individual, the method further includes: Calculate the importance score of the signal features in the original feature pool, and determine the signal features whose importance score is greater than a preset importance threshold as key features; The preset improved cuckoo algorithm is constructed based on the key features and the standard cuckoo algorithm.
4. The method according to claim 3, characterized in that, The construction of the preset improved cuckoo algorithm based on the key features and the standard cuckoo algorithm specifically includes: The first improved cuckoo algorithm is obtained by replacing the single-objective fitness function of the standard cuckoo algorithm with a preset multi-objective fitness function. In the first improved cuckoo algorithm, a feature selection constraint is set to ensure that the selection ratio of the key features during the joint iterative optimization process is less than or equal to the preset retention rate, thus obtaining the second improved cuckoo algorithm. In the joint iterative optimization process of the second improved cuckoo algorithm, the first preset repair strategy and the second preset repair strategy are executed alternately based on the preset repair strategy to obtain the preset improved cuckoo algorithm.
5. The method according to claim 4, characterized in that, The preset multi-objective fitness function specifically includes: Where J(x) is the preset multi-objective fitness function, and x is the individual to be optimized. The classification accuracy score of the signal features is given by |S| / N, where |S| is the feature size coefficient, |S| is the number of selected features, N is the total number of features in the original feature pool, Stab is the feature group stability score, which is the Bootstrap-Jaccard index, Latency(S) is the latency score, and α, β, γ, δ and η are preset weight coefficients.
6. The method according to claim 1, characterized in that, The method of jointly iteratively optimizing the binary feature mask vector and the initial hyperparameters of the individual to be optimized based on the preset improved cuckoo algorithm to obtain the target detection individual specifically includes: Initialize a group of individuals to be optimized, wherein the group of individuals to be optimized includes multiple individuals to be optimized; The following operations are performed repeatedly within a preset number of iterations, and the loop terminates when the number of iterations equals the preset number of iterations or when the updated group of individuals to be optimized meets the preset termination iteration condition: Based on the Levy flight mechanism of the preset improved cuckoo algorithm, the binary feature mask vector and the initial hyperparameters of each individual to be optimized are perturbed to obtain multiple first target individuals to be optimized; Based on a preset redundancy suppression operator, the binary feature mask value corresponding to the redundant features in multiple first target individuals to be optimized is modified to zero, and the binary feature mask value corresponding to the filler signal feature in the original feature pool is modified to one, thereby obtaining multiple second target individuals to be optimized. The filler signal feature is the signal feature that has the same feature type as the redundant feature but a different feature channel and the highest correlation with the redundant feature among the signal features that were not selected in the target individuals to be optimized except for the redundant feature. Based on a preset group / hierarchical crossover operator, multiple individuals to be optimized for the second target are combined to obtain candidate optimized individuals. Then, the candidate optimized individuals are subjected to feasibility repair based on preset feature selection constraints to obtain the first target candidate optimized individuals. Based on a preset repair strategy cycle, the first preset repair strategy and the second preset repair strategy are alternately executed on the first target candidate optimization individual to obtain the second target candidate optimization individual; The population of individuals to be optimized is updated based on the preset multi-objective fitness function to obtain the updated population of individuals to be optimized. When the number of iterations equals the preset number of iterations or the updated group of individuals to be optimized meets the preset termination iteration condition, the individual with the lowest fitness in the updated group of individuals to be optimized is determined as the target detection individual.
7. The method according to claim 6, characterized in that, The step of updating the group of individuals to be optimized based on the preset multi-objective fitness function to obtain the updated group of individuals to be optimized specifically includes: The candidate fitness of the second target candidate optimization individual is calculated according to the preset multi-objective fitness function; The candidate fitness is compared with the target fitness of the individual to be optimized corresponding to the second target candidate optimization individual in the individual to be optimized group. If the candidate fitness is less than the target fitness, the individual to be optimized corresponding to the second target candidate optimization individual in the individual to be optimized group is replaced with the second target candidate optimization individual to obtain the updated individual to be optimized group.
8. A fatigue detection system based on the cuckoo algorithm, characterized in that, The fatigue detection system based on the cuckoo algorithm includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to cause the fatigue detection system based on the cuckoo algorithm to perform the method as described in any one of claims 1-7.
9. A computer-readable storage medium comprising instructions, characterized in that, When the instruction is run on the fatigue detection system based on the cuckoo algorithm, the fatigue detection system based on the cuckoo algorithm performs the method as described in any one of claims 1-7.
10. A computer program product, characterized in that, When the computer program product is run on the fatigue detection system based on the cuckoo algorithm, the fatigue detection system based on the cuckoo algorithm performs the method as described in any one of claims 1-7.