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 calculation of EPE #284

Open
sueskind opened this issue Aug 29, 2023 · 1 comment
Open

Wrong calculation of EPE #284

sueskind opened this issue Aug 29, 2023 · 1 comment

Comments

@sueskind
Copy link

Usually the (average) end-point error (EPE) is defined as such:

$$EPE = \frac{1}{n} \sum_{i,j}\lVert v(i,j) - g(i,j) \rVert$$

where

  • $v(i,j)$ is the predicted optical flow at image pixel $(i,j)$,
  • $g(i,j)$ the target (ground truth) optical flow and
  • $n$ the total number of pixels.

Notice that the flows are 2-dimensional as they have an entry $v_x,g_x$ for $x$ and $v_y,g_y$ for $y$ disposition. Therefore, the norm here is the square root of the sum of two squares:

$$EPE = \frac{1}{n} \sum_{i,j} \sqrt{ \left( v_x(i,j) - g_x(i,j) \right)^2 + \left( v_y(i,j) - g_y(i,j) \right)^2 }$$

In losses.py however, the EPE is calculated wrongly as the MSE:

$$MSE = \frac{1}{n} \sum_{i,j,k} \left( v_k(i,j) -g_k(i,j) \right)^2 = \frac{1}{n} \sum_{i,j} \left( v_x(i,j) -g_x(i,j) \right)^2 + \left( v_y(i,j) -g_y(i,j) \right)^2$$

Although they look very similar, the actual EPE involves a square root which is missing in the MSE.

@sueskind
Copy link
Author

sueskind commented Aug 30, 2023

Well I got a bit confused there... Depending on the shapes of the tensors it looks like the error is implemented correctly after all.

However, the L2Loss is usually implemented as the MSE, which is not the case in this code. At least the EPE and L2 having the same implementation is a contradiction.

@sueskind sueskind reopened this Aug 30, 2023
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