FlexGlue (fastforks)

FlexGlue (Lindenberger, Sarlin, Miksik and Pollefeys 2026): sparse feature matching from dense features. ALIKED finds up to 2048 keypoints per image at a 1024-pixel long side, a DINOv3 ConvNeXt-B describes each image at 512 x 512, nine transformer layers (rotary self-attention, cross-attention) relate both feature maps, and a head predicts where each keypoint lands in the other image; mutual nearest neighbours of keypoints and predictions are the matches. Returns both keypoint sets, the index pairs of the matches and their confidence.

This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/cvg/FlexGlue at 99920296d082.

Task: matching. Tier: experimental. Outputs: keypoints1, keypoints2, pairs, scores. Backends: portable, kernels.

Input: two RGB images of one scene. Output: for every pixel of the first image its position in the second (x, y in pixels) and a certainty that the pixel is visible in both. Sparse matchers (LightGlue) return the keypoints of both images and the index pairs of the matched ones instead. To reconstruct camera poses from an image folder with these matchers, see structure from motion.

Variants

Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.

variant weights (author link) SHA-256 weights licence commercial use
aliked-flexglue@1 flexglue.pth
aliked-n16.pth
d7371f743b8c
5be8704840ed
MIT AND LicenseRef-DINOv3-License AND BSD-3-Clause yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT AND BSD-3-Clause. Licence files: LICENSE, LICENSE-ALIKED, LICENSE-DINOv3.

Training data: FlexGlue: the README states no training data and the training code is not released (see the paper). The DINOv3 ConvNeXt-B backbone was pretrained on LVD-1689M (Meta, not released); ALIKED was trained on MegaDepth..

  • Licence note: The checkpoint includes the DINOv3 ConvNeXt-B backbone weights (extractor.backbone.*): the DINOv3 License (Meta: attribution and conditions apply) covers them; read it before commercial use.

Licence evidence: https://github.com/cvg/FlexGlue/blob/99920296d082c9405ebfd612d674efe288e74881/README.md#license ; https://github.com/Shiaoming/ALIKED/blob/683d7c65197395c0b3f01ebe76e1084a27e73a65/LICENSE

Input size

any H x W >= 32, padded to a multiple of 32 Tested up to (portable, fp16, RTX 5060 Ti 16 GB): aliked-flexglue 3000x4000 (2.0 GiB peak allocated, 2.5 reserved)

Speed and memory

Matching, synthetic, 768x1024

model time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
aliked-flexglue – 348 129 129 2.7x 1.0x 1801 / 1892 1775 / 1886 1814 / 2178

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
aliked-flexglue 4.50 0.92 0.97 1.66 1.20 1.06

torch.compile and TensorRT

model input time: portable compile TensorRT (fp16 unless shown) kernels preparation: compile (cold first call) ONNX + engine build peak MiB (alloc / reserved): portable compile kernels TensorRT (engine + torch)
aliked-flexglue 768x1024 129 ms 96.1 ms 328 ms, fp32 engine (dense descriptor with eager ALIKED and matching) 129 ms 78.8 s 22.3 s 1775 / 1886 1762 / 1826 1814 / 2178 2225 / 2410

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.

Accuracy

On public datasets

Dense matchers: 5000 matches per pair sampled from the warp by certainty (upstream's balanced KDE sampling); sparse matchers: all their matches of one call (LightGlue, XFeat: LightGlue's MegaDepth-1500 setting; LoFTR, DeDoDe: their card defaults). OpenCV essential-matrix RANSAC (0.5 px threshold, normalised by the mean focal length); AUC of the larger of the rotation and translation-direction errors. Both modes receive pairs resized to 768 x 1024. Map matched pixels to the calibrated evaluation coordinates and use the same RANSAC seed per pair. The same 300 pairs for all modes, so float32 and bfloat16 compare pair for pair. Original = the original code named under Details, same checkpoint and protocol.

variant dataset original fp32 portable portable fp32 kernels TensorRT note
aliked-flexglue MegaDepth-1500, 300 pairs at 768 x 1024, pose AUC@5 / @10 / @20 48.9 / 67.6 / 80.5 50.4 / 68.6 / 81.1
aliked-flexglue MegaDepth-1500, every 5th pair, relative pose AUC@5 / @10 / @20 degrees 50.8 / 68.2 / 80.4 51.5 / 69.1 / 81.0 51.9 / 69.3 / 81.1 51.5 / 69.1 / 81.0

Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 32e2e81e9, 2026-11-20; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 32e2e81e9 / 7eb2e0f4, 2026-11-18 to 2026-11-20; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 78a59767f, 2026-11-20; tensorrt: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7eb2e0f4, 2026-11-18.

Parity with the original code

Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.0001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0052 and p99 <= 0.012 (absolute error of the output keypoints1).

Limitations

  • Sparse output: no dense warp. result.matches() gives the matched points for estimate_pose; pairs are the index pairs pycolmap / COLMAP databases take.
  • One image pair per call internally (batches run pair by pair); the keypoint counts differ per image.
  • No exportable module: the keypoint and match counts are data-dependent (torch.compile runs with graph breaks; ONNX / TensorRT export fails).
  • Upstream's sparse mode only: no RoMa v2 refiner, no dense or sampled matches and no covisibility score.
  • Two resizes per image as upstream: ALIKED sees a long side of long_side (aspect kept), the descriptor a size x size square whatever the aspect ratio.

Usage

from fastforks import matching

model = matching.load("aliked-flexglue")  # mode="auto": the preferred backend from recorded measurements
result = model("view1.jpg", "view2.jpg")
result.keypoints1  # [2, H1, W1] float32: x, y in view2 pixels
result.backend  # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')

Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: aliked-flexglue.

Kernels backend

matching.load("aliked-flexglue", mode="kernels") runs our CUDA kernels (image_normalize). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including fastforks/flexglue