spikingjelly
spikingjelly copied to clipboard
Bad performance on a convertet ResNet50 on Flower102
After fine-tuning a regular RESNET50 on the Flower102 dataset using the following architecture for the classifier:
from torchvision.models import resnet50
resnet = resnet50(weights='ResNet50_Weights.IMAGENET1K_V1')
resnet.fc = nn.Sequential(
nn.Linear(2048, 512),
nn.ReLU(inplace=True),
nn.Dropout(0.5),
nn.Linear(512, 256),
nn.ReLU(inplace=True),
nn.Dropout(0.5),
nn.Linear(256, 102)
)
this net achieve an accuracy on the test set >90%
after converting using:
model_converter = ann2snn.Converter(mode='max', dataloader = train_dataload_flowers)
converted_model = model_converter(full_resnet)
the performance on the test set drop to an accuracy <10%. I tried to change the conversion mode using: max, 99.99% and 1/3 without obtaining significant improvements.
Issue type
- [ ] Bug Report
- [ ] Feature Request
- [x] Help wanted
- [x] Other
@DingJianhao @Lyu6PosHao
Hi. How many time steps do you use when inferring on test set? Given that resnet50 is a relatively deep network, T (the number of time steps) needs to be large enough, and max mode is not recommended.
I tried T = 10, 20, 50 and 100. What kind of mode may improve the performances ?
T=100 is not enough, especially for such a deep network. You could try 99.99% (or 1/2, 1/3, etc.) mode and T=512, and check if the accuracy increases. In fact, as for converting of deep networks, it is very difficult to achieve good performance and low latency at the same time unless advanced and complex methods are used, which have not been implemented in SpingJelly currently. And as far as I know, even in the latest research, there are few conversion experiments on resnet50, and most experiments are conducted on resnet18/20/34. So make T larger and give up max mode. If it doesn't help, please refer to the latest relevant papers or wait for the upgrade of ann2snn in SpikingJelly. Good luck.
same question to me, the peformance is less than 1% with T=50