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

fix depth of resnet/preresnet on cifar10/cifar100 #9

Merged
merged 1 commit into from
Jan 23, 2019

Conversation

luzai
Copy link
Contributor

@luzai luzai commented Jan 31, 2018

Hi~ thanks for your nice code!
I made some modification, according to the discussion in #6 and #8:

  • The default building block for resnet on cifar10/cifar100 is BasicBlock
  • Depth=6n+2 when using basicblock and Depth=9n+2 when using bottleneck
  • Add an command line option to choose building block.

And I do some experiments using resnet and cifar10. The training receipts and results are:

python cifar.py -a resnet --depth 164 --block-name Bottleneck --epochs 164 --schedule 81 122 --gamma 0.1 --wd 1e-4 --checkpoint checkpoints/cifar10/resnet-164-bottleneck 

python cifar.py -a resnet --depth 110 --block-name BasicBlock --epochs 164 --schedule 81 122 --gamma 0.1 --wd 1e-4 --checkpoint checkpoints/cifar10/resnet-110-basicblock

python cifar.py -a resnet --depth 110 --block-name Bottleneck --epochs 164 --schedule 81 122 --gamma 0.1 --wd 1e-4 --checkpoint checkpoints/cifar10/resnet-110-bottleneck 
block name depth params(M) best top-1 error(%)
Bottleneck 164 1.70 6.26
Bottleneck 110 1.14 6.71
BasicBlock 110 1.73 6.60

@BIGBALLON
Copy link

BIGBALLON commented Jun 22, 2018

hello, @bearpaw ,
I think this merge pull request is important since the preresnet-110 in original code is not 110 layers, so the results is wrong. hope to fixed the bug and update readme.md , please!

@bearpaw bearpaw merged commit 24f1c45 into bearpaw:master Jan 23, 2019
geoffreyangus pushed a commit to geoffreyangus/pytorch-classification that referenced this pull request Dec 2, 2019
fix depth of resnet/preresnet on cifar10/cifar100
@mountains-high
Copy link

@luzai , thank you for your update about depth. I am getting an assertion error when I wanted to use resnet34.
Could you help me to solve this issue, please?
Thank you

@luzai
Copy link
Contributor Author

luzai commented Jun 12, 2022

Hi mountains-high, I guess the assert error comes from 6n+2. It means if n=5, then the number of layers is 32.

@luzai , thank you for your update about depth. I am getting an assertion error when I wanted to use resnet34. Could you help me to solve this issue, please? Thank you

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

Successfully merging this pull request may close these issues.

None yet

4 participants