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
LRP for semantic segmentation #118
Comments
Please let me know, if I could help you somehow to debug this problem. |
I will have a look at it asap, as soon as there is some time (ie next week). |
Great! |
Hi Sebastian, did you manage to take a look at the issue? I will greatly appreciate your help. |
Sorry to disappoint, but we have not had the opportunity to take a detailed look yet.
best, |
Hi Sebastian, thank you very much for the hints! I removed batchnorm layers completely from the model architecture and retrained the model. For the LRP analysis I set the last activation function to "linear". Unfortunately, with these modifications the problems I reported still occur (mnist_unet.pdf). Ad. 1.&2.: I wasn't sure how to disable the current default behavior of the batchnorm or how to disable the incorporation of the batchnorm in the LRP backward pass... As I would like to use batchnorm in my further experiments I would appreciate if you could tell me how the mentioned changes could be done. Ad. 3.: I think that LRP for segmentation models would be of great interest (especially in the medical context). I would be happy to help you to extend your project to support such architectures. Best, |
Hi Sebastian, Is there any chance that you would fine some time to take a look at this issue again? I would appreciate this. Best, Grzegorz |
Hi Grzegorz, could you create a Github gist or any other link where we can access to code directly? Cheers, |
Hi Max, I created a github repo (https://github.com/gchlebus/lrp-for-segmentation) where you can find the jupyter notebook, which reproduces the mentioned problems. Best, |
Hi Grzegorz, thank you! I will try to look into it soon. Cheers, |
I wont find time until next week. Sorry. |
Ok, thanks for keeping me posted. |
Hi Grzegorz, I'm very sorry that this took so long! Commit should fix this. It is pushed into develop and master branch. It would be great if you could test it! For me it solved both problems initial problems, and worked also with batchnorm. Hope this helps you! Cheers, |
Hi Max, Thank you very much. Your fix makes the analysis reproducible. I am getting exactly the same results for the same output neuron when running the analysis multiple times. However, the sum of the relevance map still deviates from the value of the analysed output neuron (I confirmed this behaviour with a model with and without batch norm). The deviation can be sometimes quite large (e.g., neuron outputs 1.7 and the relevance map for this neuron sums up to 40). Maybe there is something wrong with the way I call the analyser? Which relevance rule would you recommend to use for semantic segmentation ConvNets (in the notebook I use the Best, Grzegorz |
Hi Grzegorz, no, you call the analyzer in the right way, and yes the input_layer_rule defines input range (which is used in the "Z_B" rule in the first layer). @sebastian-lapuschkin should know more about which rule to use. Cheers, |
Sorry for my inactivity lately. Busyness levels are expected to decrease drastically after december. @albermax: are there some suitable mechanics to do so yet, e.g. early stopping the decomposition process? My assumption would be large changes happening in BatchNorm layers. the current default treatment of the BN layer interprets it as a sequence of addition/multiplication/addition/multiplication but recent results indicate that this is not the optimal way for decomposing the layer's relevance. |
Oh the Bias. If you use "LRPEpsilonIgnoreBias" and no batchnorm the sum should stay the same. Otherwise: |
Hi Max, hi Sebastian, Thank you very much for your help. I tested your suggestions. Please find my answers below.
Not setting the
I modified the
This is correct. If I use the
I am not sure how I can make use of the relevances along the graph to solve the problem of relevance absorption/injection. |
Hi Grzegorz, thank you so much for looking into this. Basically everything works as it should. The case that the relevance does not sum up for LRPEpsilon and does for LRPEpsilonIgnoreBias is a feature rather than a bug. The idea is that biases are (constant) inputs to the network and "absorb" relevance. Unfortunately, for the BatchNorm layer there is only an implementation that does not ignore the biases, hence as you observed the output sum is not equal the neuron's activation value. @sebastian-lapuschkin maybe you would like to add something to this. Cheers, PS: To the code reference: it was not to "solve" your problem, only to inspect the values along the backward propagation. My bad for being not clear! |
Hi,
Thank you very much for this nice library. I think it is a great initiative to have a collection of neural network analysis tools!
I tried to use iNNvestigate to get some insights into semantic segmentation neural networks. I created a toy-task to segment the mnist images using a small U-net architecture. The desired target images were created by thresholding the input images at 0.5. I encountered the following problems when running different variants of LRP analysis:
Please find attached a jupyter notebook (as a
txt
file, since github doesn't support theipynb
extension) and a generated pdf with my code, that I used for this toy-task. I would appreciate your feedback and any hints on how to use LRP to analyse semantic segmentation models.Best, Grzegorz
mnist_unet.pdf
mnist_unet.txt
The text was updated successfully, but these errors were encountered: