Skip to content

Pass explicit match path from match_features CLI#499

Open
yimingc wants to merge 2 commits into
cvg:masterfrom
yimingc:fix/match-features-cli-matches
Open

Pass explicit match path from match_features CLI#499
yimingc wants to merge 2 commits into
cvg:masterfrom
yimingc:fix/match-features-cli-matches

Conversation

@yimingc

@yimingc yimingc commented Jun 14, 2026

Copy link
Copy Markdown

Summary

This fixes the hloc.match_features CLI path mode for callers that provide explicit feature and match HDF5 paths.

match_features.main() already supports this mode through its matches argument: when features is a real file path, matches must also be provided as a path. The CLI also defines --matches, but the module entrypoint did not pass args.matches into main(), so explicit-path CLI calls failed before matching started.

This PR:

  • adds a unit test that reproduces the explicit --features /path/features.h5 --matches /path/matches.h5 CLI path;
  • passes args.matches from the CLI entrypoint into main();
  • converts an existing string feature path to Path before passing it to match_from_paths().

Validation

Run locally with an environment that has hloc's runtime dependencies installed:

python -m unittest tests.test_match_features_cli
python -m py_compile hloc/match_features.py tests/test_match_features_cli.py

Result:

Ran 1 test in 0.786s
OK

I also checked that the existing name-based mode still returns the historical generated match filename pattern when pairs are empty and no model execution is needed.

@yimingc yimingc force-pushed the fix/match-features-cli-matches branch from 3c96485 to 5d78202 Compare June 14, 2026 14:35
@yimingc

yimingc commented Jun 14, 2026

Copy link
Copy Markdown
Author

Updated the draft after local review:

  • changed the final CLI entrypoint call to pass export_dir= and matches= as keyword arguments;
  • kept the PR as two commits: one reproducing test, one fix;
  • reran local validation with the hloc GPU venv used for this PR:
    • python -m unittest tests.test_match_features_cli
    • python -m py_compile hloc/match_features.py tests/test_match_features_cli.py
    • python -m black hloc/match_features.py tests/test_match_features_cli.py --check --diff
    • python -m flake8 hloc tests
    • git diff --check upstream/master...HEAD
    • Python scan for bidi control characters in changed files

All passed.

@yimingc yimingc marked this pull request as ready for review June 14, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant