cvg / Hierarchical-Localization

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

Different pose result for Cambridge KingsCollege dataset when reconstruction done from scratch #127

Closed patelajaychh closed 2 years ago

patelajaychh commented 2 years ago

Hi I have tried to create pose data for Cambridge KingsCollege dataset using HLOC custom pipeline.

retrieval_conf = extract_features.confs['netvlad']
feature_conf = extract_features.confs['superpoint_max']
matcher_conf = match_features.confs['superglue']
pairs_from_retrieval.main(
    global_descriptors, loc_pairs, num_loc,
    query_prefix="", db_prefix="")  
# for getting Image pairs
# num_loc = 50 in this case
loc_matches = match_features.main(
    matcher_conf, loc_pairs, feature_conf['output'], outputs)
# For image matching
sfm_dir = outputs / 'sfm_superpoint+superglue'
reconstruction.main(sfm_dir, images, loc_pairs, feature_path, loc_matches)
# For SFM reconstruction
# images - path to dir which contains all the images. ( I moved images from different seq folder to a single folder )

After running for a long time I got results as -

Bundle adjustment report
------------------------
    Residuals : 9501476
   Parameters : 1197224
   Iterations : 51
         Time : 715.492 [s]
 Initial cost : 0.99316 [px]
   Final cost : 0.992958 [px]
  Termination : No convergence

  => Merged observations: 572
  => Completed observations: 1183
  => Filtered observations: 318
  => Changed observations: 0.000436
  => Filtered images: 0
  => No good initial image pair found.

  Mean Reprojection error - 1.515 pixels
  Cameras - 1563

Elapsed time: 781.474 [minutes]

Output directory structure - outputs / sfm_superpoint+superglue/models/0 --> images.bin, points3D.bin, cameras.bin

I was expecting output filed to be inside outputs / sfm_superpoint+superglue.

When I compared the poses in images.bin and poses from url empty_all/images.txt, results are totally different.

Can please help me get the explanation for this?

for ref

seq8/frame00064.png
[-6.4031   4.93185 13.9765 ] - tvec,  [ 0.683091  0.543983 -0.314596  0.372154] - qvec : GT value, image_id = 1
[2.26069  0.331164 1.79242 ] - tvec, [ 0.881012  -0.0223714 -0.463615   0.0915346] - qvec: Ours value, image_id = 1550
# Also image ids have changed
sarlinpe commented 2 years ago