QVPR / Patch-NetVLAD

Code for the CVPR2021 paper "Patch-NetVLAD: Multi-Scale Fusion of Locally-Global Descriptors for Place Recognition"
MIT License
517 stars 72 forks source link

Match realtime add #12

Closed StephenHausler closed 3 years ago

StephenHausler commented 3 years ago

Adding new function to run Patch-NetVLAD in real-time from a web camera input. Also fixing a bug in match_two.py, where the cuda logic (line 196) was inverted meaning it was always defaulting to CPU rather than GPU.

Please review and merge @Tobias-Fischer @oravus :)

StephenHausler commented 3 years ago

Made review changes @Tobias-Fischer. Could not easily use patchnetvlad.tools.datasets import input_transform due to being a class method, but still made neater by importing from match_two. match_realtime only has a main function now, all other required functions are imported.

Tobias-Fischer commented 3 years ago

Ah. Let's make it work then and fix match_two as well. Simply move input_transform out of the class and make it a normal function that can be imported. Similarly, let's pull in normalise_func and not duplicate code. Finally, can you amend https://github.com/QVPR/Patch-NetVLAD/blob/main/setup.py#L57 to include the new script please :)

StephenHausler commented 3 years ago

Ok great thanks, fixed up input_transform and setup.py. I renamed the normalization function in match_two to apply_patch_weights, the two functions (the norm function in local_matcher vs the one in match_two) were doing different things and the old name was misleading.

Tobias-Fischer commented 3 years ago

Looking good to me. @oravus - do you mind having a look and merge?