Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tarunpulluri opened this issue Oct 4, 2022 · 6 comments
Open

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

tarunpulluri opened this issue Oct 4, 2022 · 6 comments

Comments

@tarunpulluri
Copy link

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

@lyh983012
Copy link
Owner

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
Copy link
Author

Yes, there is key mismatch issue.

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

@lyh983012
Copy link
Owner

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
Copy link

ppx-hub commented Oct 30, 2022

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
Copy link
Owner

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
Copy link

ppx-hub commented Nov 2, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants