hellochick / PSPNet-tensorflow

TensorFlow-based implementation of "Pyramid Scene Parsing Network".
326 stars 123 forks source link

Test on image of different size #3

Closed xmba15 closed 7 years ago

xmba15 commented 7 years ago

I resized images of cityscape dataset to 256x512 and I tried inference.py on them with the following command

python inference.py --img-path=./input/test.png

but it kept raising:

tensorflow.python.framework.errors_impl.InvalidArgumentError: input image must be of non-zero size
         [[Node: conv5_3_pool1_interp = ResizeBilinear[T=DT_FLOAT, align_corners=true, _device="/job:localhost/replica:0/task:0/cpu:0"](conv5_3_pool1_conv_bn/Relu, conv5_3_pool1_interp/size)]]

Can you please tell me how to run the inference code with images of different size?

hellochick commented 7 years ago

Hey @bajsk , Im sorry for that I didn't handle different size well. You can pad the image into 713x713 (since the kernel size & stride are designed to this resolution in original work), and it can work well ! I will fix to support different input size soon.

xmba15 commented 7 years ago

Thanks for the quick reply. Do you mean the inference.py will work with an image of size 713x713? I have just tried it now but it seems not working?

tensorflow.python.framework.errors_impl.InvalidArgumentError: padded_shape[0]=98 is not divisible by block_shape[0]=4
hellochick commented 7 years ago

@bajsk , I have fixed this problem, you can update this repo and try your resizied image! Since padding method is different, so it can work with 720x720. I have fixed the code to support every different size by padding/cropping the input image.

xmba15 commented 7 years ago

@hellochick Thanks. Work like a charm now.