SPIRA is an project that aims to detect the presence of respiratory failure using deep learning. SPIRA stands for " Sistema de Detecção Precode de Insuficiência Respiratória por meio de Análise de Áudio" (in english, "Respiratory Failure Detection System Through Analysis of Audio").
All datasets are available under the CC BY-SA 4.0 license
- Clone the repo
- Install dependencies (see requirements.txt)
- Create a new model file in models module
- Create a config file
- Train and testing providing the config file
python train.py -c ./config.json
python train.py -c ./config.json --checkpoint_path ./checkpoint.pt
python test.py -t ../SPIRA_Dataset_V1/metadata_test.csv -r ../SPIRA_Dataset_V1/ -c ./config.json --checkpoint_path ./checkpoint.pt
pip install -r requirements.txt
Alternatively, you can create an environment with the provided file.
conda env create -f spira_environment.yml
python train.py [-c, --config_path] [--checkpoint_path]
details:
*'-c', '--config_path', type=str, required=True, help="json file with configurations get in checkpoint path"
*'--checkpoint_path', type=str, default=None, required=True, help="path of checkpoint pt file, for continue training"
- Add option with model name in model_name property of config.json (or create another json configuration file);
- Create a module in the models package and import your model class in train.py script;
- Add an option for it in the if... else chain in test.py line 58
- Import model from models in test.py.
- Add an option for it in the if... else chain in test.py line 77
python test.py [-t, --test_csv] [-r, --test_root_dir] [-c, --config_path] [--checkpoint_path] [--batch_size] [--num_workers] [--no_insert_noise]
details:
*'-t', '--test_csv', type=str, required=True, help="test csv example: ../SPIRA_Dataset_V1/metadata_test.csv"
*'-r', '--test_root_dir', type=str, required=True, help="Test root dir example: ../SPIRA_Dataset_V1/"
*'-c', '--config_path', type=str, required=True, help="json file with configurations get in checkpoint path"
*'--checkpoint_path', type=str, default=None, required=True, help="path of checkpoint pt file, for continue training"
*'--batch_size', type=int, default=20, help="Batch size for test"
*'--num_workers', type=int, default=10, help="Number of Workers for test data load"
*'--no_insert_noise', type=bool, default=False, help=" No insert noise in test ?"
The expected format of the metadata used for trainning is as it follows:
file_path,class
example1.wav,0
example2.wav,0
...
Obtain a dataset and create a CSV file containing two columns, first, the audio file paths, second, the class (0 for healthy and 1 for illness).