Nengo_loihi on which data?


In this example: nengo_loihi cnn mnist example, the nengo_loihi simulator runs on this:

with nengo_loihi.Simulator(net, dt=dt, precompute=False) as sim:
# if running on Loihi, increase the max input spikes per step
if ‘loihi’ in sim.sims:
sim.sims[‘loihi’].snip_max_spikes_per_step = 120

# run the simulation on Loihi * presentation_time)

I checked the API, it seems function only specifies the running time, my question is how do I know it’s running on training data or test data?
I wrote a similar classification task based on this example, however there is a large discrepancy in accuracy between the nengo_dl and nengo_loihi. So do you have some recommendations on how to improve the nengo_loihi’s results?


Hi @originofamonia!

That’s a very good question! Nengo models typically have a Nengo.node that serves at the input to the model. This is the case with the example you linked, which the input node being:

inp = nengo.Node(
        nengo.processes.PresentInput(test_images, presentation_time),
        size_out=28 * 28)

This means that when the model is run on the Loihi board, it will use the test_images as the input to the model.

You might wonder, then, how the model is configured to be trained on the train_images. This is accomplished by using NengoDL, which by default, overrides the output of any input node with the data provided to the function. In the example you linked, the relevant line of code is:, train_labels, epochs=5)

and as the code demonstrates, the model is being trained on train_images. You can read more about NengoDL’s fit function here!

This example steps you through the process of converting a NengoDL model to a NengoLoihi model. I’ll briefly summarize the steps below.

The first step to converting a NengoDL model to a NengoLoihi model would be to ensure that your model can achieve desirable results using spiking neurons. You can work through this example to get an idea of what parameters you can play with (e.g., using synaptic smoothing, or changing the scale_firing_rates parameter) to improve the performance of your model.

After you have ensured that your model can perform adequately using spiking neurons, you’ll want to retrain (and possibly retweak some of the parameters) using the spiking neurons specific to the Loihi board.

Once the training with Loihi spiking neurons is complete, you should be able to run the model on the Loihi board and achieve more desirable results. :smiley:

It helps a lot! Thanks!