utkuozbulak / pytorch-cnn-visualizations

Pytorch implementation of convolutional neural network visualization techniques
MIT License
7.81k stars 1.49k forks source link

AttributeError: 'MyCNN' object has no attribute 'features' #111

Closed aw632 closed 2 years ago

aw632 commented 2 years ago

Hi, I'm trying to adapt the code to use my own simple CNN. The first layer of this CNN is

self.color_map = nn.Conv2d(
            num_channels, num_channels, (1, 1), stride=(1, 1), padding=0
        )

I'm struggling to understand this line in VanillaBackprop, which is important since it's raising the error of no attribute features.

        first_layer = list(self.model.features._modules.items())[0][1]

How much of this is VGG specific, i.e., what do I change to make it work with mine?

aw632 commented 2 years ago

Actually, nevermind, just need to assign first_layer = self.model.color_map.