naver / r2d2

Other
461 stars 86 forks source link

Testing #11

Closed Zumbalamambo closed 4 years ago

Zumbalamambo commented 4 years ago

How do I test the code on a single pair of images?

humenbergerm commented 4 years ago

What do you mean with pair? Do you want to extract the features for two images?

Zumbalamambo commented 4 years ago

@humenbergerm yes , I would like to extract the features for two images :)

humenbergerm commented 4 years ago

So why don't you just call extract.py? See readme:

To extract keypoints for a given image, simply execute:

python extract.py --model models/r2d2_WASF_N16.pt --images imgs/brooklyn.png --top-k 5000

This also works for multiple images (separated by spaces) or a .txt image list. For each image, this will save the top-k keypoints in a file with the same path as the image and a .r2d2 extension. For example, they will be saved in imgs/brooklyn.png.r2d2 for the sample command above.

jrevaud commented 4 years ago

Sorry, I did not include a script for testing on a given image pair.

Once you have the descriptors (as @humenbergerm said just above) you can follow the standard OpenCV matching pipeline (many demos are available like this one). Basically, matching descriptors using brute-force matching (cv2.BFMatcher(crossCheck=True)), filtering with RANSAC (cv2.findHomography()) and displaying them.

ShrutheeshIR commented 3 years ago

Hello authors. To find matches, it is a simple L2 similarity right? Which feature matcher would you recommend? Do you recommend the cv2.BFMatcher(cv2.NORM_L2, crossCheck=True). Or can I expect the same performance using the mnn_matcher from HPatches-Sequences-Matching-Benchmark.ipynb ? As a related query, will a dot product between the two feature descriptors give their similarity (i.e. higher the output, more similar are the features) Thanks

humenbergerm commented 3 years ago

Hi!

Yes, L2 similarity can be used. Note that the descriptors are L2 normalized, so the dot product works as well. Please check-out this code: https://github.com/naver/kapture-localization/blob/main/tools/kapture_compute_matches.py

Our "kapture" / "kaputure-localization" repos might help as well for other questions: https://github.com/naver/kapture ; https://github.com/naver/kapture-localization

I hope this helps! Best, Martin

AnupKumarGupta commented 3 years ago

Hi!

Yes, L2 similarity can be used. Note that the descriptors are L2 normalized, so the dot product works as well. Please check-out this code: https://github.com/naver/kapture/blob/master/tools/kapture_compute_matches.py

Our "kapture" repo might help as well for other questions: https://github.com/naver/kapture

I hope this helps! Best, Martin

The link to the compute matches file is broken. Can you please provide the updated path?

yocabon commented 3 years ago

compute matches was moved to the kapture-localization repository. I edited the answer above.