-
Notifications
You must be signed in to change notification settings - Fork 664
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
Fix: Problem with keras ResNet50 CAM visualisation #53 #122
Conversation
@raghakot , |
Hi, @raghakot Now, I'm fixing the test code. keras-vis/vis/backend/tensorflow_backend.py Lines 87 to 100 in e019cc4
As a test, I removed this implementation (for-each). What is this implementation necessary for? Thanks. ADD on 23 Jul 2018:
I understood about this. maybe. I think that it should be used |
I'm sorry. I misoperated.... ;-( |
@raghakot, Please review this PR, and point out if there is a problem. FixesThe problem can be avoided by modifying the following implementation. keras-vis/vis/backend/tensorflow_backend.py Lines 87 to 100 in e019cc4
The problem is the condition of line 89. However, I deleted all of the above implementations in this PR. Consultation about the testI can not create a test to reproduce the problem because we have not identified the root cause of the problem. If it change to not replace activation function, this problem can be avoided. However, Do you have any good idea to make a better test ? Regards |
Hi,@raghakot. I’ve thought about this PR, then I decided to merge it.
if it have any problem, please revert this PR. p.s. |
Cause
In the
modify_model_backdrop
method, It is setting new Relu function to all the ‘activation’ attribute. i.e., It's all of Convolution Layer and Activation Layer.In Keras's ResNet50, the
activation
attribute of each Conv layer is set to the Linear function and also has Activation layer.Replacing this Linear function with the Relu function seems to be the cause of the gradient loss.
Actually, If there are not Activation Layer, this issue isn't occured.
Detail
Please refer to below comment ( #122 (comment) ).
@raghakot ,
Since it is a bug fix, I didn’t add
tests anddocuments.Instead of that, I added an example.
https://github.com/keisen/keras-vis/blob/bugfix/%2353/examples/resnet/attention.ipynb
( MODIFIED on 15 Aug 2018 )