fangwei123456 / Spike-Element-Wise-ResNet

Deep Residual Learning in Spiking Neural Networks
Mozilla Public License 2.0
140 stars 21 forks source link

sew resnet training #18

Closed Snow-Crash closed 1 year ago

Snow-Crash commented 1 year ago

Hi, thanks for open sourcing this great library. I'm using version 0.0.0.0.12 to run some experiments with sewresnet. I followed the traing code from https://spikingjelly.readthedocs.io/zh_CN/0.0.0.0.12/clock_driven_en/16_train_large_scale_snn.html The only change is below, i.e. use sewresent instead of spiking_resnet net = sew_resnet.multi_step_sew_resnet18(T=4, pretrained=True, multi_step_neuron=neuron.MultiStepIFNode, surrogate_function=surrogate.ATan(), detach_reset=True, backend='cupy', cnf='ADD')

  1. I'd like to know are the default parameters are good for sewresnet? as the demo trains spiking resnet, not sure if same parameters work well with sewresnet. Is there anythinkg missing for sewresnet?
  2. I noticed that there is a pretrained argument in both spiking resnet and sewresnet, Does loading a pretrianed dnn resnet really help? I set it to true, but do not see observable benefit, acc still starts from 0 in training. I expect acc degredation, but it shall not be so much. Is that normal?

Thanks!

fangwei123456 commented 1 year ago

The default parameters are shown in codes:

https://github.com/fangwei123456/spikingjelly/blob/1171f5249a4ebeace6ab8d6a74d85579fafb93ed/spikingjelly/clock_driven/model/train_imagenet.py#L14

The hyper-parameters need to be fine-tuned with batch_size, lr and n-gpus. Thus, I can not give the "best" hyper-parameters. In most cases, you can try batch_size=32 and lr=0.1.

Does loading a pretrianed dnn resnet really help?

Yes.