Hello,
I’ve been trying to use the ResNet50 model from the author site, and downloaded the model/weights. My main use of this is to pass in a batch of images and extract a feature map. I was able to do this successfully with the original pytorch implementation, however, when I do the same setup, I’m thrown an error because of the batch and because of the dimensions. I tried tracing back to see if I could adjust, but I’m unable to find anywhere to work on this. Any ideas? I’m initially using images of shape [B,C,H,W]=[8,3,256,256]. I know ResNet is supposed to be 224x224 but 256 was working, and needed for the size feature map I’m requiring.
It seems like part of the issue might be handling batches itself?
Here is the error:
Traceback (most recent call last):
  File "C:/Users/a-pollack/Projects/de_ident/de_ident.py", line 27, in <module>
    gen_losses, dis_losses, gen, dis = train_net(num_epochs=5, batch_size=8, lr=1e-4, betas=(0.5, 0.99))
  File "C:\Users\a-pollack\Projects\de_ident\train.py", line 122, in train_net
    z_raw, m, z_masked = gen(data[0])
  File "C:\Users\a-pollack\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "C:\Users\a-pollack\Projects\de_ident\generator.py", line 75, in forward
    face_descriptor = fd_conv2(x)
  File "C:\Users\a-pollack\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "C:\Users\a-pollack\Projects\de_ident\generator_utils.py", line 54, in forward
    x = self.features(x)
  File "C:\Users\a-pollack\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "C:\Users\a-pollack\Anaconda3\lib\site-packages\torch\nn\modules\container.py", line 92, in forward
    input = module(input)
  File "C:\Users\a-pollack\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "C:\Users\a-pollack\Anaconda3\lib\site-packages\torch\nn\modules\conv.py", line 345, in forward
    return self.conv2d_forward(input, self.weight)
  File "C:\Users\a-pollack\Anaconda3\lib\site-packages\torch\nn\modules\conv.py", line 342, in conv2d_forward
    self.padding, self.dilation, self.groups)
RuntimeError: Given groups=1, weight of size 256 64 1 1, expected input[8, 256, 64, 64] to have 64 channels, but got 256 channels instead