Convert Darknet 19 to SNN

When I replace conv0_probe = nengo.Probe(nengo_converter.layers[conv0][sample_neurons]) to conv0_probe = nengo.Probe(nengo_converter.layers[conv4][sample_neurons]), I have the below error. What does it happen?

I am not 100% sure this is the cause, but I believe the reason why you are getting this error is because the [sample_neurons] array has indices that exceed the number of neurons that are available in the conv4 layer.

To probe the Keras layer in Nengo, all you need to do is:

conv4_probe = nengo.Probe(nengo_converter.layers[conv4])

The [sample_neurons] code is used to apply a matrix subset to the nengo_converter.layers[conv4] object. In essence, by adding the [sample_neurons] code, you are telling Nengo to only probe the subset of neurons that are contained within the [sample_neurons] array. In the case of the the code you posted, [sample_neurons] is the first 1000 neurons (see the line of code that defines [sample_neurons], and I’m sure the conv4 layer has less than 1000 neurons.

1 Like

Initially I think so, but I change sample_neurons to 10, then this error still occurs (the first picture). When I don’t use sample_neurons ( conv0_probe = nengo.Probe(nengo_converter.layers[conv4])), I have the different error (the second picture)


You have encountered this error before. Please look at the top of this thread. If the solutions presented there don’t work, then it would be good to get the code you are using to run the model, to see what else is causing the issue.

I turned off optimizer by noop_planner as you had talked before but I had this error. This is my code Alexnet_FashionMnist_SNN.ipynb (22.6 KB)

Honestly, I’m very sorry @xchoo due to my annoyance. I change my model to UNET one to increase the accuracy but the problem occurs. I don’t know what is the reason when I train the before model with 4 milion parameters ( even so more that), no problem but my UNET with 1.809 milion parameter, the crash (overload RAM) occured. Can you help me, please? This is my code (UNET model)? And I see tf.keras.layers.Cropping2D and tf.keras.layers.ConvolutionTransform2D can not convert to native Nengo Object so the accuracy is affected, is’n it?
UNET_SNN_Nengo.py (5.2 KB)