Early Warning of Epileptic Seizures through Generative Diffusion Model-based Multi-channel EEG Signals Forecasting.
Here, we provide a clean version of the EEG-DIF algorithm, allowing users to run the code on any EEG data to achieve future predictions for any time frame. This research is ongoing, and additional updates or code uploads will be made in the future.
This project is based on Pytorch. You can use the following command to install the Pytorch.
conda create -n EEGDiff python=3.9
conda activate EEGDiff
linux user
pip3 install torch torchvision torchaudio
pip install -r requirements.txt
windows user
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
pip install -r requirements.txt
MacOS user
pip3 install torch torchvision torchaudio
pip install -r requirements.txt
You should fill your wandb key in:
/train_eegdiff.py
Then, you can use the following command to train your model.
python train_eegdiff.py
You can use the following command to test your model.
python test_eegdiff.py
You can see some prediction results by using this code, like:
And you can also calculate the corresponding prediction metrics. You can save the generated future data locally and then run the classification code to carry out early diagnosis and warning of related diseases. Our code is an initial version that offers a novel solution and approach, and we welcome everyone to further improve and enhance it based on this foundation.