A differentiable computer vision library built on PyTorch, offering GPU-friendly image processing, geometry, augmentation and feature-matching operators.
cvg/FlexGlue
A feature matcher for finding correspondences between two images, working with sparse keypoints, dense grids, or no keypoints, with a built-in check for look-alike image pairs.
- Stars
- 266
- Forks
- 13
- Open issues
- 1
- Last commit
- 23 hours ago
What is it?
FlexGlue is a Python feature matcher for computer vision pipelines such as image matching and 3D reconstruction. It encodes each image with a DINOv3-ConvNeXt backbone into a stride-8 feature map, refines both maps with a transformer, and locates each query point's correspondence in the other image by correlation. It can match user-supplied keypoints (the examples use LightGlue's ALIKED detector), match dense grids of sampled points, or run without any keypoints.
Beyond matching, FlexGlue predicts a covisibility score, the probability that two images show the same place. This lets it reject look-alike pairs such as repeated building facades, and with early stopping it skips most of the computation on rejected pairs. Matchers can be run in batches, compiled with torch.compile, loaded through torch.hub, or exported to ONNX and run with ONNX Runtime without PyTorch.
The project provides a demo notebook, pretrained weights, and optional sub-pixel refinement using RoMa v2. Its code is MIT licensed, while the DINOv3 backbone weights are distributed under a separate license with usage restrictions.
Key features
- 01Matches user-supplied keypoints, dense sampled grids, or images with no keypoints.
- 02Predicts a covisibility score to reject look-alike pairs such as repeated facades.
- 03Supports batched inference over image pairs of different sizes.
- 04Offers optional sub-pixel refinement with RoMa v2 refiners.
- 05Exports to ONNX for use with ONNX Runtime without PyTorch.
Use cases
- Establishing correspondences between photos for structure-from-motion or reconstruction pipelines.
- Filtering out repeated-structure image pairs before geometric verification or localization.
- Running feature matching in a C++ or non-Python environment via the ONNX export.
- Benchmarking or comparing matchers that work with arbitrary keypoint detectors.
Quick start
- 1
Clone the repository and enter it
git clone https://github.com/cvg/FlexGlue.git && cd FlexGlue - 2
Install FlexGlue with pip in editable mode
python -m pip install -e . - 3
Install the latest LightGlue commit to use its keypoint detectors (optional)
python -m pip install git+https://github.com/cvg/LightGlue.git - 4
Run the demo notebook in Colab or locally
Things to know
- The matcher example requires a CUDA GPU.
- The best accuracy relies on higher resolution and the optional RoMa v2 refiner, which adds cost.
- The project is a recent research release and its API may change.
In collections
Topics
FAQ
- What is FlexGlue?
- A feature matcher for finding correspondences between two images, working with sparse keypoints, dense grids, or no keypoints, with a built-in check for look-alike image pairs. FlexGlue is a Python feature matcher for computer vision pipelines such as image matching and 3D reconstruction. It encodes each image with a DINOv3-ConvNeXt backbone into a stride-8 feature map, refines both maps with a transformer, and locates each query point's correspondence in the other image by correlation. It can match user-supplied keypoints (the examples use LightGlue's ALIKED detector), match dense grids of sampled points, or run without any keypoints.
- Is FlexGlue free to use? What license does it have?
- FlexGlue is open source under the MIT license. Check the license terms before using it in commercial products.
- Is FlexGlue still maintained?
- Actively maintained. The last commit to FlexGlue was on Nov 6, 2026.
- What can I use FlexGlue for?
- Establishing correspondences between photos for structure-from-motion or reconstruction pipelines. Filtering out repeated-structure image pairs before geometric verification or localization. Running feature matching in a C++ or non-Python environment via the ONNX export. Benchmarking or comparing matchers that work with arbitrary keypoint detectors.
- How do I install FlexGlue?
- Clone the repository and enter it: git clone https://github.com/cvg/FlexGlue.git && cd FlexGlue Install FlexGlue with pip in editable mode: python -m pip install -e . Install the latest LightGlue commit to use its keypoint detectors (optional): python -m pip install git+https://github.com/cvg/LightGlue.git Run the demo notebook in Colab or locally
- Where can I get FlexGlue?
- The source code and installation instructions are on GitHub: https://github.com/cvg/FlexGlue
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Ultralytics YOLOv5, a PyTorch-based computer vision toolkit for object detection, instance segmentation and image classification with training and export.
Official PyTorch implementation of BiRefNet, a deep learning model for high-resolution dichotomous image segmentation, commonly used for background removal.
A free, open-source Chinese-language book and companion code for learning PyTorch, from basics to CV, NLP, LLM applications and deployment.
A general-purpose Structure-from-Motion and Multi-View Stereo pipeline with GUI and command-line interfaces for 3D reconstruction from images.
Open-source node-based visual programming tool for photogrammetry, turning photos into 3D models, camera tracking and HDR images.