vandal-vpr / vg-transformers

Official Repository of "Learning Sequential Descriptors for Sequence-based Visual Place Recognition "
MIT License
39 stars 5 forks source link

What is the role of variables 【old_index】? #10

Closed wpumain closed 1 year ago

wpumain commented 1 year ago

https://github.com/vandal-vpr/vg-transformers/blob/c57fca9085a8dfcfd74e21ddea8f6722940de5dd/tvg/datasets/dataset.py#L164

What is the role of variables 【old_index】?

Why not use 【index】 directly to get value from [images_paths] In the【def getitem(self, index):】function? I think it can be taken directly in this way https://github.com/vandal-vpr/vg-transformers/blob/c57fca9085a8dfcfd74e21ddea8f6722940de5dd/tvg/datasets/dataset.py#L59 https://github.com/vandal-vpr/vg-transformers/blob/c57fca9085a8dfcfd74e21ddea8f6722940de5dd/tvg/datasets/dataset.py#L174

ga1i13o commented 1 year ago

I will as soon as I have time add some comments to the dataset class to make everything clearer. Anyway, the images_paths list, as you can see, contains in the first NUM_DB positions, the db paths. From the indexes NUM_DB to the end of the list, it contains query paths.

However, among all the q_paths, there are some queries that have no positive matches. For this reason, there exist the qIdx matrix, that contains the indexes of queries that have at least one positive in the db.

For these reason, in the getitem, if the index is > DB_NUM, it means that this is a query, and so in this code:

https://github.com/vandal-vpr/vg-transformers/blob/25537ed1689d4b5401113f6c4476fb8f0cf28158/tvg/datasets/dataset.py#L165-L167

by subtracting DB_NUM I get the index in terms of number of queries, and I use it to look up into qIdx the actual query index inside images_paths. The old_index, at line 164 that you mentioned, is not really needed, and I return it for completeness/debug purposes

wpumain commented 1 year ago

Think you for your help!