cvlab-epfl / disk

Disk code release
Apache License 2.0
317 stars 46 forks source link

RuntimeError: downsample feature map of size torch.Size([1, 64, 135, 240]) #5

Closed wolf943134497 closed 3 years ago

wolf943134497 commented 3 years ago

Hi @ducha-aiki @jatentaki Thanks for your great works! I met some errors: Traceback (most recent call last): File "detect.py", line 249, in described_samples = extract(dataset, args.h5_path) File "detect.py", line 201, in extract batched_features = extract(bitmaps) File "/home/anaconda3/envs/pytorch1/lib/python3.6/site-packages/torch_dimcheck/dimcheck.py", line 110, in wrapped result = func(*args, kwargs) File "/home/disk/disk/model/disk.py", line 57, in features descriptors, heatmaps = self._split(self.unet(images)) File "/home/anaconda3/envs/pytorch1/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, *kwargs) File "/home/anaconda3/envs/pytorch1/lib/python3.6/site-packages/torch_dimcheck/dimcheck.py", line 110, in wrapped result = func(args, kwargs) File "/home/anaconda3/envs/pytorch1/lib/python3.6/site-packages/unets/unet.py", line 100, in forward features.append(layer(features[-1])) File "/home/anaconda3/envs/pytorch1/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, *kwargs) File "/home/anaconda3/envs/pytorch1/lib/python3.6/site-packages/torch/nn/modules/container.py", line 92, in forward input = module(input) File "/home/anaconda3/envs/pytorch1/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(input, **kwargs) File "/home/anaconda3/envs/pytorch1/lib/python3.6/site-packages/unets/ops.py", line 42, in forward raise RuntimeError(msg) RuntimeError: Trying to downsample feature map of size torch.Size([1, 64, 135, 240])

which version of pytorch? any suggestions? Thanks!

ducha-aiki commented 3 years ago

I am not the author, please don't assign to me a credit for creating DISK.

Regarding your question --- set resize values to be power of 2, e.g. 1024x768. Altough I would also prefer to hear about more robust solution from @jatentaki

jatentaki commented 3 years ago

Haha, @ducha-aiki is not a maintainer but apparently responds even faster than I do.

More precisely, it has to be not only power of 2, but multiples of 16 (since we have 4 downsampling steps, each reducing the resolution by 2 --> 2^4 = 16). In practice, please set the --height and --width flags to a size which is closest to your input size and divisible by 16 (don't worry if it doesn't exactly preserve the aspect ratio, it will internally maintain it with padding).

jatentaki commented 3 years ago

I added more informative exception messages around this issue. @wolf943134497 is the problem resolved?

wolf943134497 commented 3 years ago

@jatentaki the problem is solved! Thanks for your suggestions and great works! Sorry to disturb you, ducha-aiki. Thanks for your help!