Closed adamxyang closed 4 years ago
Hello,
You need to modify the code in such a way that it gets the gradients from the correct layer(s). The problem with ResNets is that they have nested layers (residual) and the code assumes the first layer is the target one when in fact this is not true. Try to understand how hook functions and how selecting the target layer works.
Thanks for the reply! I solved the issue with inputs.requires_grad=True
.
Hi, I have modified the code to be compatible with ResNets (changing
model.features._modules
tomodel.modules
), but I got this error when using theGuidedBackprop
class:My model is ResNet34 with an extra channel in kernels in the
conv1
layer, it's defined as: