openmvs-flexglue-onnx
image matching and camera pose estimation in ONNX
2 min readupdated
A collection of FlexGlue neural network graphs in ONNX format (an open standard for fast model inference), prepared by developer cDcSeacave specifically for the OpenMVS 3D reconstruction system. The model handles two tasks at once: it selects overlapping photo pairs and builds a dense pixel-correspondence map in a single pass, while also estimating relative camera poses without requiring intrinsic parameters (intrinsics-free). Under the hood is a DINOv3 ConvNeXt-B backbone (87.6M parameters) with 9 transformer layers and an additional H1 head for pose calculation. The package mirrors the RoMa v2 bundle format, allowing it to serve as a drop-in replacement in photogrammetry and 3D scanning pipelines.
Key features
- Two separate graphs:
descriptor(358 MB, fp32) extracts 64×64 features and a global vector to retrieve similar frame pairs, whilematch(98 MB, fp16) performs dense correspondence matching. - Calibration-free pose estimation: the built-in H1 head (0.46M parameters) outputs the rotation matrix and translation direction between cameras in ~0.5 ms on an A100 GPU.
- Built-in filtering: the matching graph directly estimates scene covisibility and discards unreliable points using a confidence threshold and forward-backward cycle consistency.
- ONNX Runtime compatibility: leverages optimized
MultiHeadAttentionandGeluoperators to run natively inside OpenMVS C++ code without any PyTorch dependency.
What you can do
- Speed up 3D reconstruction in OpenMVS: plug the model into the
CreateStructureutility for image pair retrieval and dense matching when generating point clouds from photos. - Process uncalibrated captures: recover relative frame geometry from handheld cameras, drones, or web-scraped imagery where exact lens parameters are unknown.
- Integrate into custom C++/Python pipelines: run the exported ONNX files directly via ONNX Runtime 1.23+ with minimal numerical drift compared to the original PyTorch implementation.
Example
cmake --build . --target flexglue-model
CreateStructure images/ --roma2 true --dense-matcher flexglue --match-mode 4
CreateStructure images/ --roma2 true --dense-matcher flexglue --match-mode 4 --roma2-match trueRead more
DetailsAccuracy vs. PyTorch (CUDA, fp16): median warp error of 3.2e-5 (99.9% valid cell agreement), pose error of 0.048° in rotation and 0.136° in translation direction.
Requirements: OpenMVS built with the
-DOpenMVS_USE_ONNXRUNTIME=ON flag; input images are resized to 512×512 (batch size 1).License: the matching graph and H1 head are under the MIT license, while the descriptor graph includes the DINOv3 backbone (Meta), subject to the strict DINOv3 license prohibiting military use.










Comments