-
Notifications
You must be signed in to change notification settings - Fork 516
Lrp tutorial added #668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Lrp tutorial added #668
Conversation
Hi @JohannesK14! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for the tutorial, @JohannesK14! We will provide review comments soon! A quick question: Where is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for working on this tutorial, @JohannesK14 ! Overall looks great to me.
One ask:
Since we are adding more tutorials to Captum I'm thinking that perhaps we can combine this with the resnet one and call it Resnet_VGG_TorchVision_Interpret.ipynb, if we want to showcase LRP example explicitly for VGG. The content of this tutorial can be added to the bottom of the Resnet_VGG_TorchVision_Interpret.ipynb file.
In the top of theResnet_VGG_TorchVision_Interpret file we can briefly describe that we are showcasing LRP for VGG as well.
Feel free to add an example of LRP for Resnet as well in that same notebook.
https://github.com/pytorch/captum/blob/master/tutorials/Resnet_VGG_TorchVision_Interpret.ipynb
If you combine those tutorials, I'd also suggest that you do minor adjustments for the website text as well:
https://github.com/pytorch/captum/blob/master/website/tutorials.json#L17
https://github.com/pytorch/captum/blob/master/website/pages/tutorials/index.js#L70
Couple more minor comments:
"As one see" -> "As one can see" ?
"Currently implemented in captum are " -> "Currently implemented rules in captum are " ?
Also, do you mind adding here a link to the documentation for the recommended rules ?
Hello @NarineK , I took the image from here: https://git.tu-berlin.de/gmontavon/lrp-tutorial I could ask the author for the copyright permission. |
Regarding your second comment: Of course, I can add the tutorial to the Resnet_TorchVision_Interpret.ipynb. But then I would suggest omitting VGG and just use Resnet and also the swan picture. Otherwise, it will look a little bit thrown together, I think. And Resnet is also more interesting than VGG, because there you need the implementation with back hooks for the skip connections. And you would not need copyright permission for the castle anymore. I will have a look into that in the next few days. |
Hi @JohannesK14, agree, let's use Resnet and the swan image instead. |
@JohannesK14 would you have time to address the comments in this PR as discussed previously ? |
Unfortunately, the example notebook does not work anymore.
I like the example. Does anybody has an idea how to solve the issue? |
@HeinrichAD I just set the inplace flag to false. Why do you see a problem there? To my knowledge, the inplace functionality could save some memory, but should deliver the same results in a VGG. @NarineK Sorry for my long absence. I tried the switch to the ResNet architecture this morning. Unfortunately, the design of the composition of the rules for the ResNet18 architecture is more complicated than I thought it would be. I don't have the time to tinker with the rules to create a acceptable result for the visualization of the attributions, which I am very sorry for. Therefore, I switched to the picture of the swan, which also gives a pleasant result and avoids copyright issues. Do you think I should still merge it with the ResNet tutorial as you suggested earlier? |
@JohannesK14 I looked into the source code [1]. In this case it will be the same. So no problems here. [1] https://pytorch.org/vision/main/_modules/torchvision/models/vgg.html#vgg16 |
Reference Issues
664
Changes
Addition of an LRP tutorial and a sample image. The tutorial replicates the results of the basic PyTorch LRP implementation provided by the LRP authors using the LRP class of captum.