-
Notifications
You must be signed in to change notification settings - Fork 397
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 keypoint coordinates #12
Comments
Good catch! I think the variable names are wrong, but the output should be correct. Unfortunately I don't have write privileges and can't update the code :/ |
Yes, the output is not affected since the inverted meaning is inverted again when accessing the heatmap and for the When porting this to other languages, e.g. C++, you have to sample the feature map with (x,y) tuples. The python code currently suggests that these should be (y,x) tuples, resulting in the wrong descriptors. |
@christian-rauch I try a small example, and I feel no wrong: import numpy as np
a = np.random.randn(3, 3)
a
Out[4]:
array([[ 0.24942095, 0.8585088 , -0.1106783 ],
[ 0.07011566, 0.21370989, 0.81164736],
[ 2.40070676, -0.11000709, -1.76859847]])
np.where(a > 0)
Out[5]: (array([0, 0, 1, 1, 1, 2]), array([0, 1, 0, 1, 2, 0])) Where do I understand wrongly? |
The first row in your matrix You will see this better when you visualise the data: import numpy as np
import matplotlib.pyplot as plt
if __name__ == "__main__":
a = np.zeros(shape=(5,7))
# set pixel at x=5 and y=2 to 1
a[2,5] = 1
# find the coordinate of value '1'
y,x = np.where(a==1)
print("point (x,y): ",x[0],",",y[0])
plt.imshow(a)
plt.show() And the
|
@christian-rauch Oh I got it, thanks for your patient and vivid explanation.BTW, could you provide a script that can draw |
@laisimiao I opened pull request #14 to fix this issue. Is this sufficient to demonstrate that it works? Btw, at
this was already done correctly. |
Hi, I think @christian-rauch is right, and should fix, because |
The keypoint coordinates are extracted from the heatmap via:
SuperPointPretrainedNetwork/demo_superpoint.py
Lines 251 to 257 in 1fda796
The indices returned by
np.where
, respectivelynp.nonzero
are in order of the dimensions. In a NumPy array, the first dimension is along the rows (i.e. they
coordinates in an image), the second dimension is along the columns (i.e. thex
coordinates in an image).Hence, syntactically this should be:
The actual variable name does not matter later, as those values are correctly normalised.
The text was updated successfully, but these errors were encountered: