Coder Social home page Coder Social logo

landandland / cnns-on-chb-mit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from smorettini/cnns-on-chb-mit

0.0 0.0 0.0 4.31 MB

The project is about applying CNNs to EEG data from CHB-MIT to predict seizure

License: GNU General Public License v3.0

Python 100.00%

cnns-on-chb-mit's Introduction

CNNs-on-CHB-MIT

The project is about applying CNNs to EEG data from CHB-MIT to predict seizure. It's a group project assigned at UNIVERSITA' DI CAMERINO for computer science bachelor. The objective of the project was to try to replicate the result obtained in the paper: Truong, Nhan Duy, et al. "Convolutional neural networks for seizure prediction using intracranial and scalp electroencephalogram." Neural Networks 105 (2018): 104-111.

The algorithm consist to create spectograms of the data and than use them with a CNN model to predict seizure.

More information are in presentazione.pdf and relazione.pdf. The two file are respectively the presentation and the relation of the work in italian language.

Getting Started

Prerequisites

In the project anaconda was used to managed the packages. Packages required:

  • keras 2.2.2
  • python 3.6.6
  • tensorflow 1.10.0
  • matplotlib
  • numpy
  • pyedflib
  • scipy

For the evaluation of the network, training and testing, the GPU is used to have a fast evaluation. By using the CPU the training time is a lot more slowly than using GPU. Packages required for GPU:

  • tensorflow-GPU

For the using of the GPU this link was very useful to install all the driver for Ubuntu 18.04 LTS https://medium.com/@naomi.fridman/install-conda-tensorflow-gpu-and-keras-on-ubuntu-18-04-1b403e740e25 (Note that the GPU used was GTX 850M so I can't ensure that the guide linked will work for different hardware).

Installing

Download or clone the repository on your computer and set the parameters:

  • PARAMETERS_DATA_EDITING.txt: contain the parameters for the creation of the spectograms:

    • pathDataSet: path of the folder containing the dataset;
    • FirstPartPathOutput: path of the folder where spectograms will be saved;
  • PARAMETERS_CNN.txt: contain the parameters for the use of CNN:

    • PathSpectogramFolder: Path of the folder containing the spectograms;
    • OutputPath: file where to save the results;
    • OutputPathModels: where to save the CNN models.

Recovering data

The dataset is downloadable from this site: https://archive.physionet.org/pn6/chbmit/. To get all the data it's suggested to use this command:

wget -r --no-parent https://physionet.org/pn6/chbmit/

In the code only patients 1, 2, 5, 19, 21, 23 are used, the others are discarded for problems in the data. NOTE: For the patient 19 replace the summary file(chb19-summary.txt) with the one in this repository inside the folder summaryChanged.

Running

After setted all the parameters run the code.

python DataserToSpectogram.py #Creation of the spectograms
python CNN.py #Creation of the CNN and evaluation of the model on the spectograms
python TestThreshold.py #Search the best thresold for each patient

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the LICENSE.md file for details

cnns-on-chb-mit's People

Contributors

a311987 avatar smorettini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.