COVID-19 Detection from Respiratory Sounds with Hierarchical Spectrogram Transformers

Idil Aytekin, Onat Dalmaz, Kaan Gonc, Haydar Ankishan, Emine Ulku Saritas, Ulas Bagci, Haydar Celik, Tolga Çukur · DOI

Introduction

The COVID-19 pandemic highlighted the urgent need for accessible, rapid, and non-invasive screening tools. While PCR tests and radiological imaging remain the gold standards for diagnosis, they are often resource-intensive and require clinical visits. Researchers have proposed automated auscultation—the analysis of respiratory sounds—as a scalable alternative. However, traditional models like Convolutional Neural Networks (CNNs) often fail to capture long-range temporal patterns, while Recurrent Neural Networks (RNNs) struggle with computational efficiency on long audio sequences.

This paper introduces the Hierarchical Spectrogram Transformer (HST), a novel architecture designed to bridge this gap. By progressively analyzing sound patterns from local acoustic details to global structures, the HST provides a robust framework for detecting COVID-19 from simple audio recordings of breathing and coughing.

Methodology

The HST framework treats audio classification as a specialized vision task. Raw audio files (.wav) are first processed into 2D Mel-spectrograms, which represent frequency intensity over time. This allows the model to leverage spatial relationships within the acoustic data.

Architecture of the Hierarchical Spectrogram Transformer (HST) for respiratory sound classification.

The architecture is structured into five hierarchical stages. In the early stages, the model analyzes small "patches" of the spectrogram to identify local features, such as specific frequency crackles. In later stages, these patches are merged, enabling the model to capture global context, such as the rhythmic structure of a full breath. To maintain computational efficiency for mobile deployment, the HST utilizes Local Windowed Multi-head Self-Attention (LWMSA). This mechanism restricts attention to local neighborhoods, reducing complexity from quadratic to linear. A cyclic shifting mechanism is employed to ensure information is shared across window boundaries, preventing the loss of edge-case patterns.

Experimental Results

The model was benchmarked against two major crowd-sourced datasets: the Cambridge dataset and the larger, noisier COUGHVID dataset. The HST consistently outperformed traditional baselines, including SVMs, ResNet34, and vanilla Transformers.

On the Cambridge dataset, the HST achieved a near-perfect AUC of 0.97 for distinguishing COVID-19 from healthy controls. On the more challenging COUGHVID dataset, which features significant background noise and hardware variability, the model maintained a strong AUC of 0.83, significantly outperforming ensemble methods.

Performance comparison of HST against baseline models and ROC curves for cough and breath modalities.

Beyond predictive accuracy, the HST offers substantial efficiency gains. It reduces the total parameter count from 171 million to 50 million compared to standard Transformers and improves inference speed by approximately 15%. Furthermore, explainability analysis using Grad-CAM confirmed that the model focuses on high-frequency regions (2-3 kHz) when identifying COVID-19 in breathing sounds, aligning with clinical observations of "coarse" breathing in infected patients.

Conclusion and Future Work

The Hierarchical Spectrogram Transformer represents a significant advancement in remote respiratory screening. By balancing local feature extraction with global temporal context, it achieves state-of-the-art performance with reduced computational overhead.

Future research will focus on improving the model's specificity to distinguish COVID-19 from other conditions with similar acoustic signatures, such as asthma or COPD. Additionally, addressing hardware variability across different mobile devices will be crucial for ensuring the reliability of the tool in diverse real-world environments.

Summary updated

BibTeX
@article{aytekin2024covid,
  author = {Idil Aytekin and Onat Dalmaz and Kaan Gonc and Haydar Ankishan and Emine Ulku Saritas and Ulas Bagci and Haydar Celik and Tolga Çukur},
  title = {{COVID-19 Detection from Respiratory Sounds with Hierarchical Spectrogram Transformers}},
  journal = {IEEE J. Biomed. Health Informatics},
  year = {2024},
  url = {https://openreview.net/forum?id=TpV4DAHSdc},
}
Figure