Back to search results

Cough Detection using Artificial Intelligence

  • Degree programme: BSc in Medizininformatik
  • Author: Simon Michael Bertschinger
  • Thesis advisor: Prof. Dr. Kerstin Denecke
  • Industrial partner: Institute of Social and Preventive Medicine (ISPM) Bern
  • Year: 2023

Download PDF

This thesis tests the feasibility of using a single low-cost microphone in a waiting room of a primary care facility to detect and classify coughs with and without mask using artificial intelligence.

Cough frequency is a key measurement in research for chronic cough and has been used as a marker for infectiousness in research of respiratory diseases like tuberculosis. Automatic cough detection is an important objective alternative to manual counting and subjective assessments.


Objective
: The objective of this thesis is to test if an artificial intelligence model can detect and categorize coughs with and without mask. The coughs were recorded using a microphone hanging in a waiting room with various levels of background noise. An accuracy of more than 75% is targeted. 


Methods: Nine different datasets as seen in figure (1) with 100x64 pixel monochrome greyscale Mel spectrograms generated from 4’560 manually labelled audio samples were used to train 11 variations of sequential convolutional neural network (CNN) models established in an iterative approach to either detect or classify coughs. Each dataset used a different combination of modifications while the mixed dataset combines all other sets. The most basic CNN model uses two 2D convolutional layers with 4 filters of 3x3 kernel size. Their output is then flattened and connects to one dense layer with 256 units. All those layers use a rectified linear unit activation function. The output layer leads to a single node with a sigmoid function that allows for binary classification.

Results: Two models trained with the mixed dataset “M” from figure (1) achieved an accuracy over 98% on unseen test data for both cough detection and classification. Exemplary the classification model “C2M” from figure (2) classified a total of 4’119 coughs without mask correctly from the 4’172 total in the test dataset resulting in a specificity of 98.8% and a sensitivity of 98.2%. It uses three convolutional layers with 64, 32 and 16 filters of size 2x2. The output is then flattened leading into two dense layers with 512 and 256 units. The final classification takes place on an output layer using a single unit with a sigmoid function. The model that achieved 98.9% accuracy for cough detection used three convolutional layers with 128, 64 and 32 filters of size 3x3 instead.


Discussion
: The results show that using recordings from a single microphone in a room and CNN-based models to detect and classify coughs with and without mask can be feasible. It also shows that using a combination of slightly modified datasets can improve the generalization of a model. This can make automatic cough detection viable in multiple research scenarios that require cough frequency.

Figure 1: Full list of datasets S: Standard N: Normalized O: Overlap R: Noise reduction, M: Mixed (all datasets combined)
Figure 2: Confusion matrix with prediction results for cough classification of the model "C2M" using unseen data

Video for the bachelor thesis

Back to search results