A basic implementation of Layer-wise Relevance Propagation (LRP) in PyTorch

Basic unsupervised implementation of Layer-wise Relevance Propagation (Bach et al.,
Montavon et al.) in PyTorch for VGG networks from PyTorch’s Model Zoo.
This tutorial served as a starting point.
In this implementation, I tried to make sure that the code is easy to understand and easy to extend to other
network architectures.

I also added a novel relevance propagation filter to this implementation resulting in much crisper heatmaps
(see my blog for more information).
If you want to use it, please don’t forget to cite this implementation.

This implementation is already reasonably fast.
It is therefore also suitable for projects that want to use LRP in real time.
Using a RTX 2080 Ti graphics card I reach 53 FPS with the VGG-16 network.

If I find the time, I will provide a more model agnostic implementation.
I also welcome pull requests improving this implementation.

You can find more information about this implementation on my blog.

[1]: On Pixel-Wise Explanations for Non-Linear Classifier Decisions by Layer-Wise Relevance Propagation

[2]: Layer-Wise Relevance Propagation: An Overview

[3]: LRP tutorial


View Github

Zealous — A beautiful submission manager built for growth

iQOO 9 Battery Specifications Surfaces after Spotting at 3C Certification Site