QVPR / Patch-NetVLAD

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

Msls processing #59

Closed cazhang closed 2 years ago

cazhang commented 2 years ago

Hello, Thanks for making the training code available for msls. As I'm reading the code, there are a few things I can't understand:

1) line 225 of msls.py: what is the usage of this? Just for understanding purpose, is it possible to implement this with more readable codes?

2) line 539 of msls.py: dPos and dNeg are similarly rather than distance, does this matter?

StephenHausler commented 2 years ago

Hi @cazhang,

FYI msls.py was written by Mapillary, with a line or two changed by us. See: https://github.com/mapillary/mapillary_sls

  1. Line 225 takes a query image id and returns a unique list of corresponding positive (from the database) image ids. The use of unique and sequences is because this code is dual purpose, its used for training place recognition on either individual images, or sequences of images. The code is not as readable because it is was designed for multiple purposes, by Mapillary - not just for training Patch-NetVLAD. Although in future work we might write our own training loader code, and in which case it will be written more readable.

  2. I'm not sure if it matters or not, I haven't done a training ablation to find out as of yet. I suspect that it would be better if dPos and dNeg were changed to distance, but I haven't had time to double check yet. You could try changing line 539 to: loss = np.sqrt(2-2dPos) - np.sqrt(2-2dNeg) + (self.margin ** 0.5) And see if that changes how the network trains (again though, I haven't debugged this change yet, it may just not work at all).

StephenHausler commented 2 years ago

Closing now, feel free to reopen or email me if you have any further questions.