Skip to main content

Easily test and apply pairwise image matching models

Project description

vismatch (formerly Image Matching Models)

Vis(ion)Match(ers) is a unified API for quickly and easily trying 50+ (and growing!) image matching models.

Open In Colab Models on HF Downloads Tracker PyPI Downloads HF Downloads/month ReadTheDocs Page

Jump to: Install | Use | Models | Add a Model / Contributing | Acknowledgements | Cite | Download Stats | Documentation

Matching Examples

Compare matching models across various scenes. For example, we show SIFT-LightGlue and LoFTR matches on pairs:

(1) outdoor, (2) indoor, (3) satellite remote sensing, (4) paintings, (5) a false positive, and (6) spherical.

SIFT-LightGlue

LoFTR

Extraction Examples

You can also extract keypoints and associated descriptors.

SIFT and DeDoDe

Install

vismatch can be installed directly from PyPi. We strongly recommend using uv, but pip should work too

pip install uv             # install uv
uv venv                    # create uv venv
source .venv/bin/activate  # activate uv venv
uv pip install vismatch
# or, if you don't want to use uv
pip install vismatch

or, for development, clone this git repo and install with:

# Clone recursively
git clone --recursive https://github.com/gmberton/vismatch
cd vismatch

uv venv                    # create uv venv
source .venv/bin/activate  # activate uv venv
# editable install for dev work
uv pip install -e . 
# or non-editable install
uv pip install .

Some models require additional optional dependencies which are not included in the default list, like torch-geometric (required by SphereGlue) and tensorflow/larq (required by OmniGlue/ZippyPoint). To install these, use

uv pip install ".[all]"
# or
pip install .[all]

Use

You can use any of the over 50 matchers simply like this. All model weights are automatically downloaded by vismatch.

Python API

from vismatch import get_matcher
from vismatch.viz import plot_matches, plot_keypoints

# Choose any of the 50+ matchers listed below
matcher = get_matcher("superpoint-lightglue", device="cuda")
img_size = 512  # optional

img0 = matcher.load_image("assets/example_pairs/outdoor/montmartre_close.jpg", resize=img_size)
img1 = matcher.load_image("assets/example_pairs/outdoor/montmartre_far.jpg", resize=img_size)

result = matcher(img0, img1)
# result.keys() = ["num_inliers", "H", "all_kpts0", "all_kpts1", "all_desc0", "all_desc1", "matched_kpts0", "matched_kpts1", "inlier_kpts0", "inlier_kpts1"]

# This will plot visualizations for matches as shown in the figures above
plot_matches(img0, img1, result, save_path="plot_matches.png")

# Or you can extract and visualize keypoints as easily as
result = matcher.extract(img0)
# result.keys() = ["all_kpts0", "all_desc0"]
plot_keypoints(img0, result, save_path="plot_keypoints.png")

Command Line Interface / Standalone Scripts

You can also run matching or extraction as standalone scripts, to get the same results as above.

Matching:

# if you cloned this repo, vismatch_match.py is available, else see CLI below
python vismatch_match.py --matcher superpoint-lightglue --out-dir outputs/superpoint-lightglue --input assets/example_pairs/outdoor/montmartre_close.jpg assets/example_pairs/outdoor/montmartre_far.jpg
# or
uv run vismatch_match.py --matcher superpoint-lightglue --out-dir outputs/superpoint-lightglue --input assets/example_pairs/outdoor/montmartre_close.jpg assets/example_pairs/outdoor/montmartre_far.jpg

From any location where an python enviroment with vismatch installed is active, you can also run

# for PyPi install, use CLI entry point
vismatch-match --matcher superpoint-lightglue --out-dir outputs/superpoint-lightglue --input path/to/img0 --input path/to/img2

Keypoints extraction:

# if you cloned this repo, vismatch_extract.py is available, else see CLI below
python vismatch_extract.py --matcher superpoint-lightglue --out-dir outputs/superpoint-lightglue --input assets/example_pairs/outdoor/montmartre_close.jpg
# or
uv run vismatch_extract.py --matcher superpoint-lightglue --out-dir outputs/superpoint-lightglue --input assets/example_pairs/outdoor/montmartre_close.jpg

From any location where an python enviroment with vismatch installed is active, you can also run

# for PyPi install, use CLI entry point
vismatch-extract --matcher superpoint-lightglue --out-dir outputs/superpoint-lightglue --input path/to/img0

