NeuromorphicProcessorProject / snn_toolbox

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

Known issue: Conversion of CNNs for use with pyNN (Nest, Brian, ...) simulators does not work with input models trained using keras versions > 2.1.6. #25

Closed rbodo closed 5 years ago

rbodo commented 5 years ago

The conversion of CNNs for use with pyNN (Nest, Brian, ...) simulators works with models trained using a keras version <= 2.1.6 (like the LeNet example provided with the toolbox), but not with models trained on newer keras versions. I believe the reason is that Keras changed something with the Flatten layer (you can now specify the image data format within the Flatten layer). The convolution layers are converted fine even with a new keras model, but the converted dense layers do not match the original ANN layers any more.

Workaround: An input model trained with the latest keras version will work fine on pyNN simulators if the image_data_format was set to channels_first in the keras config file, and the argument image_data_format=channels_last was passed to the Flatten layer during training.

This issue can probably be fixed by adapting this for-loop:

https://github.com/NeuromorphicProcessorProject/snn_toolbox/blob/4d8643b9002f2014d6f9feb931ec3a1fa393f06c/snntoolbox/simulation/utils.py#L1189

Unfortunately, I won't be able to tackle this compatibility issue any time soon. Any contribution would be appreciated.

Note: The INI simulator is not affected.

rbodo commented 5 years ago

Update: We have solved this issue now, but will have to wait with open-sourcing it until later this year.

rbodo commented 5 years ago

Solved in release 0.3.1.