cvg / Hierarchical-Localization

Visual localization made easy with hloc
Apache License 2.0
3.23k stars 599 forks source link

RuntimeError: The size of tensor a (128) must match the size of tensor b (256) at non-singleton dimension 1 #403

Closed Chim-SO closed 4 months ago

Chim-SO commented 4 months ago

Hello, I'm encountering an error when trying to run the following code:

    references = [str(p.relative_to(images)) for p in images.iterdir()]
    feature_conf = extract_features.confs['sift']

    matcher_conf = match_features.confs['superglue']
    extract_features.main(feature_conf, images, image_list=references, feature_path=features)
    pairs_from_poses.main(colmap_arkit, sfm_pairs, n_matched)
    match_features.main(matcher_conf, sfm_pairs, features=features, matches=matches);

Error: third_party/SuperGluePretrainedNetwork/models/superglue.py", line 249, in forward desc0 = desc0 + self.kenc(kpts0, data['scores0']) RuntimeError: The size of tensor a (128) must match the size of tensor b (256) at non-singleton dimension 1

I would appreciate any help or guidance on resolving this issue. Thank you for your time and assistance!

Chim-SO commented 4 months ago

I replaced 'sift' with 'superpoint_inloc' and deleted the folders, which solved the problem. Now, the issue is determining which matcher to use when working with SIFT features.

Chim-SO commented 4 months ago

'NN-ratio' and 'NN-mutual' both works.