Git Product home page Git Product logo

snn_conversion_qcfs's People

Contributors

putshua avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

snn_conversion_qcfs's Issues

Not able to reproduce the result with the same settings in the paper

Hi, with the same settings (all the hyperparameters) I still can't reproduce the result as reported in the paper.
In the exp on VGG on CIFAR10, when I set the l=4, the best acc of ann can't reach the result in the paper (0.938, 0.955 in the paper), and when I set l=32, the acc of snn at T=4 is 0.879 (0.939 in the paper).
And i'd like to know whether you add the autoAugment to the CIFAR100.

Thank you for providing the code, expecting for your reply, thank you in advance!

Input data coding and QCFS derivative

Hello Sir, Hope you are alright
I am just wondering about your code and results that is shown in your paper,
Q1: Do you use encoding mechanism to convert the input images into spikes during SNN evaluation, or you just apply the original images to the first layer T times ?

Q2: In your paper (equation 17 ), you mentioned the derivative functions for training your QCFS, but I cannot find that in your code, and you apply the autograde, am I right ? if yes, is your mentioned results based on equation 17 or using the autograde derivations ?

waiting for your reply,
Thank you !

line inversion in qcfs function activation

Hello,

I believe there is a line inversion occuring in file modules.py at lines 69 and 70:

class MyFloor(nn.Module):
    ...
    def forward(self, x):
        x = x / self.up
        x = torch.clamp(x, 0, 1) # line 69, should be line 70
        x = myfloor(x*self.t+0.5)/self.t # line 70, should be line 69
        x = x * self.up
        return x

Per the paper, clipping is done after the floor operation.

some questions about training QCFS

Hi, I'm training an ann model with QCFS. Resnet20 on CIFAR10.
I program my own QCFS class,whose parameters are v_threshold and T (L in your paper).
Its forward function is:
y = floor_ste(x * T / v_threshold + 0.5)
y = torch.clamp(y, 0, T) * v_threshold / T
return y
However, I found two layers' v_threshold were updated to be negative while training.
The initial value is:T=8 v_threshold=1.0, which means initial quantization step is 1/8.
I wonder what the reason is. Have you met such situations?
What initial values would you recommend?
Many thanks!

Not able to reproduce the same conversion error as reported in the paper.

Hi, I tried to reproduce the experiments on CIFAR10 with VGG16.
I used the following python commands to train the models:

CUDA_VISIBLE_DEVICES=[gpu id] nohup python main.py train --bs=128 --model=vgg16 --data=cifar10 --id=vgg16_cifar10_bs128_e150_l[x] --l[x] --lr=0.1 > testvgg_cifar10_lx.log 2>&1 &

where [x] is set 2,4,8,16,32,and 64 for six runs. I tested the converted SNNs with following python commands:

CUDA_VISIBLE_DEVICES=[gpu id] python main.py test --bs=128 --model=vgg16 --data=cifar10 --mode=snn --id=vgg16_cifar10_bs128_e150_l[x] --t=[x] --l=[x]

and the results are:

t == l ann snn
2 88.17 85.66
4 90.74 86.15
8 92.94 90.46
16 94.47 93.50
32 94.85 94.65
64 94.98 94.93

For SNNs, I report the last value of the printed Accuracy tensor. For example,

CUDA_VISIBLE_DEVICES=1 python main.py test --bs=128 --model=vgg16 --data=cifar10 --mode=snn --id=vgg16_cifar10_bs128_e150_l2 --t=2 --l=2
Files already downloaded and verified
Files already downloaded and verified
100%|█████████████████████████████████████████████████████████████████████████████████████████| 79/79 [00:07<00:00,  9.95it/s]
Accuracy:  tensor([0.8300, 0.8566], device='cuda:0')

I report the 0.8566 of the Accuracy: tensor([0.8300, 0.8566], device='cuda:0')

The results are acceptable but not as remarkable as what is reported in your paper. For example, there is only ~0.1% conversion loss if t==16, and SNN performs even better than Ann if t==32 in your paper. So I wonder how to perfectly reproduce your paper's conversion errors. Did I misunderstand your paper or improperly use the codes? Please help.

Threshold

You have mentioned dynamic threshold in the paper, but I don't find it in the code. Is your threshold set to 1 by default?

Slides for your work

Hiya,

I am just listening to your Intel talk - great stuff! Any chance you could share the slides with the ([email protected]).

By the way, it would be great to add some Readme on how to use your code.

test --mode snn

I am not able to perform the conversion. When I pass the argument "test" to main.py, I find always the same error related to folder "./saved_models/' + args.id + '.pth'":
FileNotFoundError: [Errno 2] No such file or directory: './saved_models/None.pth'

This happens both in case I pass an ID argument, and not.

Thanks!

How do you set L of QCFS to find ANN accuracy ?

Hope you are doing well Sir,
I have a question please, hope you could help me with it.

For example in "Table 2: Comparison between the proposed method and previous works on CIFAR-10 dataset"
In VGG16 : ANN acc = 95.52%, What is "L" value in QCFS to get this accuracy ? How do you select "L" value?
and when you test converted SNN model with T= (2,4,8,16,...) and get accuracy of (91.18, 93.96, 94.95, 95.40,... ), do you set their ANN counterparts based on L=T, then train, convert and simulate? or same ANN model with your optimal "L" value is simulated with different simulation time T in SNN?

Waiting for your response, thank you

非常具有进步性的工作!

我有个小问题,为了方便说明,沿用原论文里的符号含义。

通过shift操作使得QCFS函数 和 IF神经元输出输出相应关系函数(输入为z,输出为\phi)的 quantization error 的误差的期望值恒 为 0。
这样即使L 和 T不同,理论上也解释的通,并且实验Table S2也证明了L和T不同是可行的,并且最优的转换效果 并不经常出现在L=T的情况下。

但也正是存在这样的现象,我想问的是,当L=T的时候,QCFS函数和IF 神经元响应函数 应该是完全重合的、一样的,理论上完全解决了 quantization error (甚至不用通过计算什么误差的期望来证明)。按道理,所有的最优转换情况都应该出现在L=T的时候。但是从Table S2的结果来看并不是这样。这是为什么呢? 是否是因为存在unevenness error这样的不确定误差导致的呢?

非常想听一下大佬的看法 ^_^

Conversion Error Analysis

You mentioned Quantization error and Unevenness error of the third chapter in your paper, but I want to know how to understand this sentence ''the unevenness error will degenerate to the quantization error if v^l(T) is in the range of [0, θ^l]''

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.