{"id":22363883,"url":"https://github.com/amrzhd/eegnet","last_synced_at":"2025-05-09T00:10:07.508Z","repository":{"id":237970555,"uuid":"795602578","full_name":"amrzhd/EEGNet","owner":"amrzhd","description":"This project focuses on implementing CNN model based on the EEGNet architecture with Pytorch library for classifying motor imagery tasks using EEG data.","archived":false,"fork":false,"pushed_at":"2024-09-08T21:16:39.000Z","size":115,"stargazers_count":129,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-09T00:10:04.775Z","etag":null,"topics":["bci","bci-systems","convolutional-neural-networks","deep-learning","depthwise-convolutions","depthwise-separable-convolutions","eeg","eeg-signals","eegnet","machine-learning","python","pytorch","signal-processing"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amrzhd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-03T16:23:56.000Z","updated_at":"2025-05-08T08:48:42.000Z","dependencies_parsed_at":"2024-09-08T22:29:32.274Z","dependency_job_id":null,"html_url":"https://github.com/amrzhd/EEGNet","commit_stats":null,"previous_names":["amrzhd/eegnet"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrzhd%2FEEGNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrzhd%2FEEGNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrzhd%2FEEGNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrzhd%2FEEGNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amrzhd","download_url":"https://codeload.github.com/amrzhd/EEGNet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166521,"owners_count":21864482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bci","bci-systems","convolutional-neural-networks","deep-learning","depthwise-convolutions","depthwise-separable-convolutions","eeg","eeg-signals","eegnet","machine-learning","python","pytorch","signal-processing"],"created_at":"2024-12-04T17:17:32.668Z","updated_at":"2025-05-09T00:10:07.488Z","avatar_url":"https://github.com/amrzhd.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EEGNet for Motor Imagery Classification\n\n## Introduction\nWelcome to the EEGNet for Motor Imagery Classification repository! This project focuses on implementing a convolutional neural network (CNN) model based on the EEGNet architecture for classifying motor imagery tasks using electroencephalography (EEG) data. The model is designed to classify between four different motor imagery classes: Left Hand, Right Hand, Foot, and Tongue.\n\n## Dataset\nThe EEG data used in this project is sourced from the [BCI Competition IV 2a](http://www.bbci.de/competition/iv/#dataset2a) dataset. Key characteristics of the dataset include:\n- 9 Participants\n- 22 Ag/AgCl Electrodes\n- Sampling Frequency: 250 Hz\n- Epoched Data: [2, 6] seconds\n- Frequency Range: 0.5 - 100 Hz\n- Band Pass Filtered: 4 - 40 Hz (Using IIR Filter)\n- 4 Classes: Left Hand, Right Hand, Foot, Tongue\n- Both sessions of data (T \u0026 E) were used!\n### List of Events\nThe following events are annotated in the dataset:\n- '1023': 1 Rejected trial\n- '1072': 2 Eye movements\n- '276': 3 Idling EEG (eyes open)\n- '277': 4 Idling EEG (eyes closed)\n- '32766': 5 Start of a new run\n- '768': 6 Start of a trial\n- '769': 7 Cue onset **Left** (class 1) : 0 \n- '770': 8 Cue onset **Right** (class 2) : 1\n- '771': 9 Cue onset **Foot** (class 3) : 2 \n- '772': 10 Cue onset **Tongue** (class 4): 3\n\nEvents 7, 8, 9, and 10 were chosen for the classification.\n\n## Model\nThe EEGNet model architecture used in this project is detailed below:\n- **Block 1:** Two sequential convolutional steps are performed. First, F1 2D convolutional filters of size (1, 32) are applied to capture frequency information at 2Hz and above. Then, a Depthwise Convolution of size (C, 1) is used to learn a spatial filter. Batch Normalization and ELU nonlinearity are applied, followed by Dropout for regularization. An average pooling layer is used for dimensionality reduction.\n- **Block 2:** Separable Convolution is used, followed by Pointwise Convolutions. Average pooling is used for dimension reduction.\n- **Classification Block:** Features are passed directly to a softmax classification with N units, where N is the number of classes in the data.\n\nFor further details, refer to the original [EEGNet implementation](https://github.com/vlawhern/arl-eegmodels/tree/master).\n\n### Training Setup\n- Optimizer: Adam\n- Batch size: 64\n- Epochs: 500\n- Learning Rate: 0.001\n- Loss Function: Cross Entropy\n\n## Requirements\nTo run the code in this repository, make sure you have the following dependencies installed:\n- Python == 3.7 or 3.8\n- PyTorch == 2.3 (verified working with 2.0 - 2.3, both for CPU and GPU)\n- torch-summary == 1.4.5\n- mne \u003e= 0.17.1\n- scikit-learn \u003e= 0.20.1\n- matplotlib \u003e= 2.2.3\n\n## References\nIf you use this code or the EEGNet model architecture in your work, please cite the original paper of the orignal model:\n\n[V. J. Lawhern, A. J. Solon, N. R. Waytowich, S. M. Gordon, C. P. Hung, and B. J. Lance, \"EEGNet: A compact convolutional neural network for EEG-based brain–computer interfaces,\" Journal of Neural Engineering, vol. 15, no. 5, p. 056013, 2018.](https://iopscience.iop.org/article/10.1088/1741-2552/aace8c)\n\nIf you used the dataset in your work, please cite the original paper of it:\n\n[C. Brunner, R. Leeb, G. Müller-Putz, A. Schlögl, and G. Pfurtscheller, \"BCI Competition 2008–Graz data set A,\" Institute for Knowledge Discovery (Laboratory of Brain-Computer Interfaces), Graz University of Technology, vol. 16, pp. 1-6, 2008.](https://lampz.tugraz.at/~bci/database/001-2014/description.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famrzhd%2Feegnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famrzhd%2Feegnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famrzhd%2Feegnet/lists"}