GeoCalib
GeoCalib (ETH Zurich / Microsoft, 2024): the camera of one photo (focal length, field of view) and how it is tilted (roll, pitch from gravity), from perspective fields and an optimisation; no checkerboard needed. Apache-2.0 code, CC-BY-4.0 weights; training photos of mixed licences.
experimental Fork of cvg/GeoCalib@1dedb29 · backends: portable, kernels
- Paper GeoCalib: Learning Single-image Calibration with Geometric Optimization ECCV 2024 · first released 10 Sept 2024
Checkpoint geocalib-pinhole
Paper 2024 Added in 0.2.0 Evaluated with 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install fastforks-core
from fastforks import calibration
model = calibration.load("geocalib-pinhole") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.intrinsics # also: gravity, roll, pitch, vfov
result.backend # what ran: mode, device, dtype, kernels fastforks bench geocalib-pinhole Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.
Speed and memory
Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.
Input: synthetic, 1080x1920 (the task’s standard size)
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | not measured | – | – | – | – |
| Original fp16torch.autocast(float16) around the call; cvg/GeoCalibdedb29f94fc GeoCalib.calibrate (pinhole), its kornia resize / crop / LM fit | fp16 | 106 | – | 502 MiB/558 MiB | 0.4 | 1.48 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 81.2 | 1.3× | 320 MiB/378 MiB | 0.3 | 1.84 |
| Kernels | fp16 | 81.8 | 1.3× | 277 MiB/338 MiB | 0.4 | 0.74 |
| Portable + torch.compile | 73.1 | 1.5× | 246 MiB/300 MiB | 28 (build) | – | |
| TensorRTplanned for 0.2.1 | fails | – | – | – | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-13 to 2026-11-15. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two
times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.
Other devices
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14 | Original | fp32 | 529 | 1,908 MiB process | – | 1080x1920 |
| Portable | fp16 | 427 | 1,644 MiB process | matches | 1080x1920 | |
| Portable | fp32 | 517 | 1,717 MiB process | matches | 1080x1920 | |
| Kernels | fp16 | not implemented | – | 1080x1920 | ||
CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.
Licence and weights
Commercial use allowed
- Code
- Apache-2.0 LICENSELICENSE-WEIGHTS
- Weights
- CC-BY-4.0 source
- Training data
Our reading of the licences, not legal advice.
Weights
geocalib-pinhole.tar 116 MB· hosted on GitHubfastforks downloads and checks these files on first use (fastforks download geocalib-pinhole).
Accuracy
The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.
LaMAR2k
all 2000 images, roll / pitch / vertical FoV error AUC@5 degrees %
| Run | dtype | roll_auc5 ↑ | pitch_auc5 ↑ | vfov_auc5 ↑ | Δ roll_auc5 vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 92.6 | 76.8 | 41.6 | reference | 2000 | 117 |
| Original fp16 | not measured | ||||||
| Portable fp32 | fp32 | 92.6 | 76.8 | 41.6 | ±0.0 | 2000 | 93.1 |
| Portable | fp16 | 92.6 | 76.8 | 41.6 | +0.0 | 2000 | 83.0 |
| Kernels | fp16 | 92.6 | 76.8 | 41.6 | +0.0 | 2000 | 85.3 |
Each image at its own size (1440 x 1920 portrait); roll, pitch and vertical field of view of the fitted camera against the ground truth; AUC of the error up to 5 degrees (errors below 1 degree count as 1, siclib's `compute_auc(min_error=1)`), the GeoCalib paper's protocol. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-13; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks ce213f43, 2026-11-17; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6637f957, 2026-11-13.
LaMAR2k
every 10th image (200), roll / pitch / vertical FoV error AUC@5 degrees %
| Run | dtype | roll_auc5 ↑ | pitch_auc5 ↑ | vfov_auc5 ↑ | Δ roll_auc5 vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 90.2 | 76.7 | 44.0 | reference | 200 | 116 |
| Original fp16 | fp16 | 90.2 | 76.5 | 44.0 | +0.0 | 200 | 101 |
| Portable fp32 | fp32 | 90.2 | 76.7 | 44.0 | ±0.0 | 200 | 91.6 |
| Portable | fp16 | 90.2 | 76.6 | 44.0 | +0.0 | 200 | 83.0 |
| Kernels | fp16 | 90.2 | 76.6 | 44.0 | +0.0 | 200 | 85.3 |
Each image at its own size (1440 x 1920 portrait); roll, pitch and vertical field of view of the fitted camera against the ground truth; AUC of the error up to 5 degrees (errors below 1 degree count as 1, siclib's `compute_auc(min_error=1)`), the GeoCalib paper's protocol. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-13; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6637f957, 2026-11-13.
Closeness to the original
Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 0.0032 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.087 and p99 <= 0.39 (absolute error of the output intrinsics).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.0032 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.087 | 0.05777 |
| GPU default dtypes, p99 |diff| | ≤ 0.39 | 0.25995 |
Recorded for geocalib-pinhole on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-13, with these kernels: cudnn_hacc
Details
GeoCalib (Veicht et al., ECCV 2024): single-image camera calibration. An MSCAN-L network predicts per-pixel perspective fields (up vectors and latitude) with confidences; a differentiable Levenberg-Marquardt optimiser fits the focal length and gravity direction (roll, pitch) to them. Gives intrinsics, gravity, roll, pitch and vertical field of view.
- Input / output
- Input: one RGB image. Output: the camera intrinsics
[3, 3]and, where the model estimates them, the gravity direction in the camera frame, roll, pitch and vertical field of view. - Input size
- any H x W >= 32, padded to a multiple of 32; tested up to 3000x4000 (502 MiB allocated)
- Options
cuda_graphs=true
- Outputs
intrinsics,gravity,roll,pitch,vfov- CUDA kernels
cudnn_haccconvolutions with fp16 accumulation (cuDNN)
- Apple (MPS)
- fp32, fp16
Limitations
- The Levenberg-Marquardt loop branches and logs on its convergence (35 graph breaks: `torch.compile` runs with breaks, no `torch.export`); its damping, singularity check and early stop are batch-wide, as upstream, so a batch is one problem and an image's result can depend on its batch mates.
Full reference, generated from the repository
GeoCalib (ETH Zurich / Microsoft, 2024): the camera of one photo (focal length, field of view) and how it is tilted (roll, pitch from gravity), from perspective fields and an optimisation; no checkerboard needed. Apache-2.0 code, CC-BY-4.0 weights; training photos of mixed licences.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
geocalib-pinhole | synthetic (1080x1920) | original portable kernels portable + torch.compile TensorRT fp16 | 106 81.2 81.8 73.1 planned for 0.2.1 | 502 / 558 320 / 378 277 / 338 246 / 300 – |
Details
- Original code: https://github.com/cvg/GeoCalib at
1dedb29f94fc - Code licence: Apache-2.0 (permissive); files:
LICENSE,LICENSE-WEIGHTS - Weights licence: CC-BY-4.0
- Licence evidence: https://github.com/cvg/GeoCalib/blob/1dedb29f94fc11b896c5f572005978aeebccd67f/LICENSE ; https://github.com/cvg/GeoCalib/blob/1dedb29f94fc11b896c5f572005978aeebccd67f/README.md
- Training data: OpenPano (perspective crops of public 360-degree panoramas: PolyHaven, HDRMaps, AmbientCG, BlenderKit) (Trained on OpenPano (README, paper Sec. 4): perspective crops of ~2.8k public 360-degree panoramas (PolyHaven, HDRMaps, AmbientCG, BlenderKit). Only the weights licence (CC-BY-4.0) counts for the commercial flag.)
- Options:
cuda_graphs= True (speed only) - Kernel libraries:
cudnn_hacc - Variants:
geocalib-pinhole - Not in this release (planned for 0.2.1):
geocalib-pinholeONNX / TensorRT export: dynamic optimizer convergence and unsupported ONNX Cholesky decomposition - Outputs: intrinsics, gravity, roll, pitch, vfov
- Input size: any H x W >= 32, padded to a multiple of 32
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
geocalib-pinhole3000x4000 (0.5 GiB peak allocated, 0.6 reserved) geocalib-pinhole1080x1920, first call: portable + torch.compile 28 s (cold Inductor cache).geocalib-pinholeoriginal 1080x1920: torch.autocast(float16) around the call; cvg/GeoCalibdedb29f94fc GeoCalib.calibrate (pinhole), its kornia resize / crop / LM fitgeocalib-pinholeload / first call: original 1.8 s / 0.841 s, portable 0.27 s / 1.837 s, kernels 0.44 s / 0.745 s- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
Measured
Each image at its own size (1440 x 1920 portrait); roll, pitch and vertical field of view of the fitted camera against the ground truth; AUC of the error up to 5 degrees (errors below 1 degree count as 1, siclib's compute_auc(min_error=1)), the GeoCalib paper's protocol. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
geocalib-pinhole | LaMAR2k, all 2000 images, roll / pitch / vertical FoV error AUC@5 degrees % | 92.6 / 76.8 / 41.6 | 92.6 / 76.8 / 41.6 | 92.6 / 76.8 / 41.6 | 92.6 / 76.8 / 41.6 | ||
geocalib-pinhole | LaMAR2k, every 10th image (200), roll / pitch / vertical FoV error AUC@5 degrees % | 90.2 / 76.7 / 44.0 | 90.2 / 76.5 / 44.0 | 90.2 / 76.6 / 44.0 | 90.2 / 76.7 / 44.0 | 90.2 / 76.6 / 44.0 |
Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6637f957, 2026-11-13; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6637f957 / ce213f43, 2026-11-13 to 2026-11-17; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6637f957, 2026-11-13.
Parity
CPU, float32: max |diff| <= 0.0032 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.087 and p99 <= 0.39 (absolute error of the output intrinsics).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
geocalib-pinhole | 0.05777 / 0.25995 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400 |
Limitations
- The Levenberg-Marquardt loop branches and logs on its convergence (35 graph breaks:
torch.compileruns with breaks, notorch.export); its damping, singularity check and early stop are batch-wide, as upstream, so a batch is one problem and an image's result can depend on its batch mates.
Example output
No example rendered for this checkpoint yet.