Skip to content

Dual Bayesian ResNet: A Deep Learning Approach to Heart Murmur Detection (Physionet Challenge 2022)

License

Notifications You must be signed in to change notification settings

Benjamin-Walker/heart-murmur-detection

Repository files navigation

License: MIT PWC

Heart Murmur Detection using Bayesian Residual Neural Networks

This is the extension of our entry to the George B. Moody PhysioNet Challenge 2022: Heart Murmur Detection from Phonocardiogram Recordings

When using this code, please cite the challenge paper as well as the journal paper.

This repository contains our solution to the first task from the PhysioNet Challenge 2022: Design an algorithm to classify the present, absent, or unknown cases of heart murmurs from heart sound recordings [1,2].

Two models are implemented:

  • A Dual Bayesian ResNet (DBRes), where overlapping log mel spectrograms of the heart sound recordings undergo two binary classifications simultaneously: present versus unknown or absent, and unknown versus present or absent.
  • The output from DBRes integrated with demographic data and signal features using XGBoost.

Challenge performance for murmur task on held-out subset

Using this code, we reached the following performance:

Model Accuracy Murmur
DBRes 0.762 0.780
DBRes with XGBoost 0.820 0.749

Data

The challenge dataset can be downloaded via this link or using the following command.

wget -r -N -c -np https://physionet.org/files/circor-heart-sound/1.0.3/

Dependencies

Install using conda on cuda device

conda create -n myenv python=3.9
conda activate myenv
conda install pytorch==1.11.0 torchvision==0.12.0 cudatoolkit=11.3 -c pytorch
pip install tqdm==4.64.1 scipy==1.9.2 resampy==0.4.2 scikit-learn==1.1.2 pandas==1.5.0 xgboost==1.6.2 librosa==0.9.2

Install using pipenv (mps enabled)

pipenv install

Running Experiments

You can run all steps using the template files in run_files.`

A full experiment consists of four steps:

  1. Splitting the data into stratified train, test, and validation sets (data_split.py).
  2. Training the Bayesian ResNets on their respective binary classification tasks (train_resnet.py).
  3. Calculating and evaluating the output from DBRes (dbres.py).
  4. Calculating and evaluating the output from DBRes with XGBoost integration (xgboost_integration.py).

These steps can be run independently using the relevant script, or sequentially using main.py,

CUDA_VISIBLE_DEVICES=0 python main.py --full_data_directory physionet.org/files/circor-heart-sound/1.0.3/training_data --stratified_directory data/stratified_data --vali_size 0.2 --test_size 0.2 --random_state 14 --recalc_features --spectrogram_directory data/spectrograms --model_name resnet50dropout --recalc_output --dbres_output_directory outputs

Affiliations

Ben Walker1, Felix Krones2, Ivan Kiskin3,4, Guy Parsons5, Terence Lyons1, Adam Mahdi2,3

  1. The Mathematical Institute, University of Oxford, Oxford, UK,
  2. The Oxford Internet Institute, University of Oxford, Oxford, UK,
  3. The People-Centred AI Institute, University of Surrey, Surrey, UK,
  4. The Surrey Sleep Research Centre, University of Surrey, Surrey, UK,
  5. The Intensive Care Registrar, Thames Valley Deanery, NIHR Academic Clinical Fellow at University of Oxford, Oxford, UK.

Acknowledgment

This work was supported by the Hong Kong Innovation and Technology Commission (InnoHK Project CIMDA) and the Friedrich Naumann Foundation.

Bibtex Citation

@article{walker2022DBResNet,
    title={Dual Bayesian ResNet: A Deep Learning Approach to Heart Murmur Detection},
    author={Benjamin Walker and Felix Krones and Ivan Kiskin and Guy Parsons and Terry Lyons and Adam Mahdi},
    journal={Computing in Cardiology},
    volume={49},
    year={2022}
}