AnyCalib
AnyCalib (University of Zaragoza, ICCV 2025): the camera of one photo (focal length, principal point, field of view) from one predicted viewing ray per pixel and a fit; no checkerboard needed, no gravity. Apache-2.0 code and weights; trained on crops of public 360-degree panoramas.
experimental Fork of javrtg/AnyCalib@027a849 · backends: portable, kernels
- Paper AnyCalib: On-Manifold Learning for Model-Agnostic Single-View Camera Calibration ICCV 2025 · first released 16 Mar 2025
Checkpoint anycalib-pinhole
Paper 2025 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("anycalib-pinhole") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.intrinsics # also: vfov
result.backend # what ran: mode, device, dtype, kernels fastforks bench anycalib-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; javrtg/AnyCalib@027a8497d893 AnyCalib.predict (pinhole), its resize / crop / linear + GN fit | fp16 | 38.4 | – | 1,343 MiB/1,352 MiB | 4.0 | 0.75 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 29.4 | 1.3× | 705 MiB/742 MiB | 1.7 | 0.69 |
| Kernels | fp16 | 21.5 | 1.8× | 739 MiB/812 MiB | 1.5 | 0.37 |
| Portable + torch.compile | 25.5 | 1.5× | 719 MiB/756 MiB | 17 (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-16. 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-13 | Original | fp32 | 340 | 3,236 MiB process | – | 1080x1920 |
| Portable | fp32 | 266 | 3,023 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
Our reading of the licences, not legal advice.
Weights
anycalib_pinhole.pt 1.3 GB· hosted on GitHubfastforks downloads and checks these files on first use (fastforks download anycalib-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 | vfov_auc5 ↑ | images | ms / image |
|---|---|---|---|---|
| Original fp32 | fp32 | 51.6 | 2000 | 61.5 |
| Original fp16 | not measured | |||
| Portable fp32 | fp32 | 51.6 | 2000 | 52.9 |
| Portable | fp16 | 51.6 | 2000 | 30.6 |
| Kernels | fp16 | 51.5 | 2000 | 21.8 |
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 | vfov_auc5 ↑ | images | ms / image |
|---|---|---|---|---|
| Original fp32 | fp32 | 48.5 | 200 | 61.7 |
| Original fp16 | fp16 | 48.5 | 200 | 40.1 |
| Portable fp32 | fp32 | 48.5 | 200 | 52.9 |
| Portable | fp16 | 48.4 | 200 | 30.1 |
| Kernels | fp16 | 48.4 | 200 | 21.7 |
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: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 343b2f69, 2026-11-17; 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.00019 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.094 and p99 <= 0.51 (absolute error of the output intrinsics).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.00019 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.094 | 0.06214 |
| GPU default dtypes, p99 |diff| | ≤ 0.51 | 0.33598 |
Recorded for anycalib-pinhole on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-13, with these kernels: cudnn_haccdpt_fusedfastbb
Details
AnyCalib (Tirado-Garín and Civera, ICCV 2025): single-image camera calibration. A DINOv2 ViT-L/14 with a light DPT decoder predicts one ray per pixel (tangent coordinates on the unit sphere, convex upsampling); a linear fit and Gauss-Newton refinement give the intrinsics of the chosen camera model. Gives the pinhole intrinsics (fx, fy, cx, cy) and the vertical field of view; no gravity.
- 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 (1,065 MiB allocated)
- Options
cuda_graphs=true
- Outputs
intrinsics,vfov- CUDA kernels
fastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbonesdpt_fusedfused fp16 matrix multiplies and convolutions for DINOv2 backbones and DPT depth headscudnn_haccconvolutions with fp16 accumulation (cuDNN)
- Apple (MPS)
- fp32
Limitations
- Kernels keep CUDA graphs: their private pool and static outputs stay reserved, so peak reserved is ~80 MiB above portable (peak allocated is not); `cuda_graphs=false` or `release_graphs()` frees it.
Full reference, generated from the repository
AnyCalib (University of Zaragoza, ICCV 2025): the camera of one photo (focal length, principal point, field of view) from one predicted viewing ray per pixel and a fit; no checkerboard needed, no gravity. Apache-2.0 code and weights; trained on crops of public 360-degree panoramas.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
anycalib-pinhole | synthetic (1080x1920) | original portable kernels portable + torch.compile TensorRT fp16 | 38.4 29.4 21.5 25.5 planned for 0.2.1 | 1343 / 1352 705 / 742 739 / 812 719 / 756 – |
Details
- Original code: https://github.com/javrtg/AnyCalib at
027a8497d893 - Code licence: Apache-2.0 (permissive); files:
LICENSE - Weights licence: Apache-2.0
- Licence evidence: https://github.com/javrtg/AnyCalib/blob/027a8497d893f4b2596f23d6324c05e4b81064ed/LICENSE ; https://github.com/javrtg/AnyCalib/blob/027a8497d893f4b2596f23d6324c05e4b81064ed/README.md
- Training data: LVD-142M (DINOv2's curated web-image set, not released), OpenPano (perspective crops of public 360-degree panoramas: PolyHaven, HDRMaps, AmbientCG, BlenderKit) (anycalib_pinhole: DINOv2 ViT-L/14 (LVD-142M) fine-tuned on the perspective OpenPano split (OP_p; README, paper Sec. 5). Only the weights licence counts for the commercial flag.)
- Options:
cuda_graphs= True (speed only) - Kernel libraries:
fastbb,dpt_fused,cudnn_hacc - Variants:
anycalib-pinhole - Not in this release (planned for 0.2.1):
anycalib-pinholeTensorRT export: the engine builds but a dataset-level camera accuracy acceptance threshold is not yet established - Outputs: intrinsics, vfov
- Input size: any H x W >= 32, padded to a multiple of 32
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
anycalib-pinhole3000x4000 (1.0 GiB peak allocated, 1.1 reserved) anycalib-pinhole1080x1920, first call: portable + torch.compile 17 s (cold Inductor cache).anycalib-pinholeoriginal 1080x1920: torch.autocast(float16) around the call; javrtg/AnyCalib@027a8497d893 AnyCalib.predict (pinhole), its resize / crop / linear + GN fitanycalib-pinholeload / first call: original 4.09 s / 0.578 s, portable 1.73 s / 0.685 s, kernels 1.53 s / 0.371 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 |
|---|---|---|---|---|---|---|---|
anycalib-pinhole | LaMAR2k, all 2000 images, roll / pitch / vertical FoV error AUC@5 degrees % | – / – / 51.6 | – / – / 51.6 | – / – / 51.6 | – / – / 51.5 | ||
anycalib-pinhole | LaMAR2k, every 10th image (200), roll / pitch / vertical FoV error AUC@5 degrees % | – / – / 48.5 | – / – / 48.5 | – / – / 48.4 | – / – / 48.5 | – / – / 48.4 |
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 343b2f69 / ce213f43, 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.00019 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.094 and p99 <= 0.51 (absolute error of the output intrinsics).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
anycalib-pinhole | 0.06214 / 0.33598 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400, dpt_fused@48e0065bb7cf:sm_120, fastbb@7d058322634d:sm_120 |
Limitations
- Kernels keep CUDA graphs: their private pool and static outputs stay reserved, so peak reserved is ~80 MiB above portable (peak allocated is not);
cuda_graphs=falseorrelease_graphs()frees it.
Example output
No example rendered for this checkpoint yet.