Open Snow-Crash opened 2 years ago
@Lyu6PosHao
Dear friend, Having seen your code, I think the main reason why you get low accuracy is that parameter T=4 is too small. As we know, in the converted SNN model, firing rate is used to replace activation value of ReLU. A small T makes IF neurons fire rarely. Therefore, my suggestions are:
Thanks for quick reply! I put my results here for reference, in case anyone also has similar problems.
Below results are returned by val function, each element is the result at a time step. Mode: max, T = 50
[0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. , 0.00403226,
0.03427419, 0.0766129 , 0.12600806, 0.17540323, 0.20262097,
0.23387097, 0.2671371 , 0.29737903, 0.31854839, 0.34274194,
0.36391129, 0.37197581, 0.38810484, 0.41431452, 0.42842742,
0.43850806, 0.45362903, 0.46370968, 0.47883065, 0.49596774,
0.50907258, 0.52318548, 0.53225806, 0.54334677, 0.55141129,
0.5625 , 0.56854839, 0.57358871, 0.58165323, 0.58669355]
Mode: 99%, T = 50
array([0. , 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0.00403226, 0.2953629 ,
0.51008065, 0.55040323, 0.57762097, 0.58366935, 0.58064516,
0.59274194, 0.59475806, 0.58770161, 0.58971774, 0.58770161,
0.58971774, 0.58770161, 0.58971774, 0.58971774, 0.58971774,
0.58770161, 0.58064516, 0.57762097, 0.57560484, 0.57358871,
0.56552419, 0.56451613, 0.56149194, 0.56048387, 0.55141129,
0.55241935, 0.55141129, 0.54939516, 0.54637097, 0.54233871,
0.54435484, 0.54032258, 0.53830645, 0.53830645, 0.53427419,
0.53427419, 0.53024194, 0.52822581, 0.52620968, 0.52520161])
As suggested by @Lyu6PosHao T has to be large enough. This is different from the case of directly training resnet on imagenet, T=4 is sufficient. When mode is max, acc generally increases as T becomes larger. However, when model is 99%, larger T may not help, and acc may becomes lower.
Dear developers,
I trying to use the converter to convert a vgg16 pretrained on imagenet. The original model acc is around 71%, however after after conversion acc is 0.1%. I'd like to know if there's anything wrong with my code? and is such performance expected? I know conversion may not work well on deep models. Is it possible to retrain this model to recover acc? The spikingjelly i'm using is 0.0.0.0.12
Here is the code to reproduce.
Here is model print