ofsoundof/learning_filter_basis

confusion about load pretrained model

chaow94 opened this issue · 1 comments

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.

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.