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 104 forks source link

How to save PyNN projections and How they can be used for SpiNNaker? #120

Closed aitsam12 closed 2 years ago

aitsam12 commented 2 years ago

Q1) I am running the SNN toolbox with brian2 simulator. I want to save to projections so I can use them for spiNNaker. Can you tell me the complete process to do that?

Q2) I tried using nest simulator but it is giving the following error: ValueError: off_grid_spiking is a readonly kernel parameter

My config file:

Generate Config file

config = configparser.ConfigParser() config['paths'] = { 'path_wd': WORKING_DIR, 'dataset_path': DATASET_DIR, 'filename_ann': MODEL_NAME, 'runlabel': MODELNAME+''+str(NUM_STEPS_PER_SAMPLE) } config['tools'] = { 'evaluate_ann': True, 'parse': True, 'normalize': True, 'simulate': True }

'INI', 'spiNNaker'

config['simulation'] = { 'simulator': 'nest', 'duration': NUM_STEPS_PER_SAMPLE, 'num_to_test': NUM_TEST_SAMPLES, 'batch_size': BATCH_SIZE, 'keras_backend': 'tensorflow' } config['output'] = { 'verbose': 1, 'plot_vars': { 'input_image', 'spiketrains', 'spikerates', 'spikecounts', 'operations', 'normalization_activations', 'activations', 'correlation', 'v_mem', 'error_t' }, 'overwrite': True }

Write the configuration file

config_filepath = os.path.join(WORKING_DIR, 'config') with open(config_filepath, 'w') as configfile: config.write(configfile) ################################################################################

Convert the model using SNNToolbox

if CONVERT_MODEL: main(config_filepath)

rbodo commented 2 years ago

Hi, please take a look at #67 regarding saving projections. As for the other issue, a full stack trace would be necessary, but I'll most likely not be able to help as I have currently no way of debugging this pipeline.

aitsam12 commented 2 years ago

Hi, Apologies to disturb you again. I looked at the #67 issue. Actually, I am unable to find txt files that contain connections. Maybe you can help me with this matter. Can you also guide me on how I can load the connections files for another simulator?

Secondly, I am getting the following warning with spiNNaker: WARNING: No Data available for Segment 0 variable v WARNING: No Data available for Segment 1 variable v WARNING: No Data available for Segment 2 variable v

rbodo commented 2 years ago

Have you checked in the path_wd directory that's specified in the [paths] section in your config file?

For any of the pyNN-based simulators you should be able to do something like sim.Projection(layer1, layer2, sim.FromListConnector(filename)). Otherwise just read the text file using numpy and assign them using the API of the respective simulator.

aitsam12 commented 2 years ago

Hi,

I am also getting 0.00% accuracy with the neuron simulator. But I see the text files for each layer getting saved in the defined '[PATH]'.

Do you have idea why accuracy is like this?

rbodo commented 2 years ago

Please take a look at #98