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.
Using this code, we reached the following performance:
Model | Accuracy | Murmur |
---|---|---|
DBRes | 0.762 | 0.780 |
DBRes with XGBoost | 0.820 | 0.749 |
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/
- At least Python 3.9;
- PyTorch (torch, torchvision) for neural network architecture and training;
- XGBoost for xgboost;
- Librosa for audio processing and feature extraction;
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
pipenv install
You can run all steps using the template files in run_files
.`
A full experiment consists of four steps:
- Splitting the data into stratified train, test, and validation sets (
data_split.py
). - Training the Bayesian ResNets on their respective binary classification tasks (
train_resnet.py
). - Calculating and evaluating the output from DBRes (
dbres.py
). - 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
Ben Walker1, Felix Krones2, Ivan Kiskin3,4, Guy Parsons5, Terence Lyons1, Adam Mahdi2,3
- The Mathematical Institute, University of Oxford, Oxford, UK,
- The Oxford Internet Institute, University of Oxford, Oxford, UK,
- The People-Centred AI Institute, University of Surrey, Surrey, UK,
- The Surrey Sleep Research Centre, University of Surrey, Surrey, UK,
- The Intensive Care Registrar, Thames Valley Deanery, NIHR Academic Clinical Fellow at University of Oxford, Oxford, UK.
This work was supported by the Hong Kong Innovation and Technology Commission (InnoHK Project CIMDA) and the Friedrich Naumann Foundation.
@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}
}