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

Regarding the code in liif.py #34

Open
Swaraj-72 opened this issue Jul 13, 2021 · 3 comments
Open

Regarding the code in liif.py #34

Swaraj-72 opened this issue Jul 13, 2021 · 3 comments

Comments

@Swaraj-72
Copy link

Swaraj-72 commented Jul 13, 2021

Hi, I have found it difficult to understand the purpose of rx, ry in the code below. Kindly let me know the same. Also why should we perform the flip operation (coord_.flip(-1)) on the "coord_" variable when we have received the actual coordinates.Thank you.
Issue

@Surayuth
Copy link

Surayuth commented Nov 3, 2021

The coordinates of all centers are a constraint, by default, within [-1, 1]. This means the length of the side of each grid is [1 - (-1)]/N = 2/N where N is the number of grids in each direction. Thus, the shortest distance between the center of each grid to its border (radius, r) = (2/N)/2 = 2 / N / 2

@codeslake
Copy link

I believe flip is required for properly indexing x and y coordinates.
The documentation for grid_sample() states that,

...the size-2 vector grid[n, h, w] specifies input pixel locations x and y... .

As the coord variable is basically a meshgride in (y, x) coordinate format (here), flip is required.

@axhiao
Copy link

axhiao commented Sep 7, 2022

For later readers, note that in grid_sample(), the x-axis is along the width of an image and the y-axis is along its height.

I believe flip is required for properly indexing x and y coordinates. The documentation for grid_sample() states that,

...the size-2 vector grid[n, h, w] specifies input pixel locations x and y... .

As the coord variable is basically a meshgride in (y, x) coordinate format (here), flip is required.

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

4 participants