Skip to content

LIMUNIMI/InterpretingRespireNet

Repository files navigation

Interpreting RespireNet

Implementation of the ‘Explaining Audio Classification models for Respiratory Sounds’ project based on RespireNet.

Dependencies:

Python3.12
tensorflow==2.17.0
torch==2.4.0+cu124
torchvision==0.19.0+cu124
torchaudio==2.4.0+cu124
numpy==1.26.3
pandas==2.2.2
scikit-learn==1.5.1
scipy==1.14.1
matplotlib==3.9.2
seaborn==0.12.0
captum==0.7.0
shap==0.45.1
tensorboard==2.17.1
nltk==3.9.1
spacy==3.6.0
transformers==4.33.0
librosa==0.10.2.post1
pytorch-lightning==2.0.0
umap-learn==0.5.6

Dataset

The dataset used is ICBHI 2017 Challenge Respiratory Sound Database.

Here are the steps to follow to use the dataset.

Post-hoc explainability command

The following command allows Importance-Maps, Aggregated-GradCAM++, SmoothGradCAM++ to be generated on the entire dataset.

python posthoc.py --data_dir ./data/icbhi_dataset/audio_text_data/ --checkpoint models/ckpt_best.pkl --folds_file ./data/patient_list_foldwise.txt --output_dir ./xai_results/ --sample_index $(seq 0 1443) | tee experiment.log

The following command allows Importance-Maps, Aggregated-GradCAM++, SmoothGradCAM++ to be generated on the individual sample or a list of samples for possible future development.

python posthoc.py --data_dir ./data/icbhi_dataset/audio_text_data/ --checkpoint models/ckpt_best.pkl --folds_file ./data/patient_list_foldwise.txt --output_dir ./xai_results/ --sample_index 0 | tee experiment.log

SVM Evaluations

Evaluation SVM Aggregated-GradCAM++ as Mask

python svm_AGCmask.py 

Evaluation SVM Importance-Map

python svm_IM.py

About

Tesi triennale di Giorgio Longhi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published