FlexGlue β ONNX graphs for OpenMVS
Exported FlexGlue graphs, with the intrinsics-free relative-pose head H1, in the layout OpenMVS consumes in-process through ONNX Runtime β the same layout as the RoMa v2 bundle, so OpenMVS can use FlexGlue instead of RoMa v2 for both of its services: image-pair selection by a global retrieval descriptor and one-pass dense matching. When FlexGlue is the matcher, this bundle is the only model OpenMVS loads.
Two graphs, static shape, batch 1:
- descriptor (
flexglue_base_descriptor_fp32.onnx, fp32) βimage[1,3,512,512](planar RGB in [0,1], the image squashed to 512 x 512, bilinear, half-pixel centres, no antialiasing; ImageNet mean/std applied inside the graph) βfeatures[1,256,64,64](the DINOv3 ConvNeXt-B backbone and FlexGlue's stride-8 head) andretrieval[1,256](those features GeM-pooled, p = 3, and L2-normalised: the global descriptor for image-pair selection). - match (
flexglue_base_match_fp16.onnx, float16 transformer layers, float32 readout and heads) βfeatures0,features1[1,256,64,64],image_size0,image_size1[1,2](w, h of the original images) β from one call:warp0,warp1[1,128,128,2]: FlexGlue's dense mode at stride 4, both directions; for every cell of an image's 128 x 128 grid, the normalised coordinates in [-1,1] of where its centre lands in the other image;confidence0,confidence1[1,128,128]: 0 where FlexGlue's own gates fail (confidence < 0.1, forward-backward cycle error > 3 px of the 512 frame);covisibility[1]: the covisibility head after the last layer, "do the two images show the same place", in [0,1];R10[1,3,3],t10[1,3]: the H1 pose head on the pair's layer-9 features (average-pooled to 32 x 32), no camera input:x1 = R10 x0 + s t10,s > 0unknown,R10a proper rotation from camera 0 to camera 1,t10the unit baseline direction in camera 1 (x right, y down, z forward). The head adds about 0.5 ms per pair on an A100.
Contents
base-fp16/
flexglue_base.json manifest: sizes, normalisation, retrieval recipe, gates, heads and conventions, file names
flexglue_base_descriptor_fp32.onnx descriptor graph (weights inside, 358 MB)
flexglue_base_match_fp16.onnx match graph with the covisibility and H1 pose heads (weights inside, 98 MB)
flexglue_base_descriptor_fp32.export.json provenance sidecars
flexglue_base_match_fp16.export.json
export.log the export run
base-fp16 names the preset and the precision of the match graph's transformer layers (the descriptor graph and every head
run in float32).
Use from OpenMVS
cmake --build . --target flexglue-model # fetches this repo, verifies the pinned checksums
CreateStructure images/ --roma2 true --dense-matcher flexglue --match-mode 4 # FlexGlue retrieval pair selection
CreateStructure images/ --roma2 true --dense-matcher flexglue --match-mode 4 --roma2-match true # + one-pass dense matching
The fetch places the files where OpenMVS finds them (<install prefix>/share/openMVS/flexglue); otherwise point
--flexglue-model DIR or $OPENMVS_FLEXGLUE_MODEL_PATH at the folder holding flexglue_base.json. Needs a build configured with
-DOpenMVS_USE_ONNXRUNTIME=ON. By hand: scripts/fetch_model.py --model flexglue --dest DIR.
Provenance
| source | FlexGlue fork https://github.com/cdcseacave/FlexGlue, branch feat/pose-head, commit 6124adb17d50b7dd7fa14e8c0ecff7f54e295c1d (cvg/FlexGlue up to 9992029 plus the pose head) |
| FlexGlue weights | flexglue.pth of the cvg/FlexGlue v0.1 release, SHA256 d7371f743b8cdc4adf723c2aa05b181587fe4bc177fced139697975dff790068 |
| pose head | checkpoints/h1_no_intrinsics.pt (H1, 462,089 parameters, step 78,373), SHA256 ec1498a37bed093ef7f8cd5864b1420083e1b83042901cd239d6dde55d66cf00 |
| exporter | torch.onnx dynamo, opset 18, torch 2.11.0, onnx 1.23.2, onnxscript 0.7.2 |
| operators | the match graph uses ONNX Runtime's contrib com.microsoft::MultiHeadAttention and com.microsoft::Gelu (fused attention, as FlexGlue's own ONNX export) |
| metadata | the exporter's stack-trace metadata is stripped from both graphs (computation unchanged) |
| setting | 9 transformer layers, no early stopping, no refinement, dense coarse stride 4, filter 0.1, cycle distance 3 px |
Parity with PyTorch on 12 real image pairs from four captures (indoor, aerial, and two hand-held sequences), ONNX Runtime 1.23.2:
| check | CPU provider | CUDA provider |
|---|---|---|
| descriptor features, max abs difference / retrieval cosine | 3.3e-5 / 1.0000000 | 6.2e-3 / 1.0000000 (TF32) |
| match graph vs the traced module (same fp16 layers): warp median abs difference, share of cells with the same valid flag | 1.3e-5 / 0.999 | 3.2e-5 / 0.999 |
| match graph covisibility, abs difference | 1.7e-4 | 1.7e-4 |
H1 head inside the graph vs the repository's H1PoseHead on the same float32 features: rotation / direction |
3.0e-5 / 3.9e-5 deg | 0.041 / 0.045 deg (TF32) |
whole chain (image β descriptor β match graph) vs the PyTorch reference (fp16 autocast on CUDA, as FrozenFlexGluePose): rotation / direction |
0.063 / 0.125 deg | 0.048 / 0.136 deg |
The chain's residual difference is the float16 arithmetic of the transformer layers: the PyTorch reference itself moves by 0.069 deg / 0.078 deg between its float16 and float32 runs.
Licence β read this before downloading
Two licences apply, and the stricter one governs the descriptor graph.
| weights inside the graphs | graph | licence |
|---|---|---|
DINOv3 ConvNeXt-B backbone (87.6 M parameters, extractor.backbone.* of flexglue.pth) |
descriptor | DINOv3 License (Meta) β LICENSE-DINOv3.md |
| FlexGlue's stride-8 feature head (2.0 M) | descriptor | MIT β LICENSE-FlexGlue-MIT.txt |
| FlexGlue matcher: input projection, positional encoding, 9 transformer layers, correspondence and covisibility heads (about 46 M) | match | MIT |
H1 pose head (0.46 M, checkpoints/h1_no_intrinsics.pt of the source repository) |
match | MIT (the source repository's licence) |
FlexGlue's README states that flexglue.pth contains the DINOv3 backbone under the DINOv3 License and that all its other weights
are MIT. The H1 head was trained on features computed by the frozen FlexGlue model, DINOv3 backbone included.
Under Β§1(a) the DINOv3 License grants a royalty-free, worldwide right to use, reproduce, distribute, copy, modify and create derivative works of the materials. Under Β§1(b)(i), redistribution of the materials or any derivative is permitted only under that same Agreement, with a copy of it supplied β which is why it travels in this repository. Β§1(b)(iii) and Β§1(b)(v) require trade-control compliance and forbid ITAR, military, weapons, nuclear and espionage uses. Β§1(b)(ii) asks that published research acknowledge the use of DINOv3.
Downloading and using these files means accepting the DINOv3 License. Meta may amend it (Β§8); the copy here is the version these graphs were exported under (last updated 2025-08-19).
Citation
FlexGlue: Computer Vision and Geometry Lab, ETH Zurich, https://github.com/cvg/FlexGlue. DINOv3: SimΓ©oni et al., DINOv3, Meta AI Research, 2025.