cvg / Hierarchical-Localization

Visual localization made easy with hloc
Apache License 2.0
3.2k stars 593 forks source link

Estimate pose given an SfM model #101

Closed matz9x closed 2 years ago

matz9x commented 3 years ago

I would like to understand the pipeline required to estimate the pose of a set of new frames given the reconstructed model generated using another set of images.

Given 2 sets of images (the first is used for SfM and the second is instead used for pose estimation). As far as I understood, this is the process:

  1. Create SfM: i. extract features (extract_features()) ii. match features (match_features()) iii. reconstruct model (reconstruction.main())
  2. Perform image retrieval (this part is unclear to me and I would ask for suggestions): i. use netvlad (or similar) for estimating "image proximity" ii. create pairs from retrieved "image proximity" iii. ?
  3. Localize query frames using SfM: i. localize images using the sfm model and the pairs generated in step 2 (localize_sfm)

Can you please provide some support on steps 2 and 3, confirming or modifying the pipeline?

Best regards

sarlinpe commented 3 years ago
  1. Image retrieval = computing the image pairs
    1. Extract global descriptors: run hloc.extract_features using the NetVLAD config https://github.com/cvg/Hierarchical-Localization/blob/ad139dc9c066d83312a99f3c77632caa311ad849/hloc/extract_features.py#L97-L106
    2. Compute the pairs: find the top-k most similar reference images using python -m hloc.pairs_from_retrieval --descriptors path_to_global_descriptors.h5 --output path_to_pairs.txt --num_matched 20 --query_prefix subpath_of_queries --db_prefix subpath_of_refs
  2. Localization = find the pose of each query images, individually
    1. Extract local features for the queries
    2. Matches the features according to the list of pairs computed in 2.
    3. Run hloc.localize_sfm on the matches