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

Error When Building Spiking Model... #34

Closed janker5 closed 5 years ago

janker5 commented 5 years ago

I am using Keras version of LeNet. and eccountered the following error. my Keras version is 2.2.4.

Building spiking model... Building layer: 00Conv2D_6x24x24 Building layer: 01MaxPooling2D_6x12x12 WARNING: Rate-based spiking MaxPooling layer is not implemented in TensorFlow ba ckend. Falling back on AveragePooling. Switch to Theano backend to use MaxPoolin g. Traceback (most recent call last): File "c:\programdata\anaconda3\envs\snn\lib\site-packages\tensorflow\python\fr amework\common_shapes.py", line 686, in _call_cpp_shape_fn_impl input_tensors_as_shapes, status) File "c:\programdata\anaconda3\envs\snn\lib\site-packages\tensorflow\python\fr amework\errors_impl.py", line 473, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 6 and 3 for '01MaxPooling2D_6x12x12_1/add' (op: 'Add') with inpu t shapes: [1,6,12,12], [1,3,12,24].

rbodo commented 5 years ago

Looks like your keras image_data_format is set to channels_last whereas the model was built with channels_first. You can set this parameter in ~/.keras/config.json. See here for more details.

rbodo commented 5 years ago

If changing the image_data_format removed the error but resulted in low accuracy (for both ANN and SNN), please try the other Keras network example, which was trained with a recent Keras version. You can do this by changing the filename in the config file:

[paths]
filename_ann = 99.14