Open jiujing23333 opened 6 years ago
Sorry, I failed to copy the code clearly.
dict = torch.load(vgg16_caffe_path) dict['classifier.0.weight'] = dict['classifier.1.weight'] dict['classifier.0.bias'] = dict['classifier.1.bias'] dict['classifier.3.weight'] = dict['classifier.4.weight'] dict['classifier.3.bias'] = dict['classifier.4.bias'] del dict['classifier.1.weight'] del dict['classifier.1.bias'] del dict['classifier.4.weight'] del dict['classifier.4.bias'] vgg.load_state_dict(dict)
Actually, I did not use the pretrained model provided by jcjohnson. Instead, I use his code to convert the caffe vgg model. I am not sure whether it matters.
I followed the Readme and download pretrained model from this url: https://github.com/jcjohnson/pytorch-vgg, but a problem was reported because of unligned index of weight. I modified the code as follow: ` if pretrained: if caffe:
load the pretrained vgg16 used by the paper's author
Then it could run, but training loss didn't decrease. What's wrong with this process?