NeuromorphicProcessorProject / snn_toolbox

Toolbox for converting analog to spiking neural networks (ANN to SNN), and running them in a spiking neuron simulator.
MIT License
362 stars 105 forks source link

Poisson Input #26

Closed piewchee closed 5 years ago

piewchee commented 5 years ago

Hi Bodo,

I read in your documentation: [Different input types: In all other simulators, only Poisson input is supported at the moment. INIsim implements constant input currents as well as input from DVS event sequences.]

Does it mean that all other simulators except INIsim use Poisson input?

I ran using 'nest' simulator; in the config file for lenet5/keras: i set poisson_input = True or False, both are able to run, may I know why?

In pyNN_targer_sim.py: self.layers.append(self.sim.Population( np.asscalar(np.prod(input_shape[1:], dtype=np.int)), self.sim.SpikeSourcePoisson(), label='InputLayer'))

The input layer is supposed to use pyNN's spikesourcepoisson; the spike rate is default I presumed as the SpikeSourcePoisson() rate is not declared? How does SpikeSourcePoisson read mnist generated spiketrains?

Rgds Del

rbodo commented 5 years ago

Does it mean that all other simulators except INIsim use Poisson input?

Yes. Constant input current with pyNN simulators should in principle be possible using the StepCurrentSource class, but I have not implemented it (anyone's welcome to do it).

I ran using 'nest' simulator; in the config file for lenet5/keras: i set poisson_input = True or False, both are able to run, may I know why?

If you set poisson_input = False with pyNN simulators, the toolbox detects the mismatch and issues a warning (pretty early in the console output, probably getting buried by all the other output), and sets poisson_input = True.

How does SpikeSourcePoisson read mnist generated spiketrains?

That is not done when constructing the input layer, but during simulation (because the input changes), here:

if self._poisson_input:
    rates = kwargs[str('x_b_l')].flatten()
    for neuron_idx, neuron in enumerate(self.layers[0]):
        neuron.rate = rates[neuron_idx] / self.rescale_fac * 1000
piewchee commented 5 years ago

Does it mean that all other simulators except INIsim use Poisson input?

Yes. Constant input current with pyNN simulators should in principle be possible using the StepCurrentSource class, but I have not implemented it (anyone's welcome to do it).

I ran using 'nest' simulator; in the config file for lenet5/keras: i set poisson_input = True or False, both are able to run, may I know why?

If you set poisson_input = False with pyNN simulators, the toolbox detects the mismatch and issues a warning (pretty early in the console output, probably getting buried by all the other output), and sets poisson_input = True.

How does SpikeSourcePoisson read mnist generated spiketrains?

That is not done when constructing the input layer, but during simulation (because the input changes), here:

if self._poisson_input:
    rates = kwargs[str('x_b_l')].flatten()
    for neuron_idx, neuron in enumerate(self.layers[0]):
        neuron.rate = rates[neuron_idx] / self.rescale_fac * 1000

Hi Rbodo,

Ok I didn't notice the auto switched to poisson_input=true. That's explain the whole thing.

Thanks!

Rgds Del