cvg / Hierarchical-Localization

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

I ran pipeline_SfM, but I encountered an error #407

Closed wangjinhoon closed 4 months ago

wangjinhoon commented 4 months ago

Thank you for providing me with a good code.

I ran the pipeline_SfM example you provided without any modifications, but the following error occurred.

retrieval_path = extract_features.main(retrieval_conf, images, outputs)
pairs_from_retrieval.main(retrieval_path, sfm_pairs, num_matched=5)

[2024/07/17 14:56:00 hloc INFO] Extracting local features with configuration: {'model': {'name': 'netvlad'}, 'output': 'global-feats-netvlad', 'preprocessing': {'resize_max': 1024}} [2024/07/17 14:56:00 hloc INFO] Found 128 images in root datasets/South-Building/images. 100%|██████████| 128/128 [00:11<00:00, 11.41it/s] [2024/07/17 14:56:15 hloc INFO] Finished exporting features. [2024/07/17 14:56:15 hloc INFO] Extracting image pairs from a retrieval database.

RuntimeError Traceback (most recent call last) Cell In[28], line 2 1 retrieval_path = extract_features.main(retrieval_conf, images, outputs) ----> 2 pairs_from_retrieval.main(retrieval_path, sfm_pairs, num_matched=5)

File ~/Hierarchical-Localization/hloc/pairs_from_retrieval.py:109, in main(descriptors, output, num_matched, query_prefix, query_list, db_prefix, db_list, db_model, db_descriptors) 107 db_desc = get_descriptors(db_names, db_descriptors, name2db) 108 query_desc = get_descriptors(query_names, descriptors) --> 109 sim = torch.einsum("id,jd->ij", query_desc.to(device), db_desc.to(device)) 111 # Avoid self-matching 112 self = np.array(query_names)[:, None] == np.array(db_names)[None]

File ~/anaconda3/envs/py3.8/lib/python3.8/site-packages/torch/functional.py:378, in einsum(args) 373 return einsum(equation, _operands) 375 if len(operands) <= 2 or not opt_einsum.enabled: 376 # the path for contracting 0 or 1 time(s) is already optimized 377 # or the user has disabled using opt_einsum --> 378 return _VF.einsum(equation, operands) # type: ignore[attr-defined] 380 path = None 381 if opt_einsum.is_available():

RuntimeError: einsum(): the number of subscripts in the equation (2) does not match the number of dimensions (3) for operand 0 and no ellipsis was given