BloodAxe/pytorch-toolbelt

Have issues with tiling prediction when image.shape is not divisible by tile_size

ternaus opened this issue · 1 comments

image.shape == (5632, 5120, 3)
tile_size=(1280, 1280)
tile_step=(1280, 1280)

After the split, predict, merge I got a mask with a shape

(6400, 5120)

Hi,

Thanks for the report. Indeed, it's all good with merger. However there is one trick, that is not very well documented - when using CudaTileMerger, output image may be larger than original image, and that's fine. Here is a newly added unit test that demonstrate proper way to use it:

https://github.com/BloodAxe/pytorch-toolbelt/blob/develop/tests/test_tiles.py#L28

It maybe be good to refactor API to make it less error-prone.