PortraitNet icon indicating copy to clipboard operation
PortraitNet copied to clipboard

model's dimension doesn't match checkpoint's dimension?

Open chithize opened this issue 4 years ago • 0 comments

HI,参照myTest目录下的video测试demo脚本, 下载页面提供的模型链接文件 将 154行 :File = os.path.join(exp_args.model_root, 'model_best.pth.tar') 改成 bestModelFile = os.path.join(exp_args.model_root, 'mobilenetv2_total_with_prior_channel.tar') 运行后产生如下错误

videotest.py:101: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. cf = load(cont) finish load config file ... Traceback (most recent call last): File "videotest.py", line 158, in netmodel_video.load_state_dict(checkpoint_video['state_dict']) File "/home/hcruise/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 487, in load_state_dict .format(name, own_state[name].size(), param.size())) RuntimeError: While copying the parameter named stage0.0.weight, whose dimensions in the model are torch.Size([32, 4, 3, 3]) and whose dimensions in the checkpoint are torch.Size([32, 3, 3, 3]).

这是什么情况,我是安装主页上说的安装的pytorch 0.3.0post4, 及torchvision 0.2.0 为什么load模型后又说自己的模型dimension不对呢?

chithize avatar Apr 09 '20 13:04 chithize