cvg/FlexGlue

FlexGlue: Sparse-to-Dense Feature Matching and Visual Disambiguation

What it solves

Matching points between two images of the same scene is essential for 3D reconstruction, visual localization, and structure-from-motion. Traditional matchers rely on specific keypoint detectors and fail when images look similar but show different places, such as repeated building facades. FlexGlue solves this by working with any keypoints—or none at all—and by predicting whether the two images are actually covisible, rejecting unmatchable look-alike pairs.

How it works

FlexGlue first encodes each image into a dense feature map using a DINOv3-ConvNeXt backbone (stride-8). A transformer then processes both feature maps jointly, allowing context to flow within and across images. For each query point (keypoint, grid cell, or sampled location), its correspondence in the other image is found by correlation. The model also outputs a covisibility score—the probability that the two images show the same place. If that score is below a threshold, all matches are rejected. It can stop early in the transformer layers when a pair is confidently rejected, saving computation. Matches are refined to subpixel accuracy and can be further improved with an optional RoMa v2 refiner.

Who it’s for

FlexGlue is for developers and researchers working on 3D vision tasks: structure-from-motion, visual localization, SLAM, or any application that needs reliable image correspondence. It is especially useful when keypoint detectors are unreliable or when images come from different viewpoints, lighting, or with low texture. Its flexible matching modes and compatibility with any keypoints make it easy to integrate into existing pipelines.

Highlights

  • Flexible input modes: works with keypoints in both images, only one, or none at all (sampled correspondences).
  • Covisibility check: scores each image pair and rejects look-alike pairs, avoiding false matches.
  • Early stopping: saves compute by stopping early on pairs confidently classified as non-matches.
  • Dense correspondence: can output a dense grid of matches across the whole image, not just at keypoints.
  • Multiple export options: runs with PyTorch, torch.hub, or as a split ONNX model for deployment.
  • Batch and refinement: supports batched inference and optional subpixel refinement via RoMa v2.

Related

  • Project
  • Project
  • Project
  • Project