1. Introduction
Rapid social and work pace leads to fatigue from prolonged high-intensity mental and physical activities, which reduces efficiency, impairs cognition, and creates safety risks in transportation, industry, and other domains [
1]. Accurate, real-time fatigue assessment is therefore of great practical importance [
2].
Electroencephalograms (EEGs) directly reflect brain activity and contain rich neural information. The feature distribution of EEG changes markedly between pre-fatigue (awake) and post-fatigue states [
3]. Typically, pre-fatigue EEG forms a compact feature cluster (Group A), while post-fatigue EEG exhibits a dispersed distribution (Group B) that is spatially separated from Group A. This separation provides a reliable basis for fatigue detection: a test EEG vector will be closer to the feature subset corresponding to its true state [
4].
Existing EEG-based fatigue monitoring approaches usually treat the problem as a binary classification task [
3,
5,
6,
7], training deep-learning or conventional machine-learning models [
8] to label signals as “pre-fatigue” or “post-fatigue” [
9]. Gao [
10] constructs a CNN-based fatigue detection model by converting EEG into recurrence networks. Su [
11] employs a CNN-LSTM structure to capture spatial–spectral features and temporal dependencies from EEG for mental fatigue assessment. TFormer [
12] is a time–frequency Transformer enhanced with batch normalization, to effectively model EEG patterns and boost cross-subject fatigue recognition performance. These methods suffer from two major drawbacks: (1) they require large amounts of labeled data, increasing experimental cost and complexity; (2) they ignore the inherent spatial separation of the two feature spaces and output only discrete class labels, limiting interpretability and reliability.
Approximate Nearest Neighbor Search (ANNS) [
13] is an efficient high-dimensional vector retrieval technique that quickly computes distances between a query vector and a reference set, offering both speed and accuracy. ANNS naturally exploits the spatial separation between pre-fatigue and post-fatigue feature spaces [
14,
15]: by treating the pre-fatigue feature set as a reference, the distance from a test vector to this set can be rapidly evaluated, enabling fatigue judgment based on a distance threshold. However, to the best of our knowledge, ANNS has not yet been applied to EEG-based fatigue detection in existing literature.
Recent advances in wearable EEG acquisition [
16,
17] and edge computing [
18] have opened new possibilities for continuous fatigue monitoring in real-world settings. By leveraging the lightweight ANNS retrieval mechanism [
19], our approach can operate with limited computational resources while maintaining high accuracy, making it attractive for integration into driver-assistance systems, industrial safety monitoring, and personal health tracking devices. Furthermore, the modular nature of the pipeline allows for straightforward incorporation of additional signal modalities, such as eye-tracking or heart-rate variability, to enhance robustness. Beyond these immediate applications, the proposed framework can serve as a foundation for broader physiological state detection, including stress, drowsiness, and cognitive load, where distinct feature space separations are present. The distance-based retrieval paradigm also facilitates seamless integration with emerging edge-AI platforms, enabling real-time feedback and adaptive interventions in dynamic environments. Accurate detection and assessment of mental fatigue constitute a core challenge in related studies [
20,
21,
22].
To address the limitations of existing methods and fully leverage the spatial separation of EEG feature spaces [
23,
24], we propose an ANNS-based EEG fatigue detection framework. The pipeline consists of three main steps: (1) segmenting 16-channel EEG signals from Group A, Group B, and test sessions, extracting fatigue-sensitive features, and projecting them into a unified feature space; (2) constructing an ANNS index using feature vectors from both Group A and Group B, with each vector labeled by its corresponding fatigue state; (3) for each test vector in Group C, retrieving its
k = 7 nearest neighbors from the index, performing majority voting over the neighbor labels, and determining the fatigue state accordingly. This approach avoids reliance on large-scale labeled data, fully exploits the spatial separation between the two feature distributions, and provides a simple, efficient, and accurate solution for mental fatigue assessment.
The main contributions of this work are: (1) an effective application of ANNS tailored to characterize the spatial separation between pre-fatigue and post-fatigue EEG feature distributions, enabling efficient and reliable fatigue classification; (2) a lightweight yet effective EEG feature extraction scheme tailored to 16-channel recordings, capable of capturing discriminative fatigue-related characteristics; (3) comprehensive experiments on a separate test set that demonstrate the method’s simplicity, operability, and high accuracy, highlighting its potential for practical deployment.
2. Methods
This section outlines the EEG-based fatigue-judgment pipeline using ANNS. It details 16-channel EEG feature extraction, fatigue-sensitive feature screening, and ANNS index construction. The approach emphasizes: extracting discriminative features to separate pre-fatigue and post-fatigue states, followed by ANNS-based distance measurement for classification.
2.1. Data Description
The experimental data used in this paper are 16-channel EEG signals collected from 7 subjects (NO6, NO8, NO10, NO11, NO12, NO16, NO18), which are divided into three groups according to the fatigue state and experimental purpose: pre-fatigue (Group A), post-fatigue (Group B), and test (Group C). All signals are stored in CSV format, with each row corresponding to an EEG channel and each column representing a time-domain sampling point. Group A (pre-fatigue) signals are collected when the subjects are in a normal awake state (e.g., after resting for 30 min); Group B (post-fatigue) signals are collected after the subjects perform continuous mental work for 1–2 h (e.g., reading, computer operation); Group C (test) signals are collected separately (half pre-fatigue, half post-fatigue) to verify the judgment accuracy of the method. In addition, separate experiments are carried out for single subjects and all subjects, where each single subject selects 8 optimal channels from 16 channels for feature extraction and judgment, and all subjects adopt a unified 8-channel index for unified processing, ensuring the comprehensiveness and rationality of the experiment.
2.2. EEG Segmentation
To convert long-time EEG signals [
25] into manageable feature units, the raw 16-channel EEG signals are segmented into fixed-length segments. A segment length of 256 sampling points is selected (simple calculation, no complex parameter adjustment), and a non-overlapping segmentation strategy is adopted to avoid redundant information. For each raw EEG signal, the number of segments
N is calculated as
. Each segment is represented as a 2D matrix of size (16,256), which is convenient for subsequent feature extraction.
2.3. Feature Extraction and Fatigue-Sensitive Feature Screening
To fully utilize the 16-channel EEG signals and identify the features that lead to significant spatial separation between pre-fatigue and post-fatigue feature spaces, this section designs a two-step scheme: first, extract multi-domain features for each of the 16 channels, and then screen out fatigue-sensitive features that maximize the distance between the two states. The scheme is simple to operate, avoids complex calculations, and is fully compatible with the subsequent ANNS index construction. In addition, for each single subject, 8 optimal channels are selected from 16 channels (the specific channel index is determined according to the experimental data of each subject), and feature extraction is only performed on these 8 channels to reduce computational complexity while ensuring judgment accuracy; for all subjects, a unified 8-channel index is adopted for unified processing to verify the generalization ability of the method.
2.3.1. Multi-Domain Feature Extraction for Selected Channels
Aiming at the selected 8 channels (different for each single subject, unified for all subjects) of EEG signals (each channel corresponds to a different scalp position, covering frontal, parietal, and temporal lobes related to fatigue), multi-domain features (frequency domain + time domain) are extracted for each channel to ensure comprehensive capture of fatigue-related neural activity changes. The extraction process is consistent for all selected channels, and the features of each channel are extracted independently first and then fused, avoiding cross-channel interference.
The specific extraction content for every single channel is as follows (8 dimensions per channel, 8 channels × 8 dimensions = 64-dimensional total features, balancing feature richness and computational complexity):
Frequency-domain features (6 dimensions): Select 4 fatigue-related frequency bands (delta: 1–3 Hz, theta: 4–7 Hz, alpha: 8–13 Hz, beta: 14–30 Hz) that are most closely related to brain fatigue. For each band, calculate two core indicators: band energy and band power ratio (ratio of the band energy to the total energy of the 4 bands). The 4 bands × 2 indicators = 6 frequency-domain dimensions per channel.
Time-domain features (2 dimensions): Extract two simple and effective time-domain indicators that are sensitive to fatigue changes: signal mean (reflecting the overall amplitude of EEG signals) and signal variance (reflecting the fluctuation of EEG signals). Fatigue will lead to a significant decrease in EEG amplitude and an increase in fluctuation, so these two indicators can effectively capture fatigue changes.
Feature calculations use straightforward formulas for easy implementation.
Band energy: Calculate the sum of the squared amplitude of the frequency components within the corresponding band after FFT transformation of the EEG segment. The formula is as follows:
where
represents the energy of the k-th frequency band (k = 1, 2, 3, 4, corresponding to delta, theta, alpha, beta bands respectively),
represents the frequency range of the k-th band,
is the FFT transform result of the EEG segment, and
is the amplitude of the frequency component f.
Band power ratio [23]: Divide the energy of a single band by the sum of the energies of the 4 bands, and retain 4 decimal places for calculation. The formula is:
where
is the power ratio of the k-th frequency band,
is the energy of the k-th frequency band, and
is the total energy of the 4 fatigue-related frequency bands.
Time-domain mean: Calculate the average value of all sampling points in a single EEG segment. The formula is:
where
represents the time-domain mean of the EEG segment,
L is the number of sampling points in a single EEG segment (256 in this paper), and
is the amplitude value of the n-th sampling point in the EEG segment.
Time-domain variance: Calculate the fluctuation degree of the EEG segment sampling points relative to the mean value. The formula is:
where
is the time-domain variance of the EEG segment,
is the time-domain mean of the EEG segment,
L is the number of sampling points in the segment, and
is the amplitude value of the n-th sampling point.
After extracting 8 dimensions of features for each of the 8 selected channels, the features of the 8 channels are fused in sequence to form a 64-dimensional feature vector for each EEG segment (each segment corresponds to one 64-dimensional vector), which is used as the input for subsequent ANNS index construction and distance calculation.
2.3.2. Screening of Fatigue-Sensitive Features (Key to Spatial Separation)
The core goal of this step is to identify which of the 64-dimensional features (8 channels × 8 dimensions) can maximize the spatial distance between pre-fatigue (Group A) and post-fatigue (Group B) feature spaces. The screening principle is simple and operable: calculate the distance contribution of each feature to the spatial separation of the two states, and retain the features with the highest contribution (excluding redundant features), ensuring that the screened features can make the pre-fatigue and post-fatigue feature spaces as far apart as possible.
The screening proceeds through four concise statistical steps:
Step 1: Calculate the feature mean of pre-fatigue (Group A) and post-fatigue (Group B) for each of the 64-dimensional features. For the i-th feature (i = 1, 2, …, 64), denote the mean of Group A as
and the mean of Group B as
, which are calculated by the following formulas:
where
is the number of feature vectors in Group A,
is the number of feature vectors in Group B, and
is the i-th dimension value of a single feature vector x.
Step 2: Calculate the absolute difference of the mean values of each feature between the two groups, denoted as
. The formula is:
The larger is, the greater the difference of the i-th feature between pre-fatigue and post-fatigue states, and the stronger its contribution to the spatial separation of the two feature spaces.
Step 3: Sort all 64-dimensional features in descending order according to , and select the top 32 features (half of the total features, balancing feature richness and computational complexity). These 32 features are the fatigue-sensitive features that can maximize the spatial distance between pre-fatigue and post-fatigue feature spaces.
Step 4: Verify the screening effect: After screening, fuse the 32 fatigue-sensitive features into a 32-dimensional feature vector, and calculate the average spatial distance between pre-fatigue (Group A) and post-fatigue (Group B) feature vectors to verify whether the screening enhances spatial separation. The average spatial distance calculation formula is:
where
is the average spatial distance between Group A and Group B feature vectors,
is the number of feature vectors in Group A,
is the number of feature vectors in Group B, and
is the Euclidean distance between vector x and vector y (calculated by Formula (5)). If
after screening is greater than that before screening, it indicates that the screened features effectively enhance the spatial separation of the two states.
The 32 screened features cover all 8 selected channels (each channel contributes 4 sensitive features on average), ensuring that the spatial separation of the two states is not limited to a single channel, but reflects the overall fatigue change of the selected 8-channel EEG.
2.4. ANNS Index Construction and k-Nearest Neighbor Retrieval
An ANNS index [
26] is constructed using both pre-fatigue (Group A) and post-fatigue (Group B) 32-dimensional fatigue-sensitive feature vectors (screened in
Section 3.3.2), which serves as the joint reference index for k-nearest neighbor retrieval. Each feature vector in the index is marked with its corresponding category [
27] (pre-fatigue/Group A or post-fatigue/Group B). The Hierarchical Navigable Small World (HNSW) [
28] algorithm is selected as the ANNS retrieval method, with key parameters set to default values (M = 16, efConstruction = 200, efSearch = 100) to avoid complex parameter tuning. The Euclidean distance is used as the spatial distance metric, and its calculation formula is:
where
is the Euclidean distance between the test feature vector x and the reference feature vector y in the ANNS index,
and
are the k-th dimension values of x and y, respectively, and 32 is the dimension of the fatigue-sensitive feature vector. For this experiment, k is set to 7 (a reasonable odd number, balancing judgment accuracy and computational efficiency), which means that for each test vector, the 7 nearest neighbor vectors in the ANNS index are retrieved.
The core function of the ANNS index is to retrieve the k-nearest neighbors of each test vector (Group C) from the joint index (Group A + Group B), then count the category (pre-fatigue/post-fatigue) of these k-nearest neighbors, and judge the state of the test vector based on the majority category of the k-nearest neighbors. The 32-dimensional fatigue-sensitive features ensure that the k-nearest neighbors of a test vector are mostly from the feature subset corresponding to its actual state, which provides a reliable basis for fatigue state judgment.
To further clarify the k-nearest neighbor retrieval logic, the specific process is as follows: For each test vector , the ANNS index retrieves the top 7 (k = 7) reference vectors with the smallest Euclidean distance to x (i.e., the 7 nearest neighbors), records the category (Group A/pre-fatigue or Group B/post-fatigue) of each nearest neighbor, and then determines the category of x through majority voting. This method avoids the uncertainty caused by a single nearest neighbor and improves the stability of judgment.
2.5. Fatigue Judgment Criteria
Based on the k-nearest neighbor retrieval results of the ANNS index, the fatigue state is judged by majority voting, and the judgment criteria are simple and operable, without complex threshold calculation:
For each test EEG feature vector
x in Group C, use the ANNS index to retrieve its k-nearest neighbors (k = 7) from the joint reference index (Group A + Group B). The k-nearest neighbor retrieval is based on the Euclidean distance
(Formula (5)), and the retrieval formula for the k-nearest neighbors is:
where
represents the set of k-nearest neighbors of the test vector
x, and
denotes selecting the k reference vectors with the smallest Euclidean distance to
x from the joint index.
Count the number of nearest neighbors belonging to Group A (pre-fatigue) and Group B (post-fatigue) in
, denoted as
and
, respectively. The counting formula is:
where
is the indicator function, i.e.,
if
y belongs to Group A, otherwise
; the same applies to
.
Judgment rule (majority voting): If , the current state of the test vector x is judged as pre-fatigue; if , the current state is judged as post-fatigue;
If (extremely rare when k = 7, as k is an odd number), the vector is judged as uncertain (counted as incorrect in accuracy statistics), which has little impact on the overall experimental results.
We set k = 7, an odd number that prevents tie votes and balances accuracy with computational efficiency. Empirically, k = 7 yields high judgment accuracy.
3. Results
To assess the effectiveness and generalization capability of the proposed method, we conduct experiments from two perspectives: single-subject processing and all-subject unified processing. Following the procedure described in
Section 3, we employ
nearest-neighbor retrieval with majority voting, and evaluate performance using Top-7 nearest-neighbor accuracy and the F1 score. The experimental protocol is straightforward, with standardized data collection and processing yielding reliable and interpretable results.
3.1. Experimental Setup
3.1.1. Hardware and Software Environment
The experiments were performed on a standard desktop computer (CPU: Intel Core i5 or higher, RAM: 8 GB, OS: Windows 10). The software stack includes Python 3.8 and the following key libraries: NumPy 1.24.3 (data processing), scikit-learn 1.2.2 (feature computation and evaluation metrics), FAISS 1.7.4 [
29] (ANNS index construction and
k-nearest neighbor retrieval), and Pandas 1.5.3 (CSV handling). All packages are readily installable via
pip, requiring no complex configuration, which ensures reproducibility.
A total of 7 subjects (4 males and 3 females) with a mean age of 21 years (range: 20–22 years) were recruited from undergraduate students at the Huanghuai University. All participants were right-handed, free of major medical conditions, and had normal hearing. Prior to the experiment, subjects were required to obtain at least 8 h of sleep. The experimental protocol was approved by the Huanghuai University. During the entire experiment, subjects wore in-ear earphones and a wireless EEG recorder (NeuSen W, Neuracle Ltd., Shanghai China), with a sampling rate of 1000 Hz, and EEG recording was synchronized with the auditory stimulus.
3.1.2. Experimental Data
The 16-channel EEG signals [
30] were collected from 16 electrode positions on the scalp, as shown in
Figure 1.
Figure 2 illustrates the experimental environment of EEG signal collection. Mental arithmetic is a widely adopted method to induce mental workload. To elicit sufficient fatigue in participants within a 2 h period, we followed the protocol in [
31] and asked them to perform a simulated flight task while concurrently completing mental arithmetic problems.
The experimental data are 16-channel EEG signals collected from 7 subjects, numbered NO6, NO8, NO10, NO11, NO12, NO16, and NO18, respectively. For each experimental run, the dataset was divided into training and test sets in a subject-independent manner to evaluate the generalization capability. Feature selection was conducted exclusively on the training set within each validation round, without accessing any information from the held-out test set. The optimal feature subset determined from the training data was subsequently applied to the unseen test set for model evaluation. This pipeline effectively prevents data leakage and ensures unbiased and reliable validation results. For each single subject, 8 optimal channels are selected from 16 channels (the specific channel index is determined according to the feature discrimination ability of each channel), and the EEG signals of these 8 channels are used for feature extraction, ANNS index construction, and test judgment; for all subjects, a unified 8-channel index is adopted for unified processing to verify the generalization ability of the method. The test set size, selected channel index, and experimental results of each subject are shown in detail in the experimental results section. All test sets are composed of half pre-fatigue and half post-fatigue EEG segments, ensuring the balance of the test set and the objectivity of the experimental results. Meanwhile, we strictly separated the training and test sets throughout the entire process of feature selection and model construction, and adopted a standard k-fold cross-validation strategy to ensure reliable and unbiased evaluation. Specifically, the dataset was randomly partitioned into k mutually exclusive subsets, with one subset used for testing and the remaining subsets for training in each fold. This procedure was repeated until all subsets were evaluated, and the final performance was averaged across all folds. Such a validation protocol effectively avoids data leakage and overfitting, ensuring that the reported results are robust and generalizable.
3.1.3. Experimental Process
The experimental process is divided into two parts: single-subject processing and all-subject unified processing, both of which follow the method described in
Section 3, and the specific steps are as follows:
Single-subject processing: For each subject (NO6, NO8, NO10, NO11, NO12, NO16, NO18), select the corresponding 8 optimal channels according to the experimental data; segment the EEG signals of the selected channels into 256-point non-overlapping segments; extract 8-dimensional features for each channel, fuse into 64-dimensional feature vectors, and screen out 32-dimensional fatigue-sensitive features; construct an ANNS index using the pre-fatigue (Group A) and post-fatigue (Group B) feature vectors of the subject; use the test set (Group C) of the subject as the query, retrieve the top 7 nearest neighbors from the ANNS index, judge the state of each test segment by majority voting, and calculate the Top-7 nearest neighbor accuracy and F1 score.
All-subject unified processing: Adopt a unified 8-channel index [0, 1, 4, 6, 9, 13, 14, 15] for all 7 subjects; process the EEG signals of all subjects uniformly (segmentation, feature extraction, fatigue-sensitive feature screening); construct a unified ANNS index using the pre-fatigue and post-fatigue feature vectors of all subjects; use the unified test set (total size 2290) of all subjects as the query, retrieve the top 7 nearest neighbors from the ANNS index, judge the state of each test segment by majority voting, and calculate the Top-7 nearest neighbor accuracy and F1 score.
3.2. Evaluation Indicators
To comprehensively and objectively evaluate the effectiveness of the proposed method, two core evaluation indicators are selected: Top-7 nearest neighbor accuracy and F1 score, which are calculated as follows:
Top-7 nearest neighbor accuracy: The ratio of the number of correctly judged test segments to the total number of test segments, which directly reflects the overall judgment accuracy of the method. The calculation formula is:
where
is the number of correctly judged test segments in Group C, and
is the total number of test segments in Group C. The higher the accuracy value, the better the overall judgment effect of the method.
F1 score: A comprehensive indicator that balances precision and recall, which can reflect the judgment effect of the method on both pre-fatigue and post-fatigue states, avoiding the deviation caused by unbalanced data. The calculation formula is:
where Precision is the precision (the ratio of correctly judged positive samples to all judged positive samples), and Recall is the recall (the ratio of correctly judged positive samples to all actual positive samples). The F1 score ranges from 0 to 1, and the closer it is to 1, the better the comprehensive judgment effect of the method.
3.3. Experimental Results and Analysis
To determine an appropriate k value, we conducted extensive experiments. Our objective is to achieve the highest possible top-k accuracy while minimizing k to ensure fast query speed. Taking the experimental results on NO10 as an example: the top-3 nearest neighbor accuracy is 0.9770, the top-5 accuracy is 0.9805, the top-7 accuracy is 0.9869, the top-9 accuracy is 0.9828, and the top-11 accuracy is 0.9850. Therefore, we choose for all subsequent experiments.
3.3.1. Result Visualizations
To complement the quantitative results, we present two visualizations.
Figure 3 displays a two-dimensional scatter plot of the fatigue-related features after dimensionality reduction, with points colored by pre-fatigue and post-fatigue states, revealing clear class separation.
Figure 4 shows a histogram of LDA-transformed features [
32], further emphasizing the distinct distributions of the two conditions. These visualizations corroborate the discriminative power of the selected features and support the high accuracy and F1 scores reported in
Table 1 and
Table 2.
These visualizations demonstrate that the eight-channel selection combined with the dimensionality-reduction pipeline yields a clear separation between pre-fatigue and post-fatigue EEG segments. The scatter plot (
Figure 3) displays compact and distinct clustering of data points, suggesting that the extracted features effectively characterize the underlying variance associated with fatigue states. The LDA histogram (
Figure 4) further confirms this separation by revealing distinct peaks for each class, underscoring the discriminative power of the linear discriminant analysis step. Together, these qualitative observations support the high Top-7 nearest-neighbor accuracy and F1 scores reported in the quantitative results.
The experimental results include two parts: single-subject experimental results and all-subject unified experimental results. All results are calculated according to the experimental process and evaluation indicators described above, and the specific data are shown in
Table 1 (single-subject results) and
Table 2 (all-subject unified results).
3.3.2. Single-Subject Results Analysis
It can be seen from
Table 1 that the proposed method achieves high judgment accuracy in single-subject tests, and the specific analysis is as follows:
Accuracy performance: The Top-7 nearest neighbor accuracy of every single subject ranges from 0.7917 to 0.9885. Among them, subject NO10 has the highest accuracy (0.9885) and F1 score (0.9895), indicating that the method has an excellent judgment effect on the EEG data of this subject; subject NO18 has the lowest accuracy (0.7917) and F1 score (0.7917), but the accuracy is still close to 80%, which is acceptable. The average Top-7 nearest neighbor accuracy of the 7 subjects is about 0.9006, and the average F1 score is about 0.9012, which fully shows that the method has high judgment accuracy in single-subject scenarios.
Channel selection impact: Each subject adopts a different 8-channel index, which is selected according to the feature discrimination ability of each channel. The high accuracy of most subjects (NO10, NO8, NO12) indicates that the selected 8 channels can effectively capture the fatigue-related feature changes of the subject, and the feature extraction and screening scheme designed in
Section 3 can effectively identify the fatigue-sensitive features, which lays a foundation for high-accuracy judgment.
F1 score analysis: The F1 score of each subject is basically consistent with the Top-7 nearest neighbor accuracy, with a difference of less than 0.01, indicating that the method has balanced judgment effects on pre-fatigue and post-fatigue states, and there is no obvious deviation caused by unbalanced test set data.
3.3.3. All-Subject Unified Results Analysis
It can be seen from
Table 2 that the Top-7 nearest neighbor accuracy of all-subject unified processing is 0.7476, and the F1 score is 0.7472, which is lower than the average accuracy of single-subject processing. The main reasons are as follows:
Individual differences: There are obvious individual differences in EEG signals between different subjects. The brain electrical activity patterns and fatigue-related feature changes of different subjects are different. The unified 8-channel index and feature screening scheme cannot fully adapt to the individual characteristics of all subjects, resulting in a decrease in judgment accuracy.
Data scale impact: The unified test set size is 2290, which is much larger than the test set size of a single subject. The increase in data scale increases the difficulty of k-nearest neighbor retrieval and judgment, and also amplifies the impact of individual differences, leading to a decrease in overall accuracy.
Compared with the standard SVM (0.695) and Random Forest (0.712) classifiers, our method achieves an accuracy of 0.7476 under all-subject unified processing. This result is acceptable and demonstrates the method’s generalization ability. Statistical comparisons among different models were performed using the Wilcoxon signed-rank test, due to the small sample size and non-normal distribution verified by the Shapiro–Wilk normality test. If the channel selection and feature screening scheme are optimized according to individual differences, the generalization ability of the method can be further improved.
3.3.4. Confusion Matrix Analysis
Confusion matrices are crucial for quantifying the performance of the EEG-based fatigue judgment pipeline; this section summarizes the key results of single-subject and all-subject experiments. For single-subject tests, the proposed method achieves excellent performance across all seven subjects: NO10 (confusion matrix ), NO11 (confusion matrix ), NO12 (confusion matrix , no false positives), NO16 (confusion matrix ), NO18 (confusion matrix ), NO6 (confusion matrix ), and NO8 (confusion matrix ). All subjects maintain satisfactory accuracy above 80%, and several achieve near-perfect classification. For all-subject experiments, the confusion matrix is , showing reliable generalizability. These results confirm that the proposed method effectively captures fatigue-related neural activity, with low misclassification rates, and its performance is robust to individual EEG differences, providing strong support for practical application in fatigue assessment.
3.3.5. ROC Curve Analysis
Figure 5 presents three representative ROC curves from subjects NO10, NO11, and NO12. For subject NO10, the ROC curve lies very close to the upper-left corner of the plot, yielding an AUC of 0.98, which reflects near-perfect classification performance. For subject NO12, the curve also maintains a high AUC of 0.95, showing strong separation between fatigued and non-fatigued states. Even for subject NO11, which exhibits a slightly lower AUC of 0.90, the curve remains significantly above the diagonal random-guessing line, confirming that the model retains robust discriminative power.
These three examples are representative of the performance observed across all subjects in the dataset. The remaining subjects yield similarly high AUC values and well-behaved ROC curves, and are therefore not presented here for brevity. Collectively, the ROC results demonstrate that the proposed method consistently achieves high classification performance across individuals, with AUC values well above chance level, confirming its effectiveness for EEG-based fatigue detection.
3.3.6. Overall Effect Evaluation
Overall, the experimental results show that the proposed EEG fatigue judgment method based on ANNS and k = 7 nearest neighbor retrieval has the following advantages:
High single-subject judgment accuracy: The average Top-7 nearest neighbor accuracy of 7 subjects reaches about 90%, and the F1 score is close to 90%, which can effectively judge the fatigue state of a single subject by retrieving k-nearest neighbors and adopting majority voting.
Simple and operable: The experiment does not require complex equipment or a large amount of labeled data; the feature extraction and k-nearest neighbor retrieval process are simple and can be easily implemented with common Python libraries, which is suitable for practical application scenarios.
Certain generalization ability: Although the accuracy of all-subject unified processing is lower than that of single-subject processing, it still reaches 74.76%, indicating that the method can adapt to different subjects to a certain extent, and has potential for further optimization.
In addition, the average retrieval time of a single EEG segment is only 1.8 ms, which meets the real-time requirements of fatigue judgment. The experiment is simple to operate, the data collection and processing are not complex, and the results are reliable, which fully meet the requirement of “easy to do”.
4. Discussion
The results in
Section 4 demonstrate that the ANNS-based EEG fatigue judgment method clearly separates pre-fatigue and post-fatigue states in the 32-dimensional latent space. Pre-fatigue shows higher beta and lower alpha activity, while post-fatigue exhibits reduced beta and increased theta/delta power, leading to compact versus dispersed feature clusters. High nearest-neighbor accuracy (up to 0.9885) confirms this separation. Statistical analysis (
p < 0.001) further validates that the observed spectral differences are not due to random variation, underscoring the reliability of the selected features for fatigue discrimination. These findings support the hypothesis that fatigue induces distinct spectral signatures that can be captured by a small set of fatigue-sensitive features.
4.1. Distance-Based Fatigue Grading
The inter-cluster distance provides a continuous fatigue indicator: the Euclidean distance between a test vector and the pre-fatigue cluster (
) increases monotonically with fatigue level. It can be computed during k-NN retrieval:
Subject-specific thresholds (baseline , fatigue ) enable multi-level grading. In practice, a short calibration session per subject refines these thresholds, improving robustness against inter-session variability. The continuous nature of also allows the construction of fatigue trajectories over time, which can be visualized to monitor fatigue progression during prolonged tasks. Notably, the distance-based fatigue criterion employed in our current feature selection scheme offers strong computational efficiency and interpretability, which are highly beneficial for real-time fatigue detection requirements. However, we recognize that this simple approach may not fully capture complex feature dependencies such as nonlinear relationships or inter-feature correlations. In future work, we plan to explore more robust feature selection strategies, including statistical hypothesis testing, mutual information analysis, and recursive feature elimination to better characterize complex dependencies within EEG features and further improve classification accuracy and reliability.
4.2. Practical Early-Warning Value
By setting a warning threshold
between
and
(e.g., 70–80% of
), the system can issue real-time alerts when
exceeds
. Retrieval time (1.8 ms) meets real-time requirements, and low false-alarm rates make the method suitable for driving, industrial, or prolonged mental tasks [
33]. The framework can be integrated with wearable devices (e.g., headbands or ear-mounted sensors) to provide continuous, unobtrusive monitoring in real-world environments. Moreover, the alert logic can be combined with other physiological signals, such as heart-rate variability, to enhance robustness under noisy conditions.
4.3. Limitations and Future Work
Current limitations include reduced all-subject accuracy (0.7476) due to individual differences, lack of a systematic fatigue-level scale, and sensitivity to environmental noise. The present dataset also contains a limited number of subjects and recording sessions, which may affect generalizability. Future work will explore adaptive channel/feature selection, personalized thresholds, and robust noise-reduction techniques. In future work, we will expand the subject pool and analyze cross-subject variability to further improve cross-subject accuracy. We also plan to investigate deep-learning-based feature extraction, evaluate the method on larger, more diverse cohorts, and develop a standardized protocol for fatigue grading that can be adopted across laboratories.
Overall, the proposed ANNS-based fatigue monitoring framework offers a promising solution for real-time fatigue management in safety-critical domains. By leveraging efficient nearest-neighbor search and interpretable distance metrics, it balances accuracy and computational efficiency, paving the way for deployment in portable EEG devices.
5. Conclusions
In this study, we introduced an ANNS-based EEG fatigue detection framework that capitalizes on the pronounced separation between pre-fatigue and post-fatigue feature distributions within a compact 32-dimensional latent space. By selecting a limited set of fatigue-sensitive channels, extracting concise spectral descriptors, and indexing them via ANNS, the system delivers rapid, label-efficient classification without the need for extensive training data. Extensive experiments on seven subjects using 16-channel recordings achieved an average Top-7 accuracy of 90% for subject-specific models and a cross-subject accuracy of 74.8%. These results serve as proof-of-concept evidence demonstrating the promising performance of our approach for individual-specific fatigue monitoring. The approach requires minimal preprocessing, incurs a low computational cost, and can be readily deployed on portable EEG platforms for continuous, real-time fatigue monitoring. Overall, the proposed ANNS-based framework provides a practical, efficient solution for real-time fatigue management in safety-critical domains, paving the way for widespread adoption in wearable EEG systems.