Cough activity detection for automatic tuberculosis screening
Authors: Joshua Jansen van Vüren, Devendra Singh Parihar, Daphne Naidoo, Kimsey Zajac, Willy Ssengooba, Grant Theron, Thomas Niesler
Organizations: Department of Electrical and Electronic Engineering, Stellenbosch University, Stellenbosch, South Africa · DSI-NRF Centre of Excellence for Biomedical Tuberculosis Research, South African Medical Research Council Centre for Tuberculosis Research, Division of Molecular Biology and Human Genetics, Faculty of Medicine and Health Sciences, Stellenbosch University, Cape Town, South Africa · Faculty of Business and Economics, University of Göttingen, Göttingen, Germany · Department of Medical Microbiology, College of Health Sciences, Makerere University, Biomedical Research Center (MAKBRC), Kampala, Uganda
The automatic identification of cough segments in audio through the determination of start and end points is pivotal to building scalable screening tools in health technologies for pulmonary related diseases. We propose the application of two current pre-trained architectures to the task of cough activity detection. A dataset of recordings containing cough from patients symptomatic for tuberculosis (TB) who self-present at community-level care centres in South Africa and Uganda is employed. When automatic start and end points are determined using XLS-R, an average precision of 0.96 and an area under the receiver-operating characteristic of 0.99 are achieved for the test set. We show that best average precision is achieved by utilising only the first three layers of the network, which has the dual benefits of reduced computational and memory requirements, pivotal for smartphone-based applications. This XLS-R configuration is shown to outperform an audio spectrogram transformer (AST) as well as a logistic regression baseline by 9% and 27% absolute in test set average precision respectively. Furthermore, a downstream TB classification model trained using the coughs automatically isolated by XLS-R comfortably outperforms a model trained on the coughs isolated by AST, and is only narrowly outperformed by a classifier trained on the ground truth coughs. We conclude that the application of large pre-trained transformer models is an effective approach to identifying cough end-points and that the integration of such a model into a screening tool is feasible.
Figures & tables
Figure 1: Power (dB) versus frequency (Hz) for all cough (blue) and non-cough (orange) audio, shaded regions indicate standard deviation over corpus.
Part
Number
Duration
Number
Duration
recordings
recordings
coughs
coughs
Train
583
13.20
11890
1.37
Dev
146
3.31
3015
0.36
Test
464
7.20
6874
0.79
Total
1193
23.71
21791
2.52
Table 1: Dataset training, development and test partition statistics. The training and development sets comprise only data collected in Uganda, while the testing data comprises only recordings collected in South Africa.
Figure 2: Cough activity detection model architecture and overview of the determination strategy for cough start and end points. TP: True positive, FP: False positive, TN: True negative.
Figure 3: Top level diagram of automatic cough isolation from raw audio to downstream TB classification.
Figure 4: Receiver-operator characteristic and coverage (sensitivity) and purity (precision) curves for the development set for each of the three (XLS-R, AST, LR) cough detectors and the three respective operating points, × : 97% coverage, ⋆ : 90% purity, and + : equal error rate.
Model
Batch
LR
Layer
Parameter count
Full
Optimal
LR
8
0.01
-
2k
-
AST
8
0.0001
1
87M
9.5M
XLS-R
8
0.0001
3
316M
51M
Table 2: Best performing hyperparameters for the three models (LR, AST, XLS-R).
Model
Development
Test
AUC
AP
AUC
AP
LR
0.95
0.79
0.91
0.69
AST
0.97
0.82
0.98
0.87
XLS-R
0.99
0.90
0.99
0.96
Table 3: Average development and test set performance (AUC, AP) for all three considered models (LR, AST, XLS-R).
Figure 5: Histogram of test set cough durations for three cough activity detection models (AST, XLS-R, LR) at three different operating points (purity, coverage, equal error rate).
Operating
Model
Number
Average cough
Total dur.
point
coughs
dur. (ms)
(min)
Ground truth
6886
413 ± 148
47.36
LR
22322
461 ± 1623
171.58
C
AST
9431
561 ± 564
88.16
XLS-R
6682
538 ± 417
59.97
C †
AST
5703
903 ± 738
85.82
Table 4: Statistics of the South African test set for each of the cough datasets obtained using the cough detection models as well as the manually annotated (ground truth) statistics. Each of the three cough detection models are used to isolate coughs at three operating points (C: coverage, EE: equal error rate, P: purity) †: After application of median filter.
Model
Median filter
Approx.
Development
size
duration (ms)
AUC
AP
AST
None
-
0.9732
0.8234
3
300
0.9735
0.8223
5
500
0.9716
0.8009
7
700
0.9675
0.7635
9
900
0.9612
0.7279
Table 5: Development set average precision for AST and XLS-R with best hyperparameters (Table 2 ) after further application of a median filter with various sizes.
Operating
Model
Development
Test
point
AUC
AUC
Manual
0.66±0.01
0.65±0.07
C
AST
0.58±0.02
0.59±0.09
XLS-R
0.64±0.02
0.63±0.10
C †
AST
0.59±0.02
0.57±0.09
XLS-R
0.63±0.02
0.62±0.09
Table 6: Ten fold nested cross-validation results for a downstream bidirectional LSTM TB classification model when trained using one of the nine automatically extracted cough datasets. C: coverage, EE: equal error rate, P: purity, †: After application of median filter. Manual: Classification performance when training on manual (ground truth) coughs.
Cough acoustics are promising for non-invasive tuberculosis (TB) screening, yet whether machine learning (ML) models capture disease-related acoustics or artifacts of data collection remains unresolved. We evaluated the cross-dataset generalizability of classical ML and deep learning (DL) cough-based TB classifiers across three independent datasets. Despite moderate within-dataset performance (ROC-AUC up to 0.755±0.056), both pipelines fail to generalize, with external performance frequently below 0.6, indicating a possible limitation of the data. We further observed audio representations are organized by recording device and dataset rather than TB status, predicted TB probability tracks country-level prevalence in CODA, and device mismatch degrades transfer while device-diverse training improves it. Additionally, a clinical-variable baseline generalizes more consistently (ROC-AUC 0.655−0.711), indicating acquisition-specific variability is a stronger driver of poor generalizability than population shift. High within-dataset performance is not enough. External validation is essential before cough-based TB models are clinically ready.
Wensi Zhang, Tomas Teijeiro, Jérôme Thevenot +1
Embedded Systems Laboratory, École Polytechnique Fédérale de Lausanne, Lausanne, Switzerland. · Basque Center for Applied Mathematics (BCAM), Bilbao, Spain. · University of the Basque Country (EHU), Leioa, Spain.
We consider the fusion of lung ultrasound images with routinely-collected clinical and demographic data for the purpose of automated tuberculosis (TB) screening using deep-learning. Such deep-learning based screening tools for TB could meaningfully support the health care system in Africa, where the burden of disease is severe and resources are constrained. Beginning with an established ResNet baseline for classification of lung ultrasound images, which achieves an area under the receiver operating characteristic (AUROC) curve of 0.91 [0.86,0.96] (95% CI), we consider the incorporation of the clinical and demographic data using three fusion approaches. We find that a simple average-based fusion of the output scores of separately-trained image and clinical data classifiers consistently matches or outperforms a more complex approach where the data is fused earlier and a combined classifier is trained. Fusing the image and the clinical classifiers in this way leads to a classifier with an overall AUROC of 0.95 [0.91,0.99] (specificity of 0.76 at sensitivity 0.93) which is an improvement of 4% absolute over the image-only baseline. We also find that greedy feature selection can be used to reduce the number of clinical and demographic inputs without sacrificing classification performance. Finally, when we differentiate between clinical and demographic data that are self-reported, that require some basic measurement or calculation, and that require a point-of-care (POC) test, we find the inclusion of the POC tests included in this study to be of minimal benefit to classification performance. We conclude that the incorporation of routinely-collected clinical and demographic data is a promising way to improve the performance of lung ultrasound based automatic classification.
Joshua M. Jansen van Vüren, Christiaan M. Geldenhuys, Devendra S. Parihar +7
Department of Electrical and Electronic Engineering, University of Stellenbosch, Stellenbosch, South Africa · Laboratory for intelligent Global Health and Humanitarian Response Technologies (LiGHT) Swiss Federal Institute of Technology (EPFL), Lausanne, Switzerland · National Teaching Hospital for Tuberculosis and Pulmonary Diseases (CNHU-PPC), Cotonou, Benin +1
Automated cough analysis offers a path to low-cost respiratory screening, but most existing work stops at binary COVID-19 detection. A practical tool needs to tell apart several respiratory conditions from one cough recording on a consumer smartphone. We present CoughSense, a system that sorts cough recordings into five classes. These are healthy, COVID-19, asthma or respiratory condition, bronchitis, and pneumonia. We aggregated 18,301 recordings from four public datasets (Coswara, CoughVID, Virufy, and the West China Hospital Pediatric Cough Dataset) and used the OpenAI Whisper encoder as a pretrained backbone for cough disease classification. The main contribution is active-frame QKV attention pooling, which restricts attention to the first 200 of 1500 encoder tokens. This avoids the silence-dilution problem that arises because a 3-second cough fills only 150 tokens of Whisper's 30-second input window. Other training parts handle the 19 to 1 class imbalance and the four-dataset domain shift. These include WeightedRandomSampler, SpecAugment, Balanced Mixup with forced minority pairing, a supervised contrastive auxiliary loss, FiLM symptom conditioning, and gradient-reversal domain adaptation. A dual-encoder model fuses Whisper with the OPERA-CT respiratory foundation model through cross-attention. CoughSense (Whisper-tiny, 8.6M parameters) reached 82.3 percent balanced accuracy on five-fold cross-validation (macro-F1 of 0.817, AUC of 0.941). It beat an ImageNet-pretrained EfficientNet-B2 by 11.1 points and a ViT trained from scratch by 29.6 points. All five classes passed 74 percent recall and four of five passed 80 percent. The dual-encoder model reached 85.4 percent balanced accuracy. Active-frame pooling is the largest single contributor across all ablation components at 5.1 points, which should help any short-audio task using Whisper as a backbone.