DeepLearnToolbox icon indicating copy to clipboard operation
DeepLearnToolbox copied to clipboard

Visualising Weights learnt by CNN

Open sharathchandra92 opened this issue 11 years ago • 2 comments

Hi,

Can you please tell me how to visualise the features learnt by CNN, especially in layer 1?

Thanks :).

sharathchandra92 avatar Jan 22 '14 02:01 sharathchandra92

for test_example_CNN of the library:

Assuming you already runned the network on test data, it will contain activations of the last batch you fed into the network. The following code will visualize the average result of 4th filter of first conv layer over your batch:

for features of a given layer:

filtNo = 4
firstConvLayer = 2 
lastActivations = cnn.layers{firstConvLayer}.a{filtNo};
lastActivations = sum(lastActivations,3); % sum over batch instances
imagesc(lastActivations)

for weights of a conv kernel

imagesc( cnn.layers{firstConvLayer }.k{1}{filtNo} ) 

taygunk avatar May 05 '14 15:05 taygunk

Hi, about two month ago, I was testing the CNN code in this toolbox, and I wrote a script to display the kernels and feature maps for each layer (even with more layers, all will be fine) with input options controlled. This script might be helpful to you. However, I just have to spend some time to comment that script and figure out how to commit to github @_@.

russellfei avatar Jun 08 '14 01:06 russellfei