TensorFlow implementation of Microsoft's RespireNet to classify breathing/coughing sounds of people affected by COVID19 using the Coswara dataset. Once the train code is executed, the data is automatically downloaded and pre-precessed, thanks to the tensorflow-datasets pipeline. What you can customize:
- What audios to filter out: you can choose not to consider the
wavfiles which last less than k seconds with k between 1 and 4, simply by passingskip=kwhen instantiating aCoswaraCovidDatasetobject - Whether to use mixup: as a default, for the minority classes a kind of mixup augmentation is produced. Two examples of the same class are randomly selected and concatenated in order to create a new example. This helps in reducing class imbalance, but can be turned off siply passing
mixup=Falsewhen instantiating aCoswaraCovidDataset - What audio file you are interested in: the Coswara dataset is composed of 9 audiofiles per user, but my reduced version only considers four of them (
breathing-deep,breathing-shallow,cough-heavyandcough-shallow). To select the one you are interested in simply passaudio_file=file_namewhen instantiating aCoswaraCovidDatasetobject - The final lenght each audio file should have, by default this is set to 7 seconds.
- The low and high cuts for the 5th order Butterworth filetr applied on each data file to reduce noise
- The parameters used for the creation of the Mel Spectrogram using
librosa
The code requires Python >= 3.6 as well as the following libraries:
- matplotlib
- tensorflow_datasets
- pydub
- python-ffmpeg
- librosa
- scipy
- opencv_python
- tensorflow_gpu
- numpy
- tensorflow
Which can be installed easily through:
pip install -U pip
pip install -r requirements.txtFinally, in order for the tfds audio processing pipeline you also need to have ffmpeg installed on your computer.
- Add a proper config file
- Find a way to filter out the audio files that only contain talking
- Add option to filter out asymtomatic people, as it doesn't make much sense to try and diagnose them using their cough or breathing
