Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong tiles coordinate with Python 3 #12

Open
AurelienGauffre opened this issue Mar 8, 2022 · 0 comments
Open

Wrong tiles coordinate with Python 3 #12

AurelienGauffre opened this issue Mar 8, 2022 · 0 comments

Comments

@AurelienGauffre
Copy link

AurelienGauffre commented Mar 8, 2022

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 :

for n in range(9):
i = n / 3
j = n % 3
c = [a * i * 2 + a, a * j * 2 + a]

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 :
image
9 tiles :
image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant