neuromorphicprocessorproject / snn_toolbox Goto Github PK
View Code? Open in Web Editor NEWToolbox for converting analog to spiking neural networks (ANN to SNN), and running them in a spiking neuron simulator.
License: MIT License
Toolbox for converting analog to spiking neural networks (ANN to SNN), and running them in a spiking neuron simulator.
License: MIT License
Hello, I am trying to reproduce the result in paper theory and tools for the conversion of analog to spiking convolutional neural networks at Matlab platform and got a disturbing questions:
The dynamics of output neurons is severely influenced by large biases. As simulation goes, the output result converge to neuron with largest biases. I have tried 'voltage clamp' method raised in your paper, but didn't got expected effect (little improvement).
Thank you very much for your work in this paper. I have been confused by first problem for long time. Looking forward to your reply!
Hi!
I'm trying to run the vgg16 model offered under folder snn_toolbox/examples/models/, it shows that the required weights file is missing, and I checked snn_toolbox master, there's no file named 64.27_85.59.h5
either.
Is it because that you forget to upload this file? Could you please fix this problem?
Hello, the toolbox is very easy to use, very good!
I encountered a little problem. Cifar10 is selected as the data set,and Using keras_ INI. I used Resnet18 to train ANN network, and the accuracy rate was as high as 95% (with some tricks), but after using ANN to convert to SNN, the accuracy rate of SNN was only 48%. I guess the reason is that there is no conversion in the add part of Resnet module. But I look at the author's snntoolbox.parsing.utils There is' Add 'in it. What's wrong with me?
The attach file is the model of ANN I use. The architecture of the model is shown below. But when I performing the converting program, it failed with the err:
model.zip
It seems my model have an "InputLayer" that the toolbox can't understand, how can I solve this problem?
Hello,
I am currently using the snntoolbox to test SNN conversion accuracy under various configurations.
I was able to get useful information and really appreciate for providing this nice tool.
However, at some point, I found it is quite difficult to achieve error rates reported in the paper (Conversion of analog to spiking neural networks using sparse temporal coding).
For TTFS, I have tried out various configurations (duartions, dt, etc.) on Lenet-5, but I was unable to achieve the error rate of 2% (as reported in the paper).
The error rate is far worse than the error rate reported in the paper.
So, I was wondering if I'm making a mistake at some point (maybe the configuration was wrong).
If you don't mind, can I get the well-fit configuration files for temporal_mean_rate and TTFS coding scheme?
Thank you!
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].
Hello,
to use the toolbox on Loihi, one needs to pass a 'loihi' entry in the config dict for the main method. We have reverse-engineered what needs to go in there, but are not sure about some of the settings.
loihi_config_dict = {
# nWB has a maximum of 8
# weightExponent must be 0 anyway
'connection_kwargs': {'numWeightBits': 8, 'weightExponent': 0},
# vThMant: no idea how to set this, max is 2 ** 17 - 1
# biasExp must be 6 anyway
'compartment_kwargs': {'vThMant': 2 ** 8, 'biasExp': 6},
# no clue how to set this
'desired_threshold_to_input_ratio': 1
}
There seems to be very little documentation on these hyperparameters. Could you possibly give us some details on what exactly they do and reasonable default settings we could use?
Best,
Klaus
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:
snn_toolbox/snntoolbox/simulation/utils.py
Line 1189 in 4d8643b
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.
i tried to convert ANN to SNN with Pytorch model input. However, i got the error as below:
Initializing INI simulator...
Loading data set from '.npz' files in /home/sonlm/workplace/snn_toolbox/temp/vgg9_bn.
WARNING: Ignored mismatch when loading pytorch state_dict.
Error(s) in loading state_dict for Model:
Missing key(s) in state_dict: "features.0.weight", "features.1.weight", "features.1.bias", "features.1.running_mean", "features.1.running_var", "features.3.weight", "features.4.weight", "features.4.bias", "features.4.running_mean", "features.4.running_var", "features.7.weight", "features.8.weight", "features.8.bias", "features.8.running_mean", "features.8.running_var", "features.10.weight", "features.11.weight", "features.11.bias", "features.11.running_mean", "features.11.running_var", "features.14.weight", "features.15.weight", "features.15.bias", "features.15.running_mean", "features.15.running_var", "features.17.weight", "features.18.weight", "features.18.bias", "features.18.running_mean", "features.18.running_var".
Unexpected key(s) in state_dict: "features.module.0.weight", "features.module.1.weight", "features.module.1.bias", "features.module.1.running_mean", "features.module.1.running_var", "features.module.1.num_batches_tracked", "features.module.3.weight", "features.module.4.weight", "features.module.4.bias", "features.module.4.running_mean", "features.module.4.running_var", "features.module.4.num_batches_tracked", "features.module.7.weight", "features.module.8.weight", "features.module.8.bias", "features.module.8.running_mean", "features.module.8.running_var", "features.module.8.num_batches_tracked", "features.module.10.weight", "features.module.11.weight", "features.module.11.bias", "features.module.11.running_mean", "features.module.11.running_var", "features.module.11.num_batches_tracked", "features.module.14.weight", "features.module.15.weight", "features.module.15.bias", "features.module.15.running_mean", "features.module.15.running_var", "features.module.15.num_batches_tracked", "features.module.17.weight", "features.module.18.weight", "features.module.18.bias", "features.module.18.running_mean", "features.module.18.running_var", "features.module.18.num_batches_tracked".
Traceback (most recent call last):
File "cifar10_pytorch_INI.py", line 181, in <module>
main(config_filepath)
File "/home/sonlm/.local/lib/python3.6/site-packages/snntoolbox/bin/run.py", line 31, in main
run_pipeline(config)
File "/home/sonlm/.local/lib/python3.6/site-packages/snntoolbox/bin/utils.py", line 73, in run_pipeline
config.get('paths', 'filename_ann'))
File "/home/sonlm/.local/lib/python3.6/site-packages/snntoolbox/parsing/model_libs/pytorch_input_lib.py", line 81, in load
input_shape = [1] + list(model_pytorch.input_shape)
File "/home/sonlm/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 585, in __getattr__
type(self).__name__, name))
AttributeError: 'Model' object has no attribute 'input_shape'
ANN model: VGG9
Pytorch model script:
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.features = nn.Sequential(
nn.Conv2d(3, 128, kernel_size=3, padding=1, bias=False),
nn.BatchNorm2d(128, momentum=0.9, eps=1e-4),
nn.ReLU(inplace=True),
nn.Conv2d(128, 128, kernel_size=3, padding=1, bias=False),
nn.BatchNorm2d(128, momentum=0.9, eps=1e-4),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=2, stride=2),
nn.Conv2d(128, 256, kernel_size=3, padding=1, bias=False),
nn.BatchNorm2d(256, momentum=0.9, eps=1e-4),
nn.ReLU(inplace=True),
nn.Conv2d(256, 256, kernel_size=3, padding=1, bias=False),
nn.BatchNorm2d(256, momentum=0.9, eps=1e-4),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=2, stride=2),
nn.Conv2d(256, 512, kernel_size=3, padding=1, bias=False),
nn.BatchNorm2d(512, momentum=0.9, eps=1e-4),
nn.ReLU(inplace=True),
nn.Conv2d(512, 512, kernel_size=3, padding=1, bias=False),
nn.BatchNorm2d(512, momentum=0.9, eps=1e-4),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=2, stride=2)
)
self.classifier = nn.Sequential(
nn.Linear(512 * 4 * 4, 1024, bias=False),
nn.BatchNorm1d(1024, momentum=0.9, eps=1e-4),
nn.ReLU(inplace=True),
#nn.Dropout(0.5),
nn.Linear(1024, 1024, bias=False),
nn.BatchNorm1d(1024, momentum=0.9, eps=1e-4),
nn.ReLU(inplace=True),
#nn.Dropout(0.5),
nn.Linear(1024, 10, bias=False),
nn.BatchNorm1d(10, affine=False, momentum=0.9, eps=1e-4),
nn.LogSoftmax(dim=1)
)
# Initialize weights
for m in self.modules():
if isinstance(m, nn.Conv2d):
n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
m.weight.data.normal_(0, math.sqrt(2. / n))
#FIXMEm.bias.data.zero_()
def forward(self, x):
x = self.features(x)
x = x.view(x.size(0), -1)
x = self.classifier(x)
return x
i trained this model with Cifar10 dataset in Pytorch and save model parameters to *.pkl file with this line of code:
filename = os.path.join(save_path, 'model_best.pkl')
torch.save(model.state_dict(), filename)
Could you help me with this?
Thanks you in advance!
When filing a bug, please provide:
I'm building the sample Keras LeNet ANN into an SNN targeting the Brian2 backend. However, there is an error when running the build_convolution section of the conversion where conn is referenced before being defined.
def build_convolution(self, layer, input_weight=None):
from snntoolbox.simulation.utils import build_convolution
delay = self.config.getfloat('cell', 'delay')
transpose_kernel = \
self.config.get('simulation', 'keras_backend') == 'tensorflow'
self._conns, self._biases = build_convolution(layer, delay,
transpose_kernel)
self.set_biases()
print("Connecting layer...")
for conn in self._conns:
i = conn[0]
j = conn[1]
self.connections[-1].connect(i=i, j=j)
if input_weight is not None:
self.connections[-1].w = input_weight.flatten()
else:
# --- here conn is referenced without being defined ---
self.connections[-1].w[i, j] = conn[2]
I believe the following code is appropriate to fix the issue but wanted to confirm.
def build_convolution(self, layer, input_weight=None):
from snntoolbox.simulation.utils import build_convolution
delay = self.config.getfloat('cell', 'delay')
transpose_kernel = \
self.config.get('simulation', 'keras_backend') == 'tensorflow'
self._conns, self._biases = build_convolution(layer, delay,
transpose_kernel)
self.set_biases()
print("Connecting layer...")
np_conns = np.array(self._conns)
self.connections[-1].connect(i=np_conns[:,0].astype('int64'), j=np_conns[:,1].astype('int64'))
if input_weight is None:
self.connections[-1].w = np_conns[:,2]
else:
self.connections[-1].w = input_weight.flatten()
Hi Bodo,,
Your snn_toolbox is very good. I am learning SNN. I am learning your code, I want to convert the model of objection, for example ,YOLO, I found your model is about classification,I tried convert the YOLO (it is Keras model), but failed. I read your documentation ,but I havn't idea. What should I do? Should I going to write a function about detecting positioning? Can you give me suggestion?
I am getting the following error if I use nest or neuron. The simulation runs with the INI simulator. I checked another git issue and I am using pyNN==0.9.2 and keras=2.15
it looks like a PyNN error but I am not sure if you have seen this before.
Evaluating parsed model on 10 samples...
/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/theano/tensor/subtensor.py:2197: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
rval = inputs[0].__getitem__(inputs[1:])
Top-1 accuracy: 100.00%
Top-5 accuracy: 100.00%
Building spiking model...
Building layer: 00Conv2D_6x24x24
......
/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/simulation/target_simulators/pyNN_target_sim.py:221: RuntimeWarning: Biases are implemented but might have no effect. Please check!
"Please check!", RuntimeWarning)
Traceback (most recent call last):
File "/homes/aclyde11/.conda/envs/pynn/bin/snntoolbox", line 10, in <module>
sys.exit(main())
File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/bin/run.py", line 50, in main
test_full(config)
File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/bin/utils.py", line 111, in test_full
spiking_model.build(parsed_model)
File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/simulation/utils.py", line 431, in build
self.build_convolution(layer)
File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/simulation/target_simulators/pyNN_target_sim.py", line 119, in build_convolution
self.sim.FromListConnector(self._conns, ['weight', 'delay'])))
File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/pyNN/connectors.py", line 497, in __init__
if n_columns != len(self.column_names) + 2:
UnboundLocalError: local variable 'n_columns' referenced before assignment
Hi,
what would be the right way to measure how long does a simulation run in real time? Is it possible to measure it?
Hi,
I'm trying to conduct a classification process using DVS camera(.aedat format), and I'm confusing for how should I set the "label_dict" option in the config file
For example, I have an .aedat file with taking a sequence aout 2 minute length, and the class label value varies over time. Such as for the first 10 seconds, the class is 0, and the next 10 seconds, the class is 1, ... and so on.
Thanks.
When I run examples with the brian2 simulator, I get the following error. Could you give me some suggestions? Thank you very much.
Traceback (most recent call last):
File "/Users/ferqui/Envs/ann-snn/bin/snntoolbox", line 10, in <module>
sys.exit(main())
File "/Users/ferqui/Envs/ann-snn/lib/python3.7/site-packages/snntoolbox/bin/run.py", line 50, in main
test_full(config)
File "/Users/ferqui/Envs/ann-snn/lib/python3.7/site-packages/snntoolbox/bin/utils.py", line 111, in test_full
spiking_model.build(parsed_model)
File "/Users/ferqui/Envs/ann-snn/lib/python3.7/site-packages/snntoolbox/simulation/utils.py", line 426, in build
self.add_layer(layer)
File "/Users/ferqui/Envs/ann-snn/lib/python3.7/site-packages/snntoolbox/simulation/target_simulators/brian2_target_sim.py", line 101, in add_layer
self.v_reset, dt=self._dt*self.sim.ms))
File "/Users/ferqui/Envs/ann-snn/lib/python3.7/site-packages/brian2/groups/neurongroup.py", line 500, in __init__
model = Equations(model)
File "/Users/ferqui/Envs/ann-snn/lib/python3.7/site-packages/brian2/equations/equations.py", line 556, in __init__
self._equations = parse_string_equations(eqns)
File "/Users/ferqui/Envs/ann-snn/lib/python3.7/site-packages/brian2/utils/caching.py", line 100, in cached_func
func._cache[cache_key] = func(*args, **kwds)
File "/Users/ferqui/Envs/ann-snn/lib/python3.7/site-packages/brian2/equations/equations.py", line 349, in parse_string_equations
' ' * (p_exc.column - 1) + '^\n' + str(p_exc))
brian2.equations.equations.EquationError: Parsing failed:
v = : 1
Hi rboda:
First of all, thanks for your amazing snntoolbox.
when i run a model with brian2 simulator, i got the following errors,
the following is the running model,
conv2d_1 (Conv2D) (None, 2, 28, 28) 20
activation_1 (Activation) (None, 2, 28, 28) 0
average_pooling2d_1 (Average (None, 2, 14, 14) 0
dropout_1 (Dropout) (None, 2, 14, 14) 0
flatten_1 (Flatten) (None, 392) 0
dense_1 (Dense) (None, 512) 201216
activation_2 (Activation) (None, 512) 0
dropout_2 (Dropout) (None, 512) 0
dense_2 (Dense) (None, 10) 5130
Total params: 206,366
Trainable params: 206,366
Non-trainable params: 0
when i use python version 3.5.4 , got the following error;
[other module version information: Brian2-2.1.3.1 Keras-2.1.3 tensorflow(cpu) - 1.8.0]
Starting new simulation...
Current accuracy of batch:
ERROR Brian 2 encountered an unexpected error. If you think this is bug in Brian 2, please report this issue either to the mailing list at http://groups.google.com/group/brian-development/, or to the issue tracker at https://github.com/brian-team/brian2/issues. Please include this file with debug information in your report: C:\Users\ADMINI1\AppData\Local\Temp\brian_debug_t5eeqquz.log Additionally, you can also include a copy of the script that was run, available at: C:\Users\ADMINI1\AppData\Local\Temp\brian_script_k7gc_dhm.py Thanks! [brian2]
Traceback (most recent call last):
File "C:\Users\Administrator\Anaconda3\envs\py354_snntoolbox\lib\site-packages\brian2\core\network.py", line 841, in before_run
obj.before_run(run_namespace)
File "C:\Users\Administrator\Anaconda3\envs\py354_snntoolbox\lib\site-packages\brian2\groups\group.py", line 1093, in before_run
self.update_abstract_code(run_namespace=run_namespace)
File "C:\Users\Administrator\Anaconda3\envs\py354_snntoolbox\lib\site-packages\brian2\groups\neurongroup.py", line 267, in update_abstract_code
if not is_boolean_expression(code, variables):
File "C:\Users\Administrator\Anaconda3\envs\py354_snntoolbox\lib\site-packages\brian2\parsing\expressions.py", line 64, in is_boolean_expression
mod = ast.parse(expr, mode='eval')
File "C:\Users\Administrator\Anaconda3\envs\py354_snntoolbox\lib\ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "", line 1
v = v_reset
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/Pycharm_workspace/snn_toolbox-master_two/snntoolbox/bin/run.py", line 66, in
main()
File "D:/Pycharm_workspace/snn_toolbox-master_two/snntoolbox/bin/run.py", line 51, in main
test_full(config)
File "D:\Pycharm_workspace\snn_toolbox-master_two\snntoolbox\bin\utils.py", line 131, in test_full
results = run(spiking_model, **testset)
File "D:\Pycharm_workspace\snn_toolbox-master_two\snntoolbox\bin\utils.py", line 204, in wrapper
results.append(run_single(snn, **testset))
File "D:\Pycharm_workspace\snn_toolbox-master_two\snntoolbox\bin\utils.py", line 128, in run
return snn.run(**test_set)
File "D:\Pycharm_workspace\snn_toolbox-master_two\snntoolbox\simulation\utils.py", line 609, in run
output_b_l_t = self.simulate(**data_batch_kwargs)
File "D:\Pycharm_workspace\snn_toolbox-master_two\snntoolbox\simulation\target_simulators\brian2_target_sim.py", line 188, in simulate
report='stdout', report_period=10*self.sim.ms)
File "C:\Users\Administrator\Anaconda3\envs\py354_snntoolbox\lib\site-packages\brian2\core\base.py", line 278, in device_override_decorated_function
return func(*args, **kwds)
File "C:\Users\Administrator\Anaconda3\envs\py354_snntoolbox\lib\site-packages\brian2\units\fundamentalunits.py", line 2375, in new_f
result = f(*args, **kwds)
File "C:\Users\Administrator\Anaconda3\envs\py354_snntoolbox\lib\site-packages\brian2\core\network.py", line 951, in run
self.before_run(namespace)
File "C:\Users\Administrator\Anaconda3\envs\py354_snntoolbox\lib\site-packages\brian2\core\base.py", line 278, in device_override_decorated_function
return func(*args, **kwds)
File "C:\Users\Administrator\Anaconda3\envs\py354_snntoolbox\lib\site-packages\brian2\core\network.py", line 843, in before_run
raise brian_object_exception("An error occurred when preparing an object.", obj, ex)
File "", line None
brian2.core.base.BrianObjectException:
when i use python version 3.6.5 , got the following error;
[other module version information: Brian2-2.0.1 Keras-2.1.6 tensorflow(cpu) - 1.8.0]
Starting new simulation...
Current accuracy of batch:
Starting simulation at t=0. s for a duration of 10. ms
ERROR Brian 2 encountered an unexpected error. If you think this is bug in Brian 2, please report this issue either to the mailing list at http://groups.google.com/group/brian-development/, or to the issue tracker at https://github.com/brian-team/brian2/issues. Please include this file with debug information in your report: C:\Users\ADMINI1\AppData\Local\Temp\brian_debug_w4v38fbm.log Additionally, you can also include a copy of the script that was run, available at: C:\Users\ADMINI1\AppData\Local\Temp\brian_script_rs733m8u.py Thanks! [brian2]
Traceback (most recent call last):
File "C:\Users\Administrator\Anaconda3\envs\snntoolboox_play\lib\site-packages\brian2\codegen\runtime\numpy_rt\numpy_rt.py", line 122, in run
exec(self.compiled_code, self.namespace)
File "(string)", line 16, in
NameError: name 'v' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/Pycharm_workspace/snn_toolbox-master_two/snntoolbox/bin/run.py", line 66, in
main()
File "D:/Pycharm_workspace/snn_toolbox-master_two/snntoolbox/bin/run.py", line 51, in main
test_full(config)
File "D:\Pycharm_workspace\snn_toolbox-master_two\snntoolbox\bin\utils.py", line 131, in test_full
results = run(spiking_model, **testset)
File "D:\Pycharm_workspace\snn_toolbox-master_two\snntoolbox\bin\utils.py", line 204, in wrapper
results.append(run_single(snn, **testset))
File "D:\Pycharm_workspace\snn_toolbox-master_two\snntoolbox\bin\utils.py", line 128, in run
return snn.run(**test_set)
File "D:\Pycharm_workspace\snn_toolbox-master_two\snntoolbox\simulation\utils.py", line 609, in run
output_b_l_t = self.simulate(**data_batch_kwargs)
File "D:\Pycharm_workspace\snn_toolbox-master_two\snntoolbox\simulation\target_simulators\brian2_target_sim.py", line 188, in simulate
report='stdout', report_period=10*self.sim.ms)
File "C:\Users\Administrator\Anaconda3\envs\snntoolboox_play\lib\site-packages\brian2\core\base.py", line 278, in device_override_decorated_function
return func(*args, **kwds)
File "C:\Users\Administrator\Anaconda3\envs\snntoolboox_play\lib\site-packages\brian2\units\fundamentalunits.py", line 2428, in new_f
result = f(*args, **kwds)
File "C:\Users\Administrator\Anaconda3\envs\snntoolboox_play\lib\site-packages\brian2\core\network.py", line 842, in run
obj.run()
File "C:\Users\Administrator\Anaconda3\envs\snntoolboox_play\lib\site-packages\brian2\core\base.py", line 181, in run
codeobj()
File "C:\Users\Administrator\Anaconda3\envs\snntoolboox_play\lib\site-packages\brian2\codegen\codeobject.py", line 98, in call
return self.run()
File "C:\Users\Administrator\Anaconda3\envs\snntoolboox_play\lib\site-packages\brian2\codegen\runtime\numpy_rt\numpy_rt.py", line 131, in run
raise brian_object_exception(message, self.owner, exc)
brian2.core.base.BrianObjectException: Original error and traceback:
Traceback (most recent call last):
File "C:\Users\Administrator\Anaconda3\envs\snntoolboox_play\lib\site-packages\brian2\codegen\runtime\numpy_rt\numpy_rt.py", line 122, in run
exec(self.compiled_code, self.namespace)
File "(string)", line 16, in
NameError: name 'v' is not defined
Error encountered with object named "synapses".
Object was created here (most recent call only, full details in debug log):
File "D:\Pycharm_workspace\snn_toolbox-master_two\snntoolbox\simulation\target_simulators\brian2_target_sim.py", line 103, in add_layer
dt=self._dt*self.sim.ms))
An exception occured during the execution of code object synapses_pre_codeobject.
The error was raised in the following line:
v += w
NameError: name 'v' is not defined
(See above for original error message and traceback.)
Process finished with exit code 1
Could you kindly help me to find the reason? I am looking for your reply.
Yu
I'm trying to convert an Keras ANN, which uses custom_objects. The custom_objects are two custom layers, and one custom initializer. As far as I can tell this is not yet possible with snn_toolbox. I have found this function, which suggests that I can only use these pre-defined activations, and that I can't use custom initializers at all.
You can find the definition of my custom_objects here.
I intend to import my model into snn_toolbox by doing this:
model = snntoolbox.utils.utils.apply_modifications(model, $my_custom_objects)
Hello,
Thanks for your wonderful work, it helps me a lot to understand SNN.
I am trying to runing the example, when I run the mnist_keras_INI.py, the accuracy is
Moving accuracy of SNN (top-1, top-1): 96.68%, 96.67%.
Moving accuracy of ANN (top-1, top-1): 96.94%, 99.93%.
But I get this
Current accuracy of batch:
6.25%_12.50%_14.06%_18.75%_18.75%_31.25%_56.25%_70.31%_81.25%_90.62%_90.62%_92.19%_95.31%_96.88%_95.31%_96.88%_96.88%_96.88%_96.88%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_98.44%_Average spike rate: 0.0 spikes per simulation time step.
Could you tell me why there's no spike, but the accuracy is right? I only change the num_to_test to 10000 and batch_size to 64 in the configuration of mnist_keras_INI.py.
And I also have trained an ANN model myself on MNIST, then use the toolbox to convert and simulate, the result is similar.
I have used two version of the toolbox, snntoolbox 0.4.1 with keras2.2.4, tensorflow-gpu1.9.0, and snntoolbox 0.5.0 with tensorflow-gpu2.2.0. The result is similar too.
Thank you!
Hi Bodo,
I read in your documentation:
[Different input types: In all other simulators, only Poisson input is supported at the moment. INIsim implements constant input currents as well as input from DVS event sequences.]
Does it mean that all other simulators except INIsim use Poisson input?
I ran using 'nest' simulator; in the config file for lenet5/keras: i set poisson_input = True or False, both are able to run, may I know why?
In pyNN_targer_sim.py:
self.layers.append(self.sim.Population(
np.asscalar(np.prod(input_shape[1:], dtype=np.int)),
self.sim.SpikeSourcePoisson(), label='InputLayer'))
The input layer is supposed to use pyNN's spikesourcepoisson; the spike rate is default I presumed as
the SpikeSourcePoisson() rate is not declared?
How does SpikeSourcePoisson read mnist generated spiketrains?
Rgds
Del
I ran the simulation for the lenet5 example using poisson inputs on a single image. The poisson spike train was of duration 10 timesteps. I observed the values of 'mem_n_b_l_t' of the last layer and saw that the membrane potential does not reset to 0 after a spike occurs. In fact, it remains the same until, in the next time step, a weighted sum of the input spikes is added to it.
So the membrane potential either remains constant(no spike) or increases over its earlier value(spike). This is in contrast with my understanding that membrane potential should reset to 0 once the threshold is reached. Also, isn't the threshold supposed to be fixed at 1 for all timesteps?
My questions might be naive but I am trying hard to understand how SNNs work. I would highly appreciate it if you could clarify this part for me.
Thanks!
Running mnist_keras_nest.py
example with NEST v2.18 throws an exception
Initializing nest simulator...
CSAConnector: libneurosim support not available in NEST.
Falling back on PyNN's default CSAConnector.
Please re-compile NEST using --with-libneurosim=PATH
/home/dizcza/anaconda3/envs/snn_toolbox-conda/lib/python3.7/site-packages/PyNN-0.9.5.dev0-py3.7.egg/pyNN/nest/__init__.py:53: UserWarning:Unable to install NEST extensions. Certain models may not be available.
/home/dizcza/anaconda3/envs/snn_toolbox-conda/lib/python3.7/site-packages/nest/lib/hl_api_helper.py:127: UserWarning:
ResetNetwork is deprecated and will be removed in NEST 3.0.
Loading data set from '.npz' files in /home/dizcza/PycharmProjects/other/snn_toolbox/temp/1575220683.8345785.
Evaluating input model on 5 samples...
Top-1 accuracy: 100.00%
Top-5 accuracy: 100.00%
Parsing input model...
Skipping layer InputLayer.
Parsing layer Conv2D.
Using activation relu.
Parsing layer Conv2D.
Using activation relu.
Parsing layer AveragePooling2D.
Parsing layer Conv2D.
Using activation relu.
Parsing layer Flatten.
Skipping layer Dropout.
Parsing layer Dense.
Using activation softmax.
Building parsed model...
Compiling parsed model...
Normalizing parameters...
Using 6000 samples for normalization.
INFO: Need ['0.06', '0.08', '0.00', '0.00'] GB for layer activations.
May have to reduce size of data set used for normalization.
Calculating activations of layer 00Conv2D_12x12x16 ...
Writing activations to disk...
Scale factor: 2.31.
Calculating activations of layer 01Conv2D_10x10x32 ...
Writing activations to disk...
Scale factor: 6.17.
Calculating activations of layer 03Conv2D_5x5x8 ...
Writing activations to disk...
Scale factor: 11.85.
Calculating activations of layer 05Dense_10 ...
Writing activations to disk...
Scale factor: 1.00.
Using scale factor 1.00 for softmax layer.
Evaluating parsed model on 5 samples...
Top-1 accuracy: 100.00%
Top-5 accuracy: 100.00%
Building spiking model...
Building layer: 00Conv2D_12x12x16
Traceback (most recent call last):
File "examples/mnist_keras_nest.py", line 149, in <module>
main(config_filepath)
File "/home/dizcza/PycharmProjects/other/snn_toolbox/snntoolbox/bin/run.py", line 31, in main
run_pipeline(config)
File "/home/dizcza/PycharmProjects/other/snn_toolbox/snntoolbox/bin/utils.py", line 129, in run_pipeline
spiking_model.build(parsed_model, **testset)
File "/home/dizcza/PycharmProjects/other/snn_toolbox/snntoolbox/simulation/utils.py", line 436, in build
self.add_layer(layer)
File "/home/dizcza/PycharmProjects/other/snn_toolbox/snntoolbox/simulation/target_simulators/pyNN_target_sim.py", line 85, in add_layer
self.sim.IF_curr_exp, self.cellparams, label=layer.name))
File "/home/dizcza/anaconda3/envs/snn_toolbox-conda/lib/python3.7/site-packages/PyNN-0.9.5.dev0-py3.7.egg/pyNN/nest/populations.py", line 114, in __init__
super(Population, self).__init__(size, cellclass, cellparams, structure, initial_values, label)
File "/home/dizcza/anaconda3/envs/snn_toolbox-conda/lib/python3.7/site-packages/PyNN-0.9.5.dev0-py3.7.egg/pyNN/common/populations.py", line 671, in __init__
self._create_cells()
File "/home/dizcza/anaconda3/envs/snn_toolbox-conda/lib/python3.7/site-packages/PyNN-0.9.5.dev0-py3.7.egg/pyNN/nest/populations.py", line 135, in _create_cells
self.all_cells = nest.Create(nest_model, self.size, params=params)
File "/home/dizcza/anaconda3/envs/snn_toolbox-conda/lib/python3.7/site-packages/nest/ll_api.py", line 246, in stack_checker_func
return f(*args, **kwargs)
File "/home/dizcza/anaconda3/envs/snn_toolbox-conda/lib/python3.7/site-packages/nest/lib/hl_api_nodes.py", line 80, in Create
sr(cmd)
File "/home/dizcza/anaconda3/envs/snn_toolbox-conda/lib/python3.7/site-packages/nest/ll_api.py", line 132, in catching_sli_run
raise exceptionCls(commandname, message)
nest.ll_api.BadProperty: ("BadProperty in SetDefaults_l_D: Setting status of model 'iaf_psc_exp_ps': Refractory time must be at least one time step.", 'BadProperty', <SLILiteral: SetDefaults_l_D>, ": Setting status of model 'iaf_psc_exp_ps': Refractory time must be at least one time step.")
NEST v2.18, conda-forge built. The same with libneurosim
compiled.
pyNN is installed as suggested here (otherwise, it does not work at all)
Hi Bodo,
I tried running the BinaryNet example without making any changes to the config file. For some reason, the accuracy of the parsed model and of the converted SNN is very poor (5%). The accuracy of the converted SNN is even worse (5%). Also, I was expecting the weights in the 88.22_parsed.h5 file to be binarized as we have set "binarize_weights=True", but this is not the case. The weight values are full-precision floats. Am I missing something? Please guide me.
My lasagne and theano versions are 0.2.dev1 and 1.0.2 respectively and I have installed the snntoolbox from the github repo.
I am attaching a snapshot of the simulation for your reference.
hi, when I run the example of Inceptionv3, it show RecursionError as I wrote in the title
All the parameters I set followed the examples
I also change the data_format to channels_first
While trying to run keras example of lenet5 this error appears
OS: windows 10
tensorflow 1.4.0 (with CUDA)
keras 2.1.2
Scale factor: 1.00.
Traceback (most recent call last):
File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\programdata\anaconda3\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\Scripts\snntoolbox.exe_main.py", line 9, in
File "c:\programdata\anaconda3\lib\site-packages\snntoolbox\bin\run.py", line 50, in main
test_full(config)
File "c:\programdata\anaconda3\lib\site-packages\snntoolbox\bin\utils.py", line 95, in test_full
normalize_parameters(parsed_model, config, **normset)
File "c:\programdata\anaconda3\lib\site-packages\snntoolbox\conversion\utils.py", line 151, in normalize_parameters
input_layer = layer._inbound_nodes[0].inbound_layers[0].name
AttributeError: 'Conv2D' object has no attribute '_inbound_nodes'
Hi, I have a few questions.
I was wondering whether inserting noise into each neuron would improve the accuracy of my SNN. Is there any mechanism present to do this here? If not, do you have any pointers about where I should start to implement it?
Is it possible to do common layers between an ensemble of models, where inter-model neurons are only inhibitory neurons?
Am I correct to assume that the simulations simulate learning, and change the weights between the neurons after we start with ANN equivalent values?
Thank you for your time.
snn_toolbox/snntoolbox/simulation/utils.py
Line 1165 in f5877ed
I believe that to properly set the biases for the correct groups of feature maps, this line should be as follows:
i_offset[i * n:(i + 1) * n] = biases[i]
Hi rboda,
Thanks for your wonderful toolbox.
I tried the example about BinaryNet on cifar-10 and INI simulator. But the accuracy is quite low and different with your paper.
The toolbox output is as follow.
//////////////////////////////////////////////////////////////////////////////////////////////////////////
Batch 2 of 2 completed (100.0%)
Moving accuracy of SNN (top-1, top-1): 5.00%, 10.00%.
Moving accuracy of ANN (top-1, top-1): 5.00%, 65.00%.
Simulation finished.
Total accuracy: 5.00% on 20 test samples.
/////////////////////////////////////////////////////////////////////////////////////////////////////////
And I used the example config downloaded from github.
Could you kindly help me to find the reason? I am looking for your reply.
Yi
Hello again,
how should I use parameter_sweep section of the config file? When I add the following part to my config:
config['parameter_sweep'] = { 'param_values': [1, 0.1, 0.01], 'param_name': 'v_tresh' }
it causes an error:
KeyError Traceback (most recent call last)
/usr/lib/python3.6/configparser.py in get(self, section, option, raw, vars, fallback)
788 try:
--> 789 value = d[option]
790 except KeyError:
5 frames
/usr/lib/python3.6/collections/__init__.py in __getitem__(self, key)
882 pass
--> 883 return self.__missing__(key) # support subclasses that define __missing__
884
/usr/lib/python3.6/collections/__init__.py in __missing__(self, key)
874 def __missing__(self, key):
--> 875 raise KeyError(key)
876
KeyError: 'v_tresh'
During handling of the above exception, another exception occurred:
NoOptionError Traceback (most recent call last)
<ipython-input-4-558dc6021dcd> in <module>()
64
65 # RUN SNN TOOLBOX
---> 66 main(config_filepath)
/usr/local/lib/python3.6/dist-packages/snntoolbox/bin/run.py in main(filepath)
28
29 if filepath is not None:
---> 30 config = update_setup(filepath)
31 run_pipeline(config)
32 return
/usr/local/lib/python3.6/dist-packages/snntoolbox/bin/utils.py in update_setup(config_filepath)
513 param_name = config.get('parameter_sweep', 'param_name')
514 try:
--> 515 config.get('cell', param_name)
516 except KeyError:
517 print("Unkown parameter name {} to sweep.".format(param_name))
/usr/lib/python3.6/configparser.py in get(self, section, option, raw, vars, fallback)
790 except KeyError:
791 if fallback is _UNSET:
--> 792 raise NoOptionError(option, section)
793 else:
794 return fallback
NoOptionError: No option 'v_tresh' in section: 'cell'
I see that the build_dense function has been rewritten to better incorporate flatten layers. However, something about how the function has changed is leading to a drop in accuracy when I'm executing the example MNIST network.
When I replace the function with its old version, activation/SR correlation is much improved and accuracy is restored. I can't quite figure out why this is the case since it seems like the two functions should be doing the same thing when no flatten layer is involved.
New Brian2 build_dense function:
def build_dense(self, layer, weights=None):
if layer.activation == 'softmax':
raise warnings.warn("Activation 'softmax' not implemented. Using "
"'relu' activation instead.", RuntimeWarning)
_weights, biases = layer.get_weights()
if weights is None:
weights = _weights
set_biases(biases)
delay = self.config.getfloat('cell', 'delay')
connections = []
if len(self.flatten_shapes) == 1:
print("Swapping data_format of Flatten layer.")
flatten_name, shape = self.flatten_shapes.pop()
if self.data_format == 'channels_last':
y_in, x_in, f_in = shape
else:
f_in, y_in, x_in = shape
for i in range(weights.shape[0]): # Input neurons
# Sweep across channel axis of feature map. Assumes that each
# consecutive input neuron lies in a different channel. This is
# the case for channels_last, but not for channels_first.
f = i % f_in
# Sweep across height of feature map. Increase y by one if all
# rows along the channel axis were seen.
y = i // (f_in * x_in)
# Sweep across width of feature map.
x = (i // f_in) % x_in
new_i = f * x_in * y_in + x_in * y + x
for j in range(weights.shape[1]): # Output neurons
connections.append((new_i, j, weights[i, j], delay))
elif len(self.flatten_shapes) > 1:
raise RuntimeWarning("Not all Flatten layers have been consumed.")
else:
for i in range(weights.shape[0]):
for j in range(weights.shape[1]):
connections.append((i, j, weights[i, j], delay))
connections = np.array(connections)
self.connections[-1].connect(i=connections[:, 0].astype('int64'),
j=connections[:, 1].astype('int64'))
self.connections[-1].w = connections[:, 2]
The old function:
def build_dense(self, layer, input_weight=None):
if layer.activation == 'softmax':
raise warnings.warn("Activation 'softmax' not implemented. Using "
"'relu' activation instead.", RuntimeWarning)
weights, biases = layer.get_weights()
self.set_biases(biases)
self.connections[-1].connect(True)
if input_weight is not None:
self.connections[-1].w = input_weight.flatten()
else:
self.connections[-1].w = weights.flatten()
print("Lenght of weights:{}".format(len(self.connections[-1].w)))
Hello,
it seems the config wants "Neuron" for a simulator and then runs PyNN.Neuron but PyNN documentation shows it is supposed to be PyNN.neuron
I am training a custom dataset using Keras on GPU and uses categorical cross entropy. I am using keras multi GPU datagenerator function to load the data from sub directories. While conversion, SNN toolbox is showing Attribute error: sequential model has no loss function. Could you help me ? Is that due to datagenerator function ? Should I load the dataset similar to MNIST or CIFAR-10 examples ?
Hi rbodo,
I trained a binarynet model with keras(2.2.4).
when i use snntoolbox , i get the following result:
///////////////////////////////////////////////
Evaluating input model on 100 samples...
Top-1 accuracy: 98.00%
Top-5 accuracy: 100.00%
////////////////////////////////////////////
Evaluating parsed model on 100 samples...
Top-1 accuracy: 98.00%
Top-5 accuracy: 100.00%
////////////////////////////////////////////
Moving accuracy of SNN (top-1, top-5): 15.00%, 53.00%.
Moving accuracy of ANN (top-1, top-5): 98.00%, 100.00%.
Simulation finished.
Total accuracy: 15.00% on 100 test samples.
Accuracy averaged over classes: 15.06%
///////////////////////////////////////////////////
and the config file as the following:
//////////////////////////////////////
[paths]
dataset_path = D:\Pycharm_workspace\snn_toolbox-master-binary\examples\datasets\mnist
filename_ann = binarynet_mnist_all_bias_95.87
[input]
model_lib = keras
[tools]
evaluate_ann = True
normalize = False
[simulation]
simulator = INI
duration = 30
num_to_test = 100
batch_size = 50
keras_backend = tensorflow
top_k = 5
[cell]
binarize_weights = True
reset = Reset to zero
//////////////////////////////////////
if i use a float model, the snntoolbox works well, but binarynet model, it's not good , i really don't know why, please give me some suggestions,
thanks a lot.
I've got error shown below.
TypeError: __init__() got an unexpected keyword argument 'ragged'
I'm guessing this error happened due to the difference of original keras and tensorflow.keras.
Is it possible use tensorflow.keras?
Hi,
first of all, great work and interesting read!
I would like to run your examples, but get errors for lenet5 (keras and lasagne) and inceptionV3.
I already downgraded keras to version 2.1.6 like suggested in other tickets.
I have the suspicion that my errors are due to different versions for tensorflow, theano and lasagne.
Can you please provide these versions or ideally the version of all software components, e.g. "conda list --export > packages.txt".
Cheers,
Thomas
Hi Bodo,
I trained 'cnn_BN,py" model without BIAS and using AveragePooling2D. The accuracy is 82.65.h5
with gcn and zca=False,
I regenerated the x_norm.npz using "cifar10.py" with gca and zca=False.
I checked the normalisation weight distribution plots for both INI and nest. They are similar.
When I run using 20 samples on INI simulator. the accuracy is 90%; but when using nest
simulator the accuracy is at chance level (10%). For nest simulator, I used "reset by subtraction" too.
The scale factor for "poisson rate" of input layer is changed from 1000 to 2000 and cell Vthres = 0.75; in order to match the average spiking rate comparable to INI (0.03 per sim. time step).
May I know why is the error so high and what other parameters can I tune?
Attached are the Pearson and Total spike counts.
When I run lenet keras model in snntoolbox, it caused error in simulation. The config file is shown as below:
[paths]
dataset_path = %(path_wd)s/../../../datasets/mnist
filename_ann = 98.96
[tools]
evaluate_ann = True
[simulation]
simulator = brian
duration = 30
num_to_test = 10
batch_size = 1
keras_backend = tensorflow
[input]
poisson_input = False
[output]
log_vars = {'all'}
plot_vars = {'all'}
The error information is shown as below:
Starting new simulation...
Current accuracy of batch:
(array([], dtype=int64), <type 'numpy.ndarray'>)
[]
<type 'numpy.ndarray'>
(array([0., 0., 0., ..., 0., 0., 0.]), <type 'numpy.ndarray'>)
((3456,), 3456)
[0. 0. 0. ... 0. 0. 0.]
Traceback (most recent call last):
File "", line 1, in
File "test.py", line 17, in sim
result = spiking_model.run(**testset)
File "/home/zhulingling/.local/lib/python2.7/site-packages/snntoolbox/simulation/utils.py", line 611, in run
output_b_l_t = self.simulate(**data_batch_kwargs)
File "/home/zhulingling/.local/lib/python2.7/site-packages/snntoolbox/simulation/target_simulators/pyNN_target_sim.py", line 138, in simulate
self.sim.run(self._duration - self._dt)
File "/home/zhulingling/.local/lib/python2.7/site-packages/pyNN/common/control.py", line 111, in run
return run_until(simulator.state.t + simtime, callbacks)
File "/home/zhulingling/.local/lib/python2.7/site-packages/pyNN/common/control.py", line 93, in run_until
simulator.state.run_until(time_point)
File "/home/zhulingling/.local/lib/python2.7/site-packages/pyNN/brian/simulator.py", line 57, in run_until
self.run(tstop - self.t)
File "/home/zhulingling/.local/lib/python2.7/site-packages/pyNN/brian/simulator.py", line 54, in run
self.network.run(simtime * ms)
File "/home/zhulingling/.local/lib/python2.7/site-packages/brian/network.py", line 574, in run
self.update()
File "/home/zhulingling/.local/lib/python2.7/site-packages/brian/network.py", line 518, in update
f()
File "/home/zhulingling/.local/lib/python2.7/site-packages/brian/neurongroup.py", line 549, in reset
self._resetfun(self)
File "/home/zhulingling/.local/lib/python2.7/site-packages/brian/reset.py", line 153, in call
V[P.LS.lastspikes()] = self.resetvalue
ValueError: shape mismatch: value array of shape (3456,) could not be broadcast to indexing result of shape (0,)
waiting for your help! Thank you!
hi, I meet the problem showed belows when I just run the command ' snntoolbox config -t '
ValueError: Dimensions must be equal, but are 6 and 3 for '01MaxPooling2D_6x12x12_1/add' (op: 'Add') with input shapes: [1,6,12,12], [1,3,12,24].
Could you please tell me how to fix this problem?
I think the code in 'snntoolbox/bin/gui/gui.py' line 1512 has a small bug,
os.path.join(os.path.dirname(__file__), '..', '..','snntoolbox' 'config_defaults')
, here the 3rd string 'snntoolbox' should not be included because the path is used relatively. After removing it, I can run the gui without error.
I run the LeNet example in Keras, the command is "snntoolbox -t ./examples/models/lenet5/keras/config", and there is an error, "AttributeError: 'Conv2D' object has no attribute '_inbound_nodes'"
Could you give me some suggestions? Thank you very much! @rbodo
Hi
i am new to spiking neural network. i noted that your toolbox is converting existing dnn implementation into spiking network to be run in the gpu as simulator prior into the spiking chip. is it possible to use in the gpu for real work instead of just a simulator? thank you
Hi Bodo,
You have a great toolbox!
I understand that the toolbox can use Spinnaker as simulator after converting to SNN.
May I know if I wish to run the SNN on Spinnaker, what should I change in the config file ?
simulator = spiNNaker?
I tried changing the simulator = nest.
I am unable to run due to ImportError: no module named nest.
May I know what else should I change in order for it to run?
To think that the pyNN_target_sim.py is quite similar to Spinnaker. Not sure what to modify
in order to be compatible with Spinnaker.
Best Regards
Del
Hello,
is it possible to load a Keras model which was compiled with custom metrics? As I understand it, it is a similar issue as #50.
Do I have to hardcode the custom metrics into SNN-TB? What should be changed?
Hello,
we would like to be able to deploy a converted spiking model to Loihi on Intel NCL. When specifiying the correct backend, we however get: ImportError: No module named 'nxsdk_modules'
. We tested nxsdk 0.8.5 and 0.9, both exhibiting the same behaviour. It seems related to this commit: 495714a, where the Loihi-related code was removed and the import was added. Where can we obtain the correct module to be able to run on loihi? Thanks for your help.
When I run examples, I get the following error. Could you give me some suggestions? Thank you very much.
snntoolbox <./examples/models/vgg16/config> -t
Traceback (most recent call last):
File "/home/beans/anaconda3/envs/py27/bin/snntoolbox", line 11, in
sys.exit(main())
File "/home/beans/snn_toolbox/snntoolbox/bin/run.py", line 38, in main
filepath = os.path.abspath(args.config_filepath)
File "/home/beans/anaconda3/envs/py27/lib/python3.6/posixpath.py", line 371, in abspath
path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType
I encounter this error when I'm trying to convert my ANN.
Please let me know what to do, or if you need any extra information.
Here is the partial output:
Loading data set from '.npz' files in C:\Users\Psyf\Desktop\git\EEG_Trials\dataset.
Parsing input model...
Skipping layer InputLayer.
Skipping layer Conv1D.
Using BatchNorm axis -1.
Traceback (most recent call last):
File "c:\users\psyf\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\psyf\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Psyf\Anaconda3\Scripts\snntoolbox.exe\__main__.py", line 9, in <module>
File "c:\users\psyf\anaconda3\lib\site-packages\snntoolbox\bin\run.py", line 50, in main
test_full(config)
File "c:\users\psyf\anaconda3\lib\site-packages\snntoolbox\bin\utils.py", line 89, in test_full
model_parser.parse()
File "c:\users\psyf\anaconda3\lib\site-packages\snntoolbox\parsing\utils.py", line 124, in parse
prev_layer_idx = name_map[str(id(prev_layer))]
KeyError: '2443060234448'```
I was running some experiments, although the activation figures, other plots are fine, but the Pearson coefficients figure and activity distribution figure are totally different from previous.
As example, this is what I got from a average pooling experiment.
And this is what I got from max pooling last night when I try to improve the memory usage:
Did anyone changed the behaviour of how the model calculating the activation?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.