dlam4h / OCD-PyTorch

The code for paper 《Object Contour Detection with a Fully Convolutional Encoder-Decoder Network》
19 stars 4 forks source link

Error in prediction for Code 2 (U-net) #3

Open harshitsankhla opened 4 years ago

harshitsankhla commented 4 years ago

Getting this error while trying to evaluate on a RGB image using predict.py for code 2 -

Traceback (most recent call last): File "predict.py", line 36, in outputs = model(img) File "/home/baburao/miniconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/home/baburao/contour/OCD-PyTorch/c2/model.py", line 124, in forward x = torch.cat((x, x_copy7_8), 1) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 41 and 40 in dimension 3 at /opt/conda/conda-bld/pytorch_1579040055865/work/aten/src/THC/generic/THCTensorMath.cu:71

Also getting completely black images with code 1.

dlam4h commented 4 years ago

Getting this error while trying to evaluate on a RGB image using predict.py for code 2 -

Traceback (most recent call last): File "predict.py", line 36, in outputs = model(img) File "/home/baburao/miniconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/home/baburao/contour/OCD-PyTorch/c2/model.py", line 124, in forward x = torch.cat((x, x_copy7_8), 1) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 41 and 40 in dimension 3 at /opt/conda/conda-bld/pytorch_1579040055865/work/aten/src/THC/generic/THCTensorMath.cu:71

Also getting completely black images with code 1.

@harshitsankhla Is the image size a multiple of 16?

dlam4h commented 4 years ago

@harshitsankhla Sometimes code 1 will get black images. I suggest you use code2. You can also make some improvements on code2. For example, attention mechanism.

harshitsankhla commented 4 years ago

Getting this error while trying to evaluate on a RGB image using predict.py for code 2 - Traceback (most recent call last): File "predict.py", line 36, in outputs = model(img) File "/home/baburao/miniconda3/envs/planercnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/home/baburao/contour/OCD-PyTorch/c2/model.py", line 124, in forward x = torch.cat((x, x_copy7_8), 1) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 41 and 40 in dimension 3 at /opt/conda/conda-bld/pytorch_1579040055865/work/aten/src/THC/generic/THCTensorMath.cu:71 Also getting completely black images with code 1.

@harshitsankhla Is the image size a multiple of 16?

Its giving this error even on the images that I used to train the network with. Should they also be of size multiple of 16 ?

dlam4h commented 4 years ago

@harshitsankhla Yes. Because this model contains 4 downsampling.