When I tried to extract deep features using trained inception_v3 model
model = torchvision.models.inception_v3(pretrained=True)
model.fc = nn.Linear(2048, 1)
model.load_state_dict(torch.load(’./models/Beauty_inception_reg.pt’))
feature_extractor = torch.nn.Sequential(*list(model.children())[:-1])
I got the following error :
File “c:\users\fares\appdata\local\programs\python\python37\lib\site-packages\torch\nn\modules\conv.py”, line 345, in forward
return self.conv2d_forward(input, self.weight)
File “c:\users\fares\appdata\local\programs\python\python37\lib\site-packages\torch\nn\modules\conv.py”, line 342, in conv2d_forward
self.padding, self.dilation, self.groups)
RuntimeError: Expected 4-dimensional input for 4-dimensional weight 192 768 1 1, but got 2-dimensional input of size [1, 1000] instead
any Ideas what is causing that error ??