RobotLocomotion / pytorch-dense-correspondence

Code for "Dense Object Nets: Learning Dense Visual Object Descriptors By and For Robotic Manipulation"
https://arxiv.org/pdf/1806.08756.pdf
Other
559 stars 133 forks source link

invalid tensor shape #193

Closed Ademord closed 5 years ago

Ademord commented 5 years ago

Hello! How could the correct shape (the additional [1,1]) be fixed?

image
priyasundaresan commented 5 years ago

Having the same issue,^ did you manage to resolve it?

priyasundaresan commented 5 years ago

Resolved. In code/pytorch-segmentation-detection/vision/torchvision/models/resnet.py, make sure that line 153 is changed to: self.fc = nn.Linear(512 block.expansion, num_classes) instead of: self.fc = nn.Conv2d(512 block.expansion, num_classes, (1, 1))

If you do: print(self.fc.weight.size()), you'll see the torch.Size is now (1000, 512)

kingsman142 commented 5 years ago

@priyasundaresan I was just having this problem. Your solution worked perfectly!

manuelli commented 5 years ago

Thanks for the solution @priyasundaresan. I will look into this and PR a fix.

manuelli commented 5 years ago

I have just tested the full tutorial against the branch in PR #196 and everything seems to be working fine. Note that the new PR requires nvidia-docker2 instead of just nvidia-docker so you may need to re-install that if you are on an older version of nvidia-docker.

priyasundaresan commented 5 years ago

Thanks for your quick response and help @manuelli!