cvg / Hierarchical-Localization

Visual localization made easy with hloc
Apache License 2.0
3.17k stars 585 forks source link

A clean install of the latest version fails to install SuperGluePretrainedNetwork #300

Closed SharkWipf closed 1 year ago

SharkWipf commented 1 year ago

If you upgrade from an older version, there's no problem, but if you create a clean Conda env and install hloc from the latest master branch (after cloning with --recursive to pull in the submodules of course), it'll fail to install SuperGluePretrainedNetwork:

[2023/07/29 16:14:31 hloc INFO] Extracting local features with configuration:                                                                                                                                                                                                                                                
{'model': {'max_keypoints': 4096, 'name': 'superpoint', 'nms_radius': 3},                                                                                                                                                                                                                                                    
 'output': 'feats-superpoint-n4096-r1024',                                                                                                                    
 'preprocessing': {'grayscale': True, 'resize_max': 1024}}                                                                                                                                                                                                                                                                   
Traceback (most recent call last):                                                                                                                                                                                                                                                                                           
  File "/home/sebastiaan/.conda/envs/nerf/bin/ns-process-data", line 8, in <module>                                                                                                                                                                                                                                          
    sys.exit(entrypoint())                                                                                                                                    
  File "/home/sebastiaan/.conda/envs/nerf/lib/python3.10/site-packages/nerfstudio/scripts/process_data.py", line 404, in entrypoint                                                                                                                                                                                          
    tyro.cli(Commands).main()                                                                                                                                 
  File "/home/sebastiaan/.conda/envs/nerf/lib/python3.10/site-packages/nerfstudio/process_data/video_to_nerfstudio_dataset.py", line 112, in main             
    self._run_colmap(mask_path)                                                                                                                                                                                                                                                                                              
  File "/home/sebastiaan/.conda/envs/nerf/lib/python3.10/site-packages/nerfstudio/process_data/colmap_converter_to_nerfstudio_dataset.py", line 216, in _run_colmap
    hloc_utils.run_hloc(
  File "/home/sebastiaan/.conda/envs/nerf/lib/python3.10/site-packages/nerfstudio/process_data/hloc_utils.py", line 103, in run_hloc
    extract_features.main(feature_conf, image_dir, image_list=references, feature_path=features)
  File "/home/sebastiaan/.conda/envs/nerf/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/sebastiaan/.conda/envs/nerf/lib/python3.10/site-packages/hloc/extract_features.py", line 252, in main
    Model = dynamic_load(extractors, conf['model']['name'])
  File "/home/sebastiaan/.conda/envs/nerf/lib/python3.10/site-packages/hloc/utils/base_model.py", line 39, in dynamic_load
    module = __import__(module_path, fromlist=[''])
  File "/home/sebastiaan/.conda/envs/nerf/lib/python3.10/site-packages/hloc/extractors/superpoint.py", line 8, in <module>
    from SuperGluePretrainedNetwork.models import superpoint  # noqa E402
ModuleNotFoundError: No module named 'SuperGluePretrainedNetwork'
Traceback (most recent call last):
  File "/home/sebastiaan/src/ml/nerf_utils/ns-my-pipeline.py", line 111, in <module>
    run_pipeline(args.input_video, args.num_frames_target, args.camera_type, args.model_type, args.max_num_iterations, args.mesh_type, args.render_path_file, args.force_rewrite, args.use_bounding_box, args.bounding_box_min, args.bounding_box_max, args.no_colmap, args.no_train, args.no_mesh, args.no_render)
  File "/home/sebastiaan/src/ml/nerf_utils/ns-my-pipeline.py", line 50, in run_pipeline
    _, elapsed_time = run_command(f"ns-process-data video --data {input_video} --output-dir {colmap_folder} --camera-type {camera_type} --num-frames-target {num_frames_target} --gpu --sfm-tool hloc --matching-method sequential")
  File "/home/sebastiaan/src/ml/nerf_utils/ns-my-pipeline.py", line 14, in run_command
    process = subprocess.run(cmd, shell=True, check=True)
  File "/home/sebastiaan/.conda/envs/nerf/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'ns-process-data video --data /home/sebastiaan/src/ml/nerf/work/mathijs-groundfloor-lq.mp4 --output-dir /home/sebastiaan/src/nerf/work/out/colmaps/mathijs-groundfloor-lq/1200 --camera-type perspective --num-frames-target 1200 --gpu --sfm-tool hloc --matching-method sequential' 
returned non-zero exit status 1.

Steps to reproduce:

sarlinpe commented 1 year ago

I can't reproduce this using the current master branch. I don't use conda nor nerfstudio though. Does this still occur?

SharkWipf commented 1 year ago

Hmm, I just retested it again in a clean env with the latest versions of everything, and it seems to be working fine now. Don't think anything changed in this repo's master branche since, so I guess something must have changed in the submodules, dependencies or in Nerfstudio?

Either way, it seems to be working now, so I guess it can be closed.

SharkWipf commented 1 year ago

I ran into this issue again reinstalling it, so I guess it isn't gone yet after all, but I'm also not sure how to consistently reproduce it. If anyone else runs into it in the future, at least my workaround of going back to the 1.3 commit, installing, and then going back to the latest still works.