Skip to content

Superpoint+NN on aachen #475

Open
Open

Description

@Tianyu-Yan

When I ran the SuperPoint + SuperGlue on aachen, I got the results close to the reported baseline (day: 88.5 / 95.4 / 98.7 night: 86.7 / 92.9 / 100.0).

But when I ran SuperPoint + NN (NetVLAD top-30, NN with mutual check, distance threshold 0.7, covisibility clustering = False), the results were much lower than the reported baseline. 85.6 / 93.1 / 97.0 | 66.3 / 82.7 / 93.9

If I set the covisibility clustering = True, I got the following errors:

[2025/09/01 13:29:13 hloc INFO] Starting localization...
1%|█▍ | 12/922 [00:10<13:49, 1.10it/s]
Traceback (most recent call last):
File "/root/miniconda3/envs/hfnet/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/root/miniconda3/envs/hfnet/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/root/autodl-tmp/Hierarchical-Localization/hloc/pipelines/Aachen/pipeline.py", line 109, in
run(args)
File "/root/autodl-tmp/Hierarchical-Localization/hloc/pipelines/Aachen/pipeline.py", line 71, in run
localize_sfm.main(
File "/root/autodl-tmp/Hierarchical-Localization/hloc/localize_sfm.py", line 181, in main
ret, log = pose_from_cluster(
File "/root/autodl-tmp/Hierarchical-Localization/hloc/localize_sfm.py", line 108, in pose_from_cluster
ret = localizer.localize(kpq, mkp_idxs, mp3d_ids, query_camera, **kwargs)
File "/root/autodl-tmp/Hierarchical-Localization/hloc/localize_sfm.py", line 61, in localize
ret = pycolmap.estimate_and_refine_absolute_pose(
TypeError: estimate_and_refine_absolute_pose(): incompatible function arguments. The following argument types are supported:
1. (points2D: numpy.ndarray[numpy.float64[m, 2]], points3D: numpy.ndarray[numpy.float64[m, 3]], camera: pycolmap._core.Camera, estimation_options: pycolmap._core.AbsolutePoseEstimationOptions = AbsolutePoseEstimationOptions(), refinement_options: pycolmap._core.AbsolutePoseRefinementOptions = AbsolutePoseRefinementOptions(), return_covariance: bool = False) -> Optional[dict]

Invoked with: array([], shape=(0, 2), dtype=float16), [], Camera(camera_id=Invalid, model=SIMPLE_RADIAL, width=1600, height=1200, params=[1469.2, 800, 600, -0.0353019] (f, cx, cy, k)); kwargs: estimation_options={'ransac': {'max_error': 12}}, refinement_options={}

How to solve this problem? Thanks.

Activity

  1. Phil26AT commented on Sep 13, 2025

    @Phil26AT
    Collaborator

    Hey @Tianyu-Yan, thank you for reporting this issue. This seems to be a problem with empty points - can you please try PR #477?

  2. Tianyu-Yan commented on Sep 14, 2025

    @Tianyu-Yan
    Author

    Thank you for your help. I have tried your PR and the code now runs without any errors. However, the results using SuperPoint + NN on aachen are still much lower than the reported baseline. My setting is NetVLAD top-30, NN with mutual check, distance threshold 0.7, covisibility clustering = True. Are there any other configurations that need to be adjusted?

  3. JohannesK14 commented on Mar 10, 2026

    @JohannesK14

    I have the same problem:

    For Superpoint+NN wit NetVLAD top-30, mutual-check, distance threshold=0.7 and covisibility clustering = True I get

    85.8 / 93.3 / 96.8 | 67.3 / 82.7 / 93.9

    with the original number being:

    85.4 / 93.3 / 97.2 | 75.5 / 86.7 / 92.9

    I use the most recent commit available (c13273b) and attached code.

    I used this as a sanity check, as I have troubles replicating results for other methods as well.
    So it would be great to investigate this.

    import argparse
    from pathlib import Path
    from pprint import pformat
    
    from ... import (
        colmap_from_nvm,
        extract_features,
        localize_sfm,
        logger,
        match_features,
        pairs_from_covisibility,
        pairs_from_retrieval,
        triangulation,
    )
    
    
    def run(args):
        # Setup the paths
        dataset = args.dataset
        images = dataset / "images_upright/"
    
        outputs = args.outputs  # where everything will be saved
        sift_sfm = outputs / "sfm_sift"  # from which we extract the reference poses
        reference_sfm = outputs / "sfm_superpoint+NN"  # the SfM model we will build
        sfm_pairs = (
            outputs / f"pairs-db-covis{args.num_covis}.txt"
        )  # top-k most covisible in SIFT model
        loc_pairs = (
            outputs / f"pairs-query-netvlad{args.num_loc}.txt"
        )  # top-k retrieved by NetVLAD
        results = outputs / f"Aachen_hloc_superpoint+NN_netvlad{args.num_loc}.txt"
    
        # list the standard configurations available
        logger.info("Configs for feature extractors:\n%s", pformat(extract_features.confs))
        logger.info("Configs for feature matchers:\n%s", pformat(match_features.confs))
    
        # pick one of the configurations for extraction and matching
        retrieval_conf = extract_features.confs["netvlad"]
        feature_conf = extract_features.confs["superpoint_aachen"]
        matcher_conf = match_features.confs["NN-mutual"]
        matcher_conf["model"] = {**matcher_conf["model"], "distance_threshold": 0.7} # like setting from https://www.visuallocalization.net/details/10866/
    
        features = extract_features.main(feature_conf, images, outputs)
    
        colmap_from_nvm.main(
            dataset / "3D-models/aachen_cvpr2018_db.nvm",
            dataset / "3D-models/database_intrinsics.txt",
            dataset / "aachen.db",
            sift_sfm,
        )
        pairs_from_covisibility.main(sift_sfm, sfm_pairs, num_matched=args.num_covis)
        sfm_matches = match_features.main(
            matcher_conf, sfm_pairs, feature_conf["output"], outputs
        )
    
        triangulation.main(
            reference_sfm, sift_sfm, images, sfm_pairs, features, sfm_matches
        )
    
        global_descriptors = extract_features.main(retrieval_conf, images, outputs)
        pairs_from_retrieval.main(
            global_descriptors,
            loc_pairs,
            args.num_loc,
            query_prefix="query",
            db_model=reference_sfm,
        )
        loc_matches = match_features.main(
            matcher_conf, loc_pairs, feature_conf["output"], outputs
        )
    
        localize_sfm.main(
            reference_sfm,
            dataset / "queries/*_time_queries_with_intrinsics.txt",
            loc_pairs,
            features,
            loc_matches,
            results,
            covisibility_clustering=True, # like setting from https://www.visuallocalization.net/details/10866/
        )
    
    
    if __name__ == "__main__":
        parser = argparse.ArgumentParser()
        parser.add_argument(
            "--dataset",
            type=Path,
            default="datasets/aachen",
            help="Path to the dataset, default: %(default)s",
        )
        parser.add_argument(
            "--outputs",
            type=Path,
            default="outputs/aachen",
            help="Path to the output directory, default: %(default)s",
        )
        parser.add_argument(
            "--num_covis",
            type=int,
            default=20,
            help="Number of image pairs for SfM, default: %(default)s",
        )
        parser.add_argument(
            "--num_loc",
            type=int,
            default=30,
            help="Number of image pairs for loc, default: %(default)s",
        )
        args = parser.parse_args()
        run(args)
    
  4. JohannesK14 commented on Mar 11, 2026

    @JohannesK14

    With hloc 1.4 and pycolmap 0.4.0 and "superpoint_max" from extract_features.py I get:

    85.2 / 92.7 / 96.7 | 75.5 / 86.7 / 96.9

    So, "superpoint_aachen" is a little bit misleading ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions