efficientnet-yolo3-pytorch icon indicating copy to clipboard operation
efficientnet-yolo3-pytorch copied to clipboard

使用其他下载软件下载预训练权重后加载失败问题

Open Alioth5670 opened this issue 5 years ago • 11 comments

pretrained_dict = {k: v for k, v in pretrained_dict.items() if np.shape(model_dict[k]) == np.shape(v)} 使用这一语句会报错 KeyError: '_conv_stem.weight' 检查发现在主干网络部分 model_dict 的键为 ’backbone.model._conv_stem.weight‘ 而非 '_conv_stem.weight'

Alioth5670 avatar Apr 27 '21 14:04 Alioth5670

你主干和model_path不对应吗?

bubbliiiing avatar May 01 '21 04:05 bubbliiiing

嗯嗯,在我这里跑的时候前面都会有一个“backbone.model.”,这个在下载的模型里是没有的。 不过,项目里efficientne-tb2-voc.pth这个权重是可以直接加载的

Alioth5670 avatar May 03 '21 05:05 Alioth5670

噢。我知道了,你把pretrain=true就行了

bubbliiiing avatar May 07 '21 06:05 bubbliiiing

想请教下 pretrain在哪改呀

Mr-Bigworth avatar May 15 '21 13:05 Mr-Bigworth

我也有这个问题

Mr-Bigworth avatar May 15 '21 13:05 Mr-Bigworth

在 train.py 里 model = YoloBody(Config, phi=phi, load_weights=False) 把load_weights 改成True 然后注释掉下面的权重加载那一块就可以了

Alioth5670 avatar May 18 '21 03:05 Alioth5670

嗯是

bubbliiiing avatar May 21 '21 14:05 bubbliiiing

我去试试

Mr-Bigworth avatar May 21 '21 14:05 Mr-Bigworth

就是有个问题 那个下载链接下载权重很慢 我自己下载了那个权重 然后自己加载可以么

Mr-Bigworth avatar May 21 '21 14:05 Mr-Bigworth

可以用迅雷下载,然后放到特定文件夹,C里面

bubbliiiing avatar May 21 '21 14:05 bubbliiiing

我已经下好了 我试试

Mr-Bigworth avatar May 21 '21 14:05 Mr-Bigworth