Coder Social home page Coder Social logo

How to convert pose to utm about patch-netvlad HOT 4 CLOSED

qvpr avatar qvpr commented on June 8, 2024
How to convert pose to utm

from patch-netvlad.

Comments (4)

Tobias-Fischer avatar Tobias-Fischer commented on June 8, 2024

Hi,

utmQ and utmDb are simply N*2 numpy arrays where each row contains the x & y coordinates of a query / reference place. The posDistThr scalar is the ground truth tolerance (typically in meters). See

if ground_truth_path is not None:
self.utmQ, self.utmDb, self.posDistThr = self.parse_gt_file(ground_truth_path)

def get_positives(self):
# positives for evaluation are those within trivial threshold range
# fit NN to find them, search by radius
if self.positives is None:
knn = NearestNeighbors(n_jobs=-1)
knn.fit(self.utmDb)
self.distances, self.positives = knn.radius_neighbors(self.utmQ, radius=self.posDistThr)
return self.positives

@staticmethod
def parse_gt_file(gtfile):
print('Parsing ground truth data file...')
gtdata = np.load(gtfile)
return gtdata['utmQ'], gtdata['utmDb'], gtdata['posDistThr']

if opt.ground_truth_path is not None:
print('Calculating recalls using ground truth.')
gt = eval_set.get_positives()
global_recalls = compute_recall(gt, predictions, eval_set.numQ, n_values, 'NetVLAD')
local_recalls = compute_recall(gt, reranked_predictions, eval_set.numQ, n_values, 'PatchNetVLAD')
write_recalls_output(opt, global_recalls, local_recalls, n_values)

for relevant code snippets.

from patch-netvlad.

DonMuv avatar DonMuv commented on June 8, 2024

But my ground truth file, the poses of the images come in the format of a 7 feature vector (t_x, t_y, t_z, q_x, q_y, q_z, q_w), with t corresponding to the translation vector and q to the rotation expressed in form of a quaternion.

such as
[ 4.45019497e+00 8.69529027e+00 4.75170998e-01 6.67300280e-01 -2.33674360e-01 2.27086490e-01 6.69730062e-01]
[... ... ]
...

pose matrix of shape = (n, 7)

from patch-netvlad.

Tobias-Fischer avatar Tobias-Fischer commented on June 8, 2024

Hi,
Simply modify the get_positives() method above to define your desired ground truth tolerance. In our case, it's simply the Euclidean distance in the plane; if you want to use this simply disregard everything except for t_x and t_y (sth like utmQ = utmQ[:, :2] and the same for utmDb)

Alternatively, you could adapt get_positives to separately have some tolerance for position (based on t) and orientation (based on q). You should be able to use some code from e.g. kapture to do this. utmQ and utmDb will be a bit confusing naming of the variables, as they will contain a matrix of size N*7, but otherwise everything else should work the same.

from patch-netvlad.

Tobias-Fischer avatar Tobias-Fischer commented on June 8, 2024

Feel free to re-open if you have more questions.

from patch-netvlad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.