fangwei123456 / spikingjelly

SpikingJelly is an open-source deep learning framework for Spiking Neural Network (SNN) based on PyTorch.
https://spikingjelly.readthedocs.io
Other
1.25k stars 236 forks source link

Question on the input encoding in SNN vs SCNN #389

Open NicolaCST opened 1 year ago

NicolaCST commented 1 year ago

Issue type

Description Hi, I have a question about the input encoding: we know that SNNs cannot accept directly continuous-valued inputs, such as images, but rather they need an encoded version (ex. via Poisson encoder) that convert them into spike trains that can be processed by spiking neurons. Now, in the documentation for the F-MNIST classification you use an external encoder (ie. you explicitely pass the image to the encoder before passing it to the net). In the CIFAR case instead, you say that is it possible to send image directly to net since the encoding can be done in the first layer of the net (Conv2d - BN - IFNode).

So we can do both? Why can't we send a sample from the FMNIST directly to the net since the structure is almost the same (Flatten - Linar - IFNode)? The conversion of the continuous-valued inputs to spike trains is done implicitly within the behavior of the IF neurons? Then why we have a specific encoder to call in the first case?

Thank you in advance

@fangwei123456

fangwei123456 commented 1 year ago

So we can do both?

Yes.

Why can't we send a sample from the FMNIST directly to the net since the structure is almost the same

We can also send the image to the SNN for FMNIST directly.

Then why we have a specific encoder to call in the first case?

Because we want the tutorial to show how to use the encoder.

NicolaCST commented 1 year ago

Can we thus consider the encoding done from the first three layer of a CSNN/SNN as the "Direct encoding" proposed in the work of Edgar Lemaire "An Analytical Estimation of Spiking Neural Networks Energy Efficiency" ?

In the 2nd section we have a description of it:

das

@fangwei123456

fangwei123456 commented 1 year ago

Can we thus consider the encoding done from the first three layer of a CSNN/SNN as the "Direct encoding"

Yes. But I am not sure which paper proposes this method firstly.