It sounds like a magic trick. But it could become a game changer in this whole pandemic.
Our Datascience Team had a look on the potentials of AI in cough sound classification.
Similar to other respiratory diseases, COVID-19 damages the throat and lungs, creating detecable differences in cough patterns. Consequently, cough sounds can be analyzed to detect COVID-19. Globally, this idea is being actively researched by several prestigious institutions, including Carnegie Mellon (CMU), MIT, and Cambridge. For example, research done by University of Cambridge showed that a simple binary machine learning classifier is able to classify COVID-19 positive patients through breathing and coughing sounds with high acurracy. Similarly, researchers at CMU identified 18 voice features that distinguish posttraumatic stress patients and trained an academic model to detect COVID-19 with high accuracy.
We created a small GitHub repository to show how these technologies works:
Kaggle Cough-Classifier Dataset
The main problem with this dataset is its high imbalance. Only 19 of the 170 examples are labeled as positive.
Therefore, in addition to the good test accuracy, the model shows a relatively high false-negative rate.
More data, especially positive examples, is needed to develop a reliable, cough audio-based COVID-19 test.
This dataset is provided by the developers of the Virufy app. They offer a webservice which can detect a COVID-19 signature in recordings using an AI algorithm. The open dataset on github contains 121 examples of which 48 are labeled as positive.
A combined and balanced Dataset
In order to train our own model we combined both of the datasets mentioned above and created a larger and balanced version. This version contains 134 examples in total of which 67 are positive.
This balanced dataset is still far from being ideal! More and more trustworthy data would be necessary to create a reliable and trustable classifier. It is also not clear in which stage of the disease process the data has been collected. But in case of a simple proof of concept, the data is usable.
The feature extraction is done using the librosa audio processing library. The following simple features are used for our proof of concept:
- Chroma STFT
- Spectral Centroid
- Spectral Bandwidth
- Spectral Rolloff
- Zero Crossing Rate
- The first 20 MFCCs
The extracted features have been saved as a csv file.
The model used is a simple DNN with six Layers. The input is a 26 values feature vector calculated from the audio files using librosa.
The balanced dataset is split into eight folds and evaluated using cross validation.
The model converges after 20 epochs of training.
|Fold 1||Fold 2||Fold 3||Fold 4||Fold 5||Fold 6||Fold 7||Fold 8||Average|
This proof of concept shows that it is possible to classify audio recordings into COVID postive or negative with an reasonable accuracy. The next step would be to move the trained neural network into a mobile app. This could be done by exporting the model in the ONNX standard and interfacing it using a cross platform react native app that allows to directly record your coughs using the built-in microphone.
Free COVID-19 tests could be available for everyone thanks to the power of AI!