lyh983012 / ES-imagenet-master

code for generating data set ES-ImageNet with corresponding training code
http://lyh983012.github.io/
29 stars 2 forks source link

Cannot find weights for 2D CNN and 3D CNN #3

Open tarunpulluri opened 1 year ago

tarunpulluri commented 1 year ago

Hi, could you kindly please guide me with locations for weight files for 2D CNN and 3D CNN?

lyh983012 commented 1 year ago

Sorry, I can't find the weight of 3DCNN. You can modify the python scripts in ./example to reproduce this experiment. 2DCNN is trained based on the reconstructed ESimageNet, which needs to accumulate the positive events of 8 event frames and subtract the accumulation of negative events. I uploaded its weight to the pretrained_model. However, due to the version update, the key in the weight file may have some errors (I'm not sure), so you may need to check it.

tarunpulluri commented 1 year ago

Yes, there is key mismatch issue.

Can you also include weights for LIF-ResNet_18 and LIF-ResNet_34?

lyh983012 commented 1 year ago

you can try this script for loading CNN2D:

##################### Step3. establish module #####################
modules = import_module('LIAFnet.LIAFResNet_18')
config  = modules.Config()
config.cfgCnn = [1,64]
cnn = LIAFResNet(config)
print("Total number of paramerters in networks is {}  ".format(sum(x.numel() for x in snn.parameters())))
cnn = LIAFResNet(config)
cnn.to(device)
pretrain_path = '../pretrained_model/ResNet18_2D_gray_acc43.pkl'
checkpoint = torch.load(pretrain_path, map_location=torch.device('cpu'))
cnn.load_state_dict(checkpoint)

For convenience, I may use LIAFResNet18 with time window=1 and ReLU activation to get this 2DCNN model. They are completely equivalent.

LIF-ResNet_18 is in the ./pretrained_model, I didn't successfully train a high-performance LIF-ResNet34. The deep LIF network has many bad properties. Some solutions can refer to the following papers

[1] Fang, Wei, et al. "Deep residual learning in spiking neural networks." Advances in Neural Information Processing Systems 34 (2021): 21056-21069. [2] Zheng, Hanle, et al. "Going deeper with directly-trained larger spiking neural networks." Proceedings of the AAAI Conference on Artificial Intelligence. Vol. 35. No. 12. 2021.

ppx-hub commented 1 year ago

Thank you for providing the pre-trained weights, I have tried the script you provided, why is the 2D-CNN accuracy on the reconstructed ES-imagenet only 0.08xx, the same as test_acc_2dcnn.ipynb? Shouldn't it be a percentage, like 50.xx in README.md?

lyh983012 commented 1 year ago

Maybe there are still some bugs in your data processing OR BUGS IN THE PRE-CONVERTED DATASET (40GB version). I've checked this weight file and It should obtain more than 40% accuracy. I recommend you to use the original version for a test, or you can share your data pre-process script and the data samples for debuging.

image

ppx-hub commented 1 year ago

Maybe there are still some bugs in your data processing OR BUGS IN THE PRE-CONVERTED DATASET (40GB version). I've checked this weight file and It should obtain more than 40% accuracy. I recommend you to use the original version for a test, or you can share your data pre-process script and the data samples for debuging.

image

I have rechecked and using the original version of the dataset and this weight file, it is achievable with 40% accuracy, thanks for your reply.