DFL-CNN icon indicating copy to clipboard operation
DFL-CNN copied to clipboard

TypeError: __init__() got an unexpected keyword argument 'pretrained'

Open fxle opened this issue 6 years ago • 2 comments

DFL-CNN <==> Part1 : prepare for parameters <==> Begin DFL-CNN <==> Part1 : prepare for parameters <==> Done DFL-CNN <==> Part2 : Load Network <==> Begin Traceback (most recent call last): File "main.py", line 180, in main() File "main.py", line 91, in main model = DFL_VGG16(k = 10, nclass = 200)
File "/home/steven/Documents/test/DFL-CNN/model/DFL.py", line 13, in init vgg16featuremap = torchvision.models.vgg16_bn(pretrained=True).features File "/usr/local/lib/python3.5/dist-packages/torchvision/models/vgg.py", line 130, in vgg16_bn return VGG(make_layers(cfg['D'], batch_norm=True), **kwargs) TypeError: init() got an unexpected keyword argument 'pretrained'

Hello dejia when I reappearance your code this error happened ,Where is the problem?

fxle avatar Nov 13 '18 07:11 fxle

Maybe the version of torchvision should be updated.

WangJiuniu avatar Dec 03 '18 03:12 WangJiuniu

https://forums.fast.ai/t/forward-got-an-unexpected-keyword-argument-pretrained/80582

Try this, it worked for me.

import fastai model = fastai.vision.model.YOURMODELHERE

Quinniboi10 avatar Jan 22 '23 15:01 Quinniboi10