cvg / Hierarchical-Localization

Visual localization made easy with hloc
Apache License 2.0
3.24k stars 600 forks source link

Reading pairs.txt breaks when filenames contain spaces #319

Open expenses opened 1 year ago

expenses commented 1 year ago

Because pairs.txt uses space as a delimiter, any unix filenames that contain spaces will break it:

Traceback (most recent call last):
  File "/home/ashley/Hierarchical-Localization/process.py", line 46, in <module>
    match_features.main(matcher_conf, pairs, features=features, matches=matches)
  File "/home/ashley/Hierarchical-Localization/hloc/match_features.py", line 174, in main
    match_from_paths(conf, pairs, matches, features_q, features_ref, overwrite)
  File "/home/ashley/.pyenv/versions/3.10.13/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/home/ashley/Hierarchical-Localization/hloc/match_features.py", line 217, in match_from_paths
    pairs = parse_retrieval(pairs_path)
  File "/home/ashley/Hierarchical-Localization/hloc/utils/parsers.py", line 46, in parse_retrieval
    q, r = p.split()
ValueError: too many values to unpack (expected 2)
sarlinpe commented 1 year ago

Yes this is expected. We could use comma separators instead.

isolin commented 10 months ago

I just bumped into the same issue. It would be great to resolve it. Sounds like an easy but breaking change, unfortunately.