kaifishr / PyTorchRelevancePropagation

A basic implementation of Layer-wise Relevance Propagation (LRP) in PyTorch.
https://kaifishr.github.io/2021/12/15/relevance-propagation-pytorch.html
78 stars 4 forks source link

lrp for concatenate layer #1

Closed pribadihcr closed 2 years ago

pribadihcr commented 2 years ago

Hi @KaiFabi

Look like the lrp layer is worked if the network structure's model is sequential right?. I tried using squeezenet that has FIRE module (contain concatenate layer) got an error channels.

Thanks

kaifishr commented 2 years ago

Hi @pribadihcr

As mentioned in the readme's todos, the implementation is currently not model agnostic. The algorithm was implemented exemplarily for VGG networks. Other network architectures or operations (that are part of a VGG network) are not covered at this time. If you want, you are very welcome to create a pull request for the feature. I don't find the time for it at the moment.

Maybe you should also have a look at captum.ai (https://captum.ai/api/lrp.html) and their implementation for LRP that seems to be model agnostic. However, the project is under active development and I'm not sure how good the implementation is at this point, though. The last time I tried it, the results for a ResNet18 and LRP seemed buggy.