JigsawPuzzlePytorch
JigsawPuzzlePytorch copied to clipboard
Wrong tiles coordinate with Python 3
Hi,
Thank you for your implementation. I thought people might be interested in using this code with Python 3 and the whole code seems to be compatible with it, except in the following place where a division creates a small issue that might not be easy to detect :
https://github.com/bbrattoli/JigsawPuzzlePytorch/blob/ec85994b9f244d08652a3975c1c7a55483cdfc05/Dataset/JigsawImageLoader.py#L46-L49
In Python 2 a simple /
work as a floor division, which is not the case in Python 3 where you have to use //
instead.
Thus, by using Python 3, the coordinates of the center c
for cropping are wrong and this gives this kind of tiles, without raising any errors :
Original image :
9 tiles :
Tiles 8 and 9 are missing pixels (which comes from the facts that 7/3>2 and 8/3>2 hence the need to use a floor division) which will make this self-supervised task easier and won't be useful to learn interesting features for the neural network.
Using a floor division with //
is also compatible with Python 2, so I think it could be useful to add this change to the current version to improve compatibility and prevent potential misuse of the codes by users with Python 3.