These scripts can take as input images, folders with multiple images (or multiple pairs of images), or files with pairs of images paths. To see all possible parameters run

python vismatch_match.py -h
# or
python vismatch_extract.py -h

Available Models

We support the following methods:

Dense: roma, tiny-roma, duster, master, minima-roma, ufm

Semi-dense: loftr, eloftr, se2loftr, xoftr, minima-loftr, aspanformer, matchformer, xfeat-star, xfeat-star-steerers[-perm/-learned], edm, rdd-star, topicfm[-plus]

Sparse: [sift, superpoint, disk, aliked, dedode, doghardnet, gim, xfeat]-lightglue, dedode, steerers, affine-steerers, xfeat-steerers[-perm/learned], dedode-kornia, [sift, orb, doghardnet]-nn, patch2pix, superglue, r2d2, d2net, gim-dkm, xfeat, omniglue, [dedode, xfeat, aliked]-subpx, [sift, superpoint]-sphereglue, minima-superpoint-lightglue, liftfeat, rdd-[sparse,lightglue, aliked], ripe, lisrd, zippypoint, loma, loma-r

See Model Details to see runtimes, supported devices, source, and license of each model.

Important: although VisMatch uses a BSD 3-Clause License, the matchers we wrap can have different licenses. Please refer to each matcher's license when using them.

Adding a new method

See CONTRIBUTING.md for details. We follow the 1st principle of PyTorch: Usability over Performance

Documentation

Please see docs at: https://vismatch.readthedocs.io/en/latest/

Acknowledgements

Special thanks to the authors of all models included in this repo (links in Model Details), and to authors of other libraries we wrap like the Image Matching Toolbox and Kornia.

Download Stats

Daily downloads across all vismatch HuggingFace models, updated daily. Click the plot for the interactive version.

Downloads per day

Cite

This repo was created as part of the EarthMatch paper. Please cite EarthMatch if this repo is helpful to you!

@InProceedings{Berton_2024_EarthMatch,
    author    = {Berton, Gabriele and Goletto, Gabriele and Trivigno, Gabriele and Stoken, Alex and Caputo, Barbara and Masone, Carlo},
    title     = {EarthMatch: Iterative Coregistration for Fine-grained Localization of Astronaut Photography},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
    month     = {June},
    year      = {2024},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vismatch-1.2.1.tar.gz (35.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

vismatch-1.2.1-py3-none-any.whl (28.9 MB view details)

Uploaded Python 3

vismatch-1.2.1-2-py3-none-any.whl (32.5 MB view details)

Uploaded Python 3

File details

Details for the file vismatch-1.2.1.tar.gz.

File metadata

  • Download URL: vismatch-1.2.1.tar.gz
  • Upload date:
  • Size: 35.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vismatch-1.2.1.tar.gz
Algorithm Hash digest
SHA256 c4b8ffe1372c32dd083bf7ffeb09a42484147d3a60af427b5acb685ab85ba61d
MD5 1acab7ad38d0e1dfaf2212dfac55f73d
BLAKE2b-256 25d5749d9637765827206f755cea81ec2967126ed40d4c5ba0ea649527667fdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for vismatch-1.2.1.tar.gz:

Publisher: publish.yml on gmberton/vismatch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vismatch-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: vismatch-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 28.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vismatch-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 788c689e39d6dad3dba929d30d52faac5cfe6a0dc12897b77c5b0a9703242c40
MD5 80b22331e3b8a29da79bc418d54d2248
BLAKE2b-256 5a9d6246f0800e8b34441ad48f7e5cb7f45e21a5b9208b8980711758971cd2c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for vismatch-1.2.1-py3-none-any.whl:

Publisher: publish.yml on gmberton/vismatch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vismatch-1.2.1-2-py3-none-any.whl.

File metadata

  • Download URL: vismatch-1.2.1-2-py3-none-any.whl
  • Upload date:
  • Size: 32.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for vismatch-1.2.1-2-py3-none-any.whl
Algorithm Hash digest
SHA256 374a387e81027182abcfa5acc34584a43fc64a9e3d7758cfa5e2637e3144661b
MD5 7b4b3eac8987f1ec489f4c23e3d298fe
BLAKE2b-256 e9084bb46299b0dbd141cac03ca91e04f754471ea326a7ee5d3155445ec0d27c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page