spikingjelly.activation_based.examples package
Subpackages
Submodules
spikingjelly.activation_based.examples.A2C module
spikingjelly.activation_based.examples.DQN_state module
spikingjelly.activation_based.examples.PPO module
spikingjelly.activation_based.examples.Spiking_A2C module
spikingjelly.activation_based.examples.Spiking_DQN_state module
spikingjelly.activation_based.examples.Spiking_PPO module
spikingjelly.activation_based.examples.cifar10_r11_enabling_spikebased_backpropagation module
代码作者: Yanqi Chen <chyq@pku.edu.cn>
A reproduction of the paper Enabling Spike-Based Backpropagation for Training Deep Neural Network Architectures.
This code reproduces a novel gradient-based training method of SNN. We to some extent refer to the network structure and some other detailed implementation in the authors’ implementation. Since the training method and neuron models are slightly different from which in this framework, we rewrite them in a compatible style.
Assuming you have at least 1 Nvidia GPU.
- class spikingjelly.activation_based.examples.cifar10_r11_enabling_spikebased_backpropagation.relu(*args, **kwargs)[源代码]
基类:
Function
- class spikingjelly.activation_based.examples.cifar10_r11_enabling_spikebased_backpropagation.BaseNode(v_threshold=1.0, v_reset=0.0, surrogate_function=<built-in method apply of FunctionMeta object>, monitor=False)[源代码]
基类:
Module
- class spikingjelly.activation_based.examples.cifar10_r11_enabling_spikebased_backpropagation.LIFNode(tau=100.0, v_threshold=1.0, v_reset=0.0, surrogate_function=<built-in method apply of FunctionMeta object>, fire=True)[源代码]
基类:
BaseNode
- class spikingjelly.activation_based.examples.cifar10_r11_enabling_spikebased_backpropagation.IFNode(v_threshold=0.75, v_reset=0.0, surrogate_function=<built-in method apply of FunctionMeta object>)[源代码]
基类:
BaseNode
spikingjelly.activation_based.examples.classify_dvsg module
spikingjelly.activation_based.examples.conv_fashion_mnist module
- class spikingjelly.activation_based.examples.conv_fashion_mnist.CSNN(T: int, channels: int, use_cupy=False)[源代码]
基类:
Module
- spikingjelly.activation_based.examples.conv_fashion_mnist.main()[源代码]
(sj-dev) wfang@Precision-5820-Tower-X-Series:~/spikingjelly_dev$ python -m spikingjelly.activation_based.examples.conv_fashion_mnist -h
- usage: conv_fashion_mnist.py [-h] [-T T] [-device DEVICE] [-b B] [-epochs N] [-j N] [-data-dir DATA_DIR] [-out-dir OUT_DIR]
[-resume RESUME] [-amp] [-cupy] [-opt OPT] [-momentum MOMENTUM] [-lr LR]
Classify Fashion-MNIST
- optional arguments:
- -h, --help
show this help message and exit
- -T T
simulating time-steps
-device DEVICE device -b B batch size -epochs N number of total epochs to run -j N number of data loading workers (default: 4) -data-dir DATA_DIR root dir of Fashion-MNIST dataset -out-dir OUT_DIR root dir for saving logs and checkpoint -resume RESUME resume from the checkpoint path -amp automatic mixed precision training -cupy use cupy neuron and multi-step forward mode -opt OPT use which optimizer. SDG or Adam -momentum MOMENTUM momentum for SGD -save-es dir for saving a batch spikes encoded by the first {Conv2d-BatchNorm2d-IFNode}
spikingjelly.activation_based.examples.dqn_cart_pole module
spikingjelly.activation_based.examples.lif_fc_mnist module
spikingjelly.activation_based.examples.rsnn_sequential_fmnist module
- class spikingjelly.activation_based.examples.rsnn_sequential_fmnist.StatefulSynapseNet[源代码]
基类:
Module
spikingjelly.activation_based.examples.speechcommands module
代码作者: Yanqi Chen <chyq@pku.edu.cn>, Ismail Khalfaoui Hassani <ismail.khalfaoui-hassani@univ-tlse3.fr>
A reproduction of the paper Technical report: supervised training of convolutional spiking neural networks with PyTorch.
This code reproduces an audio recognition task using convolutional SNN. It provides comparable performance to ANN.
备注
To prevent too much dependency like librosa, we implement MelScale ourselves. We provide two kinds of DCT types: Slaney & HTK. Slaney style is used in the original paper and will be applied by default.
Confusion matrix of TEST set after training (50 epochs):
Count |
Prediction |
||||||||||||
“Yes” |
“Stop” |
“No” |
“Right” |
“Up” |
“Left” |
“On” |
“Down” |
“Off” |
“Go” |
Other |
Silence |
||
Ground Truth |
“Yes” |
234 |
0 |
2 |
0 |
0 |
3 |
0 |
0 |
0 |
1 |
16 |
0 |
“Stop” |
0 |
233 |
0 |
1 |
5 |
0 |
0 |
0 |
0 |
1 |
9 |
0 |
|
“No” |
0 |
1 |
223 |
1 |
0 |
1 |
0 |
5 |
0 |
9 |
12 |
0 |
|
“Right” |
0 |
0 |
0 |
234 |
0 |
0 |
0 |
0 |
0 |
0 |
24 |
1 |
|
“Up” |
0 |
4 |
0 |
0 |
249 |
0 |
0 |
0 |
8 |
0 |
11 |
0 |
|
“Left” |
3 |
1 |
2 |
3 |
1 |
250 |
0 |
0 |
1 |
0 |
6 |
0 |
|
“On” |
0 |
3 |
0 |
0 |
0 |
0 |
231 |
0 |
2 |
1 |
9 |
0 |
|
“Down” |
0 |
0 |
7 |
0 |
0 |
1 |
2 |
230 |
0 |
4 |
8 |
1 |
|
“Off” |
0 |
0 |
2 |
1 |
4 |
2 |
6 |
0 |
237 |
1 |
9 |
0 |
|
“Go” |
0 |
2 |
5 |
0 |
0 |
2 |
0 |
1 |
5 |
220 |
16 |
0 |
|
Other |
6 |
21 |
12 |
25 |
22 |
19 |
25 |
14 |
11 |
40 |
4072 |
1 |
|
Silence |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
260 |
- spikingjelly.activation_based.examples.speechcommands.create_fb_matrix(n_freqs: int, f_min: float, f_max: float, n_mels: int, sample_rate: int, dct_type: Optional[str] = 'slaney') Tensor [源代码]
- class spikingjelly.activation_based.examples.speechcommands.MelScaleDelta(order, n_mels: int = 128, sample_rate: int = 16000, f_min: float = 0.0, f_max: Optional[float] = None, n_stft: Optional[int] = None, dct_type: Optional[str] = 'slaney')[源代码]
基类:
Module