dontLoveBugs / DORN_pytorch

PyTorch implementation of Deep Ordinal Regression Network for Monocular Depth Estimation
299 stars 67 forks source link

How to deal with the change of first layer of pretained model? #12

Closed junweifu closed 4 years ago

junweifu commented 5 years ago

In code, the resnet-101 model is considered as pretained model in training. When I load parameters from the official pretrained model, I find there is a error occurring because of a 3x3 kernal in the first conv layer insteading of 7x7. Can you tell me how to deal with this problem, thank you.

XGuider commented 5 years ago

yes,i meet this problem too

junweifu commented 5 years ago

Thanks for the email from @dontLoveBugs . I modify the loading pretrained model code from backbone.py in the folder network. The parameters from conv1,bn1,conv2,bn2,conv3,bn3,layer1.0 should not be loaded. @XGuider

XGuider commented 5 years ago

@junweifu okay,i shall try.thnx!

zenithfang commented 5 years ago

Where do you guys got the pretrained weight for this backbone resnet since its architecuture is different from the original one

dontLoveBugs commented 5 years ago

Hi, I guess the backbone resnet is different from the pretrained model in PyTorch. Maybe, you should pretrain a ResNet whose first layer has three convolutions.

dontLoveBugs commented 5 years ago

I think the pretrained model in pytorch also work. And you need to replace the three convs with the 7X7 conv in PyTorch.

dontLoveBugs commented 5 years ago

Whether a little difference in backbone has a great effect requires experimentation, but I have not verified it yet.

zenithfang commented 5 years ago

Since currently I only have limited computational resources and the result with 7X7 is not that good, could you share or tell me where I can get that pretrained weight for this special resnet? I would appreciate your help.

LCJHust commented 4 years ago

Thanks for the email from @dontLoveBugs . I modify the loading pretrained model code from backbone.py in the folder network. The parameters from conv1,bn1,conv2,bn2,conv3,bn3,layer1.0 should not be loaded. @XGuider

Hi, I meet the same problems with you. Can you share the code block to show how to fix it? Thank you very much!

LCJHust commented 4 years ago

Thanks for the email from @dontLoveBugs . I modify the loading pretrained model code from backbone.py in the folder network. The parameters from conv1,bn1,conv2,bn2,conv3,bn3,layer1.0 should not be loaded. @XGuider

Thank you! I have fix the bugs!

RuHungLee commented 4 years ago

Thanks for the email from @dontLoveBugs . I modify the loading pretrained model code from backbone.py in the folder network. The parameters from conv1,bn1,conv2,bn2,conv3,bn3,layer1.0 should not be loaded. @XGuider

Thank you! I have fix the bugs!

Can everyone show me how to fix it ? i meet the same problem and i have no idea . Thanks!