A Fusion of Transformer and EEGnet Models for Motor Imagery EEG Decoding

Document Type : Computer Article

Authors

1 Biomedical Engineering Department, Semnan University, Semnan, Iran

2 Electrical and Computer Engineering Faculty, Semnan University, Semnan, Iran

Abstract

Decoding motor imagery electroencephalograph (EEG) signals is a critical aspect of cognitive impairment assessments within the realm of Brain-Computer Interface (BCI) research. The inherent variability of these signals across different individuals poses a significant challenge in developing models that can accurately recognize and interpret them universally. Furthermore, the ability to detect individual motor imagery using shorter signal durations is crucial for enhancing the reliability and practicality of BCI systems. In this study, we propose a novel hybrid model that combines Transformer and EEGnet architectures for the classification of motor imagery EEG signals. The integration of Transformer and EEGnet enables our model to leverage both spatial and temporal features inherent in EEG data.  Our research demonstrates promising results, achieving an accuracy of 66.9% when evaluating 2-second trial data across diverse subjects using the Physionet dataset. Comparative evaluations against state-of-the-art models highlight the superior performance of our approach, particularly in achieving notable benchmarks with shorter trial durations.

Keywords

Main Subjects


[1] Maiseli, Baraka, Abdi T. Abdalla, Libe V. Massawe, Mercy Mbise, Khadija Mkocha, Nassor Ally Nassor, Moses Ismail, James Michael, and Samwel Kimambo. "Brain–computer interface: trend, challenges, and threats." Brain informatics 10, no. 1 (2023): 20.
[2] Saha, Simanto, Khondaker A. Mamun, Khawza Ahmed, Raqibul Mostafa, Ganesh R. Naik, Sam Darvishi, Ahsan H. Khandoker, and Mathias Baumert. "Progress in brain computer interface: Challenges and opportunities." Frontiers in systems neuroscience 15 (2021): 578875.
[3] Mishra, Shubhra, Osama Mahmudi, and Amin Jalali. "Motor imagery signal classification using adversarial learning: A systematic literature review." IEEE Access 12 (2024): 91053-91074.
[4] Xu, Fangzhou, Yitai Lou, Yunqing Deng, Zhixiao Lun, Pengcheng Zhao, Di Yan, Zhe Han et al. "Motor imagery EEG decoding based on TS-former for spinal cord injury patients." Brain Research Bulletin 224 (2025): 111298.
[5] Xu, Xiaoqi, Nicolas Drougard, and Raphaëlle N. Roy. "Does topological data analysis work for EEG-based brain–computer interfaces?." Journal of Neural Engineering 22, no. 3 (2025): 036026.
[6] Zhang, Jing, Xuxu Yang, Zilin Liang, Huanzhi Lou, Tong Cui, Cheng Shen, and Zhijun Gao. "A brain–computer interface system for lower-limb exoskeletons based on motor imagery and stacked ensemble approach." Review of Scientific Instruments 96, no. 1 (2025).
[7] Al-Saegh, Ali, Shefa A. Dawwd, and Jassim M. Abdul-Jabbar. "Deep learning for motor imagery EEG-based classification: A review." Biomedical Signal Processing and Control 63 (2021): 102172.
[8] Zarbafi, Sahar, Kourosh Kiani, and Razieh Rastgoo. "Spoken Persian digits recognition using deep learning." Journal of Modeling in Engineering 21, no. 74 (2023): 163-172.
[9] Anwar, Ayman, Yassin Khalifa, James L. Coyle, and Ervin Sejdic. "Transformers in biosignal analysis: A review." Information Fusion 114 (2025): 102697.
[10] Ali, Omair, Muhammad Saif-ur-Rehman, Tobias Glasmachers, Ioannis Iossifidis, and Christian Klaes. "ConTraNet: A hybrid network for improving the classification of EEG and EMG signals with limited training data." Computers in Biology and Medicine 168 (2024): 107649.
[11] Vafaei, Elnaz, and Mohammad Hosseini. "Transformers in EEG Analysis: A review of architectures and applications in motor imagery, seizure, and emotion classification." Sensors 25, no. 5 (2025): 1293.
[12] Bagherzadeh, Fahimeh, and Razieh Rastgoo. "Deepfake image detection using a deep hybrid convolutional neural network." Journal of Modeling in Engineering 21, no. 75 (2023): 19-28.
[13] Rastgoo, Razieh, and Kourosh Kiani. "Face recognition using fine-tuning of Deep Convolutional Neural Network and transfer learning." Journal of Modeling in Engineering 17, no. 58 (2019): 103-111.
[14] Alinezhad, Fatemeh, Kourosh Kiani, and Razieh Rastgoo. "A Deep Learning-based Model for Gender Recognition in Mobile Devices." Journal of AI and Data Mining 11, no. 2 (2023): 229-236.
[15] Li, Duan, Keyun Li, Yongquan Xia, Jianhua Dong, and Ronglei Lu. "Joint hybrid recursive feature elimination based channel selection and ResGCN for cross session MI recognition." Scientific Reports 14, no. 1 (2024): 23549.
[16] Deng, Xin, Daijiang Xu, Huaxiang Huo, Xinyi Hong, and Bin Liu. "Multi-level hierarchical dynamic graph convolutional networks for motor imagery EEG analysis." Neurocomputing 626 (2025): 129594.
[17] Hamidi, Arezoo, and Kourosh Kiani. "Motor Imagery EEG signals classification using a Transformer-GCN approach." Applied Soft Computing 170 (2025): 112686.
[18] Shi, Ji, Jiaming Tang, Zhihuan Lu, Ruolin Zhang, Jun Yang, Qiuquan Guo, and Dongxing Zhang. "A brain topography graph embedded convolutional neural network for EEG-based motor imagery classification." Biomedical Signal Processing and Control 95 (2024): 106401.
[19] Wu, Yelan, Pugang Cao, Meng Xu, Yue Zhang, Xiaoqin Lian, and Chongchong Yu. "Adaptive GCN and Bi-GRU-Based Dual Branch for Motor Imagery EEG Decoding." Sensors 25, no. 4 (2025): 1147.
[20] Chen, Yuanling, Peisen Liu, and Duan Li. "MST-DGCN: A multi-scale spatio-temporal and dynamic graph convolution fusion network for electroencephalogram recognition of motor imagery." Electronics 13, no. 11 (2024): 2174.
[21] Kabir, Md Humaun, Shabbir Mahmood, Abdullah Al Shiam, Abu Saleh Musa Miah, Jungpil Shin, and Md Khademul Islam Molla. "Investigating feature selection techniques to enhance the performance of EEG-based motor imagery tasks classification." Mathematics 11, no. 8 (2023): 1921.
[22] Lin, Ruijing, Chaoyi Dong, Peng Zhou, Pengfei Ma, Shuang Ma, Xiaoyan Chen, and Huanzi Liu. "Motor imagery EEG task recognition using a nonlinear Granger causality feature extraction and an improved Salp swarm feature selection." Biomedical Signal Processing and Control 88 (2024): 105626.
[23] Fan, Chengcheng, Banghua Yang, Xiaoou Li, and Peng Zan. "Temporal-frequency-phase feature classification using 3D-convolutional neural networks for motor imagery and movement." Frontiers in Neuroscience 17 (2023): 1250991.
[24] Djamal, E. C., and R. D. Putra. "Brain–computer interface of focus and motor imagery using wavelet and recurrent neural networks." Telkomnika 18, no. 5 (2020): 2748–2756.
[25] Fahimi, Fatemeh, Strahinja Dosen, Kai Keng Ang, Natalie Mrachacz-Kersting, and Cuntai Guan. "Generative adversarial networks-based data augmentation for brain–computer interface." IEEE transactions on neural networks and learning systems 32, no. 9 (2020): 4039-4051.
[26] Lawhern, Vernon J., Amelia J. Solon, Nicholas R. Waytowich, Stephen M. Gordon, Chou P. Hung, and Brent J. Lance. "EEGNet: a compact convolutional neural network for EEG-based brain–computer interfaces." Journal of neural engineering 15, no. 5 (2018): 056013.
[27] Sharma, Neha, Avinash Upadhyay, Manoj Sharma, and Amit Singhal. "Deep temporal networks for EEG-based motor imagery recognition." Scientific Reports 13, no. 1 (2023): 18813
[28] Zhang, Dongxue, Huiying Li, and Jingmeng Xie. "MI-CAT: A transformer-based domain adaptation network for motor imagery classification." Neural Networks 165 (2023): 451-462.
[29] Huang, Yuxuan, Jianxu Zheng, Binxing Xu, Xuhang Li, Yu Liu, Zijian Wang, Hua Feng, and Shiqi Cao. "An improved model using convolutional sliding window-attention network for motor imagery EEG classification." Frontiers in Neuroscience 17 (2023): 1204385.
[30] Chowdhury, Radia Rayan, Yar Muhammad, and Usman Adeel. "Enhancing cross-subject motor imagery classification in EEG-based brain–computer interfaces by using multi-branch CNN." Sensors 23, no. 18 (2023): 7908.
[31] Xie, Jin, Jie Zhang, Jiayao Sun, Zheng Ma, Liuni Qin, Guanglin Li, Huihui Zhou, and Yang Zhan. "A transformer-based approach combining deep learning network and spatial-temporal information for raw EEG classification." IEEE Transactions on Neural Systems and Rehabilitation Engineering 30 (2022): 2126-2136.
[32] Zhang, Jiayang, Kang Li, Banghua Yang, and Zhengrun Zhao. "Cross-dataset motor imagery decoding—A transfer learning assisted graph convolutional network approach." Biomedical Signal Processing and Control 102 (2025): 107213.
[33] Shirodkar, Vaishali, Damodar Reddy Edla, and Annu Kumari. "Generative Adversarial Networks for Motor Imagery Classification using Wavelet Packet Decomposition and Complex Morlet Transform." Multimedia Tools and Applications (2025): 1-24.
[34] Esfandiari, Nura, Kourosh Kiani, and Razieh Rastgoo. "A conditional generative chatbot using transformer model." Journal of Modeling in Engineering 23, no. 82 (2025): 99–113.
[35] Esfandiari, Nura, Kourosh Kiani, and Razieh Rastgoo. "Transformer-based generative chatbot using reinforcement learning." Journal of AI and Data Mining 12, no. 3 (2025): 349–358.
[36] Ahmadi, Amir Mohammad, Kourosh Kiani, and Razieh Rastgoo. "A transformer-based model for abnormal activity recognition in video." Journal of Modeling in Engineering 22, no. 76 (2024): 213–221.
[37] Schalk, Gerwin, Dennis J. McFarland, Thilo Hinterberger, Niels Birbaumer, and Jonathan R. Wolpaw. "BCI2000: a general-purpose brain-computer interface (BCI) system." IEEE Transactions on biomedical engineering 51, no. 6 (2004): 1034-1043.
[38] Wang, Xiaying, Michael Hersche, Batuhan Tömekce, Burak Kaya, Michele Magno, and Luca Benini. "An accurate eegnet-based motor-imagery brain–computer interface for low-power edge computing." In 2020 IEEE international symposium on medical measurements and applications (MeMeA), pp. 1-6. IEEE, 2020.
[39] Moaveninejad, Sadaf, Valentina D'Onofrio, Franca Tecchio, Francesco Ferracuti, Sabrina Iarlori, Andrea Monteriù, and Camillo Porcaro. "Fractal Dimension as a discriminative feature for high accuracy classification in motor imagery EEG-based brain-computer interface." Computer Methods and Programs in Biomedicine 244 (2024): 107944.
[40] Xie, Xin, Feng Huang, Yefeng Long, Youyuan Peng, and Wenjuan Zhou. "An optimized informer model design for electric vehicle SOC prediction." PloS one 20, no. 3 (2025): e0314255.
[41] Esfandiari, Nura, Kourosh Kiani, and Razieh Rastgoo. "A conditional generative chatbot using transformer model." Neural Computing and Applications (2025): 1–32.
[42] Sun, Dan, Jacky He, Hanlu Zhang, Zhen Qi, Hongye Zheng, and Xiaokai Wang. "A LongFormer-Based Framework for Accurate and Efficient Medical Text Summarization." In 2025 8th International Conference on Advanced Algorithms and Control Engineering (ICAACE), pp. 1527-1531. IEEE, 2025.