miladmozafari / SpykeTorch

High-speed simulator of convolutional spiking neural networks with at most one spike per neuron.
GNU General Public License v3.0
382 stars 101 forks source link

How to visualise features #3

Closed SumoYanyan closed 3 years ago

SumoYanyan commented 5 years ago

Hi, Mila! I was confused by the feature visualization: 1.in MozafariDeep network, the conv3.weight's kernel size is small(about 5*5), but the visualized features are huge images. 2.I tried some feature visualization methods in CNN, but all methods require gradient (BP). I don't know if there is a magic method for STDP network's feature visualization.

  1. The same confusions for KheradpishehDeep network. Thanks very very much~
miladmozafari commented 5 years ago

Hi Sumo, The visualization technique that we have used in our papers is a bit customized for our network and task. The idea behind this technique is to reconstruct features based on the weight matrices. For example, let the network has two convolutional layers (similar to the MozafariShallow). In the first layer, each feature map has a Gabor weight kernel. Now consider a weight matrix in the second conv layer. Each element in this matrix represents the synaptic weight connecting this neuron to one of the feature maps in the first layer (after passing through the pooling layer). Thus, a single element in this weight matrix can be extended into a larger Gabor kernel which is multiplied by the value of this element. We do this expansion for all of the elements in the weight matrix and combine them to reconstruct the feature. That's why the visualization is bigger than the weight kernel (we also perform some tricks to compensate pooling layers). In general, our method cannot visualize well if the network is large and has many feature maps. I recommend to write your own visualization methods with respect to your task and requirements. However, if you are interested in using the provided functions and our method, here is the guideline:

BTW, we used this function for our deep networks, however due to the high number of feature maps in each layer, we did not achieve good reconstructions. Again, I recommend to implement your own visualization which fits your needs and task.

SumoYanyan commented 5 years ago

thanks a lot!