$$\rightleftharpoonup{xx}$$
$$\longleftharp{xx}$$,
$$\longrightharp{xx}$$,
The study was conducted in accordance with the Declaration of Helsinki and approved by the Institutional Ethics Committee of SR University, Warangal, Telangana, India (Approval No. 007/2026). Informed consent was obtained in writing from all participants before data collection.
Participant Selection
EEG data were collected from 11 healthy participants (age range: 25–45 years; mean age: 28 years) with no history of neurological or psychiatric disorders. In this study, a total of 1175 EEG segments were considered, of which 527 belong to the relaxation class and 648 belong to the attention class. Participants whose EEG recordings exhibited excessive motion artifacts or poor signal quality were excluded.
EEG Acquisition Setup
The general layout of the suggested EEG-based brain-computer interface system is depicted in Figure 1, which shows the entire pipeline of signal acquisition, classification, and real-time use. The EEG data were recorded using a small biopotential acquisition module linked to a microcontroller-based system. The gel electrodes were placed based on the International 10–20 system namely, the prefrontal points of Fp1 and Fp2, with reference and ground electrodes placed at the ear lobes, as indicated in Figure 2. The signals were digitized at a rate of 128 Hz and sent to a computer using a self-written Python acquisition script. Adequate skin pre-treatment and conductive gel were used to reduce electrode impedance and enhance signal quality.
Experimental procedure
EEG recordings were performed under two cognitive conditions, relaxation and attention, following a standardized protocol. In the relaxation condition, the participant was seated in a comfortable, low-noise environment and instructed to remain still with minimal movement. Calming instrumental audio was played through earphones, and EEG acquisition was initiated using the command python collect.py. EEG signals were recorded for 5 min per session and repeated for four sessions. In the attention condition, the participant was instructed to perform attention-demanding tasks such as interactive games while maintaining the same acquisition setup as in the relaxation condition. EEG signals were recorded for 5 min per session and repeated for four sessions. Each participant took part for a total of 40 min, consisting of 20 min of relaxation and 20 min of attention tasks, enabling a reliable comparison of cognitive states.
The processed dataset was organized into labeled segments as follows: Relaxation (0); Attention (1). Each segment had a duration of 4 s with 50% overlap and was represented as a spectrogram using a short-time Fourier transform.
Signal Processing, Feature Representation, and Model Implementation
The obtained EEG signals were pre-processed to eliminate noise and artifacts. A 50 Hz notch filter was used to remove powerline interference, and a 4th -order Butterworth band-pass filter in the signal between 0.5 and 30 Hz was used to select the relevant EEG frequency bands. The Amplitude thresholding and visual inspection were used to identify artifact-contaminated segments, and approximately 8–12% of the data were deleted. Gaussian noise addition, time masking, and frequency masking are data augmentation methods used to improve model robustness. EEG signals were filtered and then divided into 4-second windows separated by 50 percent.
The individual EEG segments were converted to a time-frequency representation (Short-Time Fourier Transform), as shown in Equation (1), to allow the extraction of temporal and spectral characteristics.
(1)
The resulting spectrograms were normalized and resized to fixed dimensions to serve as inputs to the classification model. To prevent overlap-induced data leakage, the dataset was divided into training (70%), validation (10%), and testing (20%) subsets prior to segmentation, as illustrated in Figure 3. In addition, leave-one-subject-out (LOSO) cross-validation was performed to evaluate cross-subject generalization, where data from one subject were used for testing, whereas the remaining data were used for training.
The proposed SET-Net architecture, as shown in Figure 4, was designed to capture multi-dimensional EEG features. The model integrates a convolutional neural network (CNN) backbone to extract spatial–spectral representations, followed by a squeeze-and-excitation (SE) block that adaptively recalibrates the channel-wise feature importance, as described in Equation (2). The CNN backbone consists of two convolutional layers with a kernel size of 3 × 3, followed by batch normalization and exponential linear unit (ELU) activation
(2)
The internal structure of the SE block is shown in Figure 5. To capture long-range temporal dependencies, a transformer encoder was incorporated, the attention mechanism of which is defined in Equation (3) and illustrated in Figure 6.
(3)
An adaptive average pooling layer was used to reduce the feature maps to a fixed size of 16 × 16. The reduction ratio of the SE block is 8, which is used to recalibrate the channel-wise feature responses. The transformer encoder consisted of four layers with four attention heads, a feed-forward dimension size of 256, and a model embedding size of 128.
The final classification was performed using fully connected layers with dropout regularization and a softmax activation function to distinguish between the attention and relaxation states. The detailed layer-wise architecture of the proposed model is presented in Table 1.
The model was trained using the AdamW optimizer with an initial learning rate of 0.001 and weight decay of 1×10⁻4. A cosine annealing scheduler was used to enhance convergence, and 50 epochs were trained using a batch size of 32. Class imbalance was overcome using a weighted cross-entropy loss function, as described in Equation (4).
(4)
Table 2 summarizes the training configuration, and Table 3 presents the hyperparameter search of the proposed SET-Net, which was used in the EEG-based attention-relaxation classification. The selected parameters provide stability of the training, enhanced generalization, and tolerance to changes in EEG signals. The chosen parameters provide stability to the training process, enhance generalization, and resist alterations of the EEG signal. Accuracy, precision, recall, F1-score, and ROC-AUC were used to measure the model performance. All pipelines involving preprocessing, model training, and evaluation were written in Python using the PyTorch framework to ensure reproducibility. Table 4 provides a detailed description of troubleshooting to guide and solve problems associated with EEG acquisition, preprocessing, model training, and real-time use. Table 5 provides an overview of the materials of the EEG device to enable an easy framework for conducting experiments and the experimental setup. Python 3.8 with the PyTorch deep learning framework was used to implement the proposed SET-Net framework. Standard scientific computing libraries were used for signal preprocessing and feature extraction using NumPy, SciPy, and Matplotlib. Every experimental procedure was performed on a system with an Intel i7 processor and 16 GB RAM to hasten the training of the models.
DATA AVAILABILITY:
The anonymized EEG dataset generated and analyzed during this study is publicly available in the Zenodo repository under the following accession link: https://zenodo.org/records/19627795.
All data have been de-identified to ensure participant confidentiality in accordance with institutional ethical guidelines approved by the Institutional Ethics Committee of SR University (Approval No. 007/2026).
The processed information, model settings, and implementation specifics needed to recreate the results are presented in the manuscript, and the source code is publicly available at: https://github.com/Ravichanderj/SET-Net-EEG-BCI.