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

confusion about load pretrained model #1

Open
chaow94 opened this issue Jan 13, 2020 · 1 comment
Open

confusion about load pretrained model #1

chaow94 opened this issue Jan 13, 2020 · 1 comment

Comments

@chaow94
Copy link

chaow94 commented Jan 13, 2020

Hello Yawei Li, appreciate your excellent work very much. I have some questions about the code.

What is the role of the pre-training model?

for example, code is token from here

        for i, v in enumerate(configs[args.vgg_type]):
            if v == 'M':
                body_list.append(nn.MaxPool2d(kernel_size=2, stride=2))
            else:
                t = 3 if args.vgg_decom_type == 'all' else 8
                if i <= t:  #
                    body_list.append(common.BasicBlock(in_channels, v, args.kernel_size, bias=bias,
                                                       conv3x3=conv3x3, norm=norm))
                else:
                    body_list.append(BasicBlock(in_channels, v, n_basis, basis_size, args.kernel_size, bias=bias,
                                                conv=conv3x3, norm=norm))
                in_channels = v

......

self.load_state_dict(state, False)

Model's first 3layes or 8 layers will init from pretrained model. However, from the paper, the new weights are composed of pre-trained models, but here are trained from scratch, plz correct me if I am wrong.

Thanks a lot.

@ofsoundof
Copy link
Owner

Hi,
Thanks a lot for the question. Actually, if you don't set the args.pretrained option, it will be initialized as an empty string. In this case, the weights of the network are randomly initialized instead of being loaded from the pretrained model.

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

No branches or pull requests

2 participants