I have a cnn with several layers:
self.conv1 = nn.Sequential(
nn.Conv2d(3, 16, 5, padding=0),
nn.ReLU(),
nn.MaxPool2d(3, 3)
)
...
self.conv2 = nn.Sequential(
nn.Conv2d(16, 32, 5, padding=0),
nn.ReLU(),
nn.MaxPool2d(3, 3)
)
...
I would like to visualize the filters, so I am using torchvision.utils.make_grid
.
As far as I understand, for the first convolutional layer, I can visualize the filters with colors, for the others in gray scale.
So I am doing this to get an Image:
np.transpose(make_grid(model.conv1[0].weight.clone().data, normalize=True).cpu().numpy()*255, (1,2,0))
np.transpose(make_grid(model.conv2[0].weight.clone().data.view(-1,1,5,5), normalize=True).cpu().numpy()*255, (1,2,0))
However, I’m not really seeing what I would expect (lines on first layer, edeges, arcs on second layer)… I also removed the *255
. Then the weights did not really change at all.
While my loss is decresing, I am wondering if I’m doing something wrong with the viz.?