ClementPinard / SfmLearner-Pytorch

Pytorch version of SfmLearner from Tinghui Zhou et al.
MIT License
1.01k stars 224 forks source link

Fix run_inference.py resizing #113

Closed evanmays closed 3 years ago

evanmays commented 3 years ago

PIL image resize expects (width, height) not (height, width)

https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.resize

ClementPinard commented 3 years ago

Indeed, thanks for the catch ! Was using scipy resize before which used (height, width)

Actually, to reflect the older use a bit more, I would prefer to use scikit image, which under the hood uses PIL but at least keeps the API in the space of tensors only.

https://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.resize

Opinions on it ? Tha would require add scikit image in the requirements and also maybe change the imports in test_disp.py (https://github.com/ClementPinard/SfmLearner-Pytorch/blob/master/test_disp.py#L3)

We can work on it in this very PR or merge this one and start a new one.

evanmays commented 3 years ago

Not having to convert between tensors and Images would definitely be better. Optimally all resizes would use scikit or even torchvision resize transformation.

Unfortunately, I don't have access to the compute resources anymore to battle test more changes