How caitzpp/lrp-code works
Project Type and Purpose
• This repository is an open-source Python toolkit for applying and visualizing Layer-Wise Relevance Propagation (LRP) on convolutional neural networks trained to classify Alzheimer’s disease (AD) from structural MRI data.
• It bundles a general LRP wrapper (innvestigator.py + inverter_util.py), a simple MNIST example, MRI-specific evaluation and plotting notebooks, plus supporting data-handling and model-training modules (nitorch, jrieke).
File Structure Analysis
• Top-Level Scripts & Notebooks
• innvestigator.py & inverter_util.py: core LRP wrapper & utilities
• mnist_test.py, multiple .ipynb notebooks (MNIST example, ADNI evaluation, plotting)
• Python Packages
• jrieke/: dataset loaders, interpretation logic, model definitions, helpers
• nitorch/: generic DL pipeline modules (data, transforms, models, trainer, inference, callbacks, metrics, loss, utils)
• Configuration & Resources
• settings.py: user-provided paths to data, models, masks
• binary_brain_mask.nii.gz, nmm_mask_areas.py: MRI mask resources
• docker/: Dockerfile + docker-compose.yml for reproducible CPU-only Jupyter environment
• Support Files
• requirements.txt, license.txt, .gitignore
Key README Insights
• Core workflow: load pre-trained PyTorch model → wrap with InnvestigateModel → call .innvestigate(in_tensor) → receive prediction + relevance heatmap
• Visualization notebooks demonstrate end-to-end use on MRI and MNIST data
• Docker + Jupyter provide an isolated dev environment