NOTE: The shell commands are included in the file named "prereq.txt". These need to be copied and executed from the terminal. Please ensure that all the packages present in "requirements.txt" are included in the system. Also, Python version 3.7 is needed to run the python scripts
- You will need to download the WFDB software package from physiotools/wfdb.tar.gz. I have downloaded the latest version and have included the same in the directory (this worked in my Windows 10 64 bit operating system)
- This file needs to be unzipped and installed on the local machine.
- Open DataMiner.sh file and change the path of the folder to which the records will be downloaded in.
- Run this bash script file from the terminal.
- Records will start downloading, and this could take some time
- Once these files have been downloaded, run the DataCleaner.sh file
- After this, run the organize_patients.py file. This will organize all the patient's records into a folder named "Out".
- Open "delete_short_extra.py" and change the path (details are present in the .py file) accordingly. Run this script, and certain records will be deleted.
- Further processing of the records will be done using MATLAB scripts.
- In the folder named "cleaning_scripts" present in the main folder, open the "main.m" file using MATLAB. Once opened, change the Input Directory (dirName) and Output Directory (testOutDir) for your machine.
- Remember to add the path of the cleaning_scripts folder to MATLAB since there are functions present in this folder that will be needed to run "main.m"
- The Input Directory is the place where the records had been downloaded and are now stored. The Output Directory is where the records after processing will be stored.
- Run this .m script file, and data cleaning should start. MATLAB will print outputs with each stage of record cleaning. Once after all records have been cleaned, there will also be some plots that will be generated.
- This completes data retrieval and pre-processing
A subset of data comprising the records of 17 patients has been downloaded and pre-processed
- Open train.py and change the respective directories (details are present in the .py file)
- Comment line 58 if you wish to train for the entire set of records (I have trained for five patient records)
- Open models.py and change the directory (details are present in the .py file)
- Training was done on Google Colab, hence only 1 GPU was used. If you wish to use more than 1 GPU, please uncomment line 130 of models.py
- Run train.py. Training should start, and once the model starts performing better than a threshold, the weights file will be saved
- Open test.py and change the appropriate paths (details are present in the .py file)
- Change the number of test records if needed (I have randomly selected 500 samples to test the network on)
- Run this file and testing should take place
Disclaimer: Due to file size limitations, I could not upload the data to GitHub. If you would like access to the data, please feel free to contact me at fatwir@gmail.com, and I will be happy to provide it to you.