kuangliu / pytorch-cifar

95.47% on CIFAR10 with PyTorch
MIT License
5.98k stars 2.14k forks source link

The biggest issue! #93

Open morawi opened 5 years ago

morawi commented 5 years ago

It is mentioned in the forward function of mobilenet_v2 that "NOTE: change pooling kernel_size 7 -> 4 for CIFAR10". How about other changes to other models?

Does this mean that the models in this repo are vulnerable and may not work well with other problems / datasets?

Thanks in advance!

ZHUANGHP commented 5 years ago

I think there are several minor changes made compared with the original papers (at least ResNet-18). However, these changes should not affect the performance much. It is just not convenient when you need to make fair comparisons with the original papers.

JustinYuu commented 4 years ago

I think the purpose of this change is to let those models be suitable for CIFAR10. Pictures in CIFAR10 has a size of 3232 rather than 256256, so it's not suitable to use the same preprocessing method like other big datasets such as ImageNet, which is to resize pictures to 224224. The author resizes pictures to 3232 via padding=4, which to the greatest extent maintains the original quality of those small-size data. So if data's size is smaller and we want to maintain the number of layers in the net to be same to have the same network complexity and performance, we have to change the kernel size of some layers in every single net, including changing the first conv layer's kernel size 7->4 and the last pooling layer's kernel size 8->4, etc. You could do some calculations on paper and I believe you'll figure it out. If you want to build a 'robust' model which is suitable for all datasets, you could simply resize the image size to 224*224 and use a same kernel size setting for all datasets, but this maybe influence your network's performance