Models · Camera calibration

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

Checkpoint anycalib-pinhole

Paper 2025 Added in 0.2.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 21.5 ms 1080x1920, fp16
vs the faster original 1.8× original fp16: 38.4 ms
Peak memory 739 MiB original: 1,343 MiB
Accuracy vs original fp32 – original not run on the test set

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)

BackenddtypeTime per call (ms)vs original fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32not measured ––––
Original fp16torch.autocast(float16) around the call; javrtg/AnyCalib@027a8497d893 AnyCalib.predict (pinhole), its resize / crop / linear + GN fitfp16 38.4–1,343 MiB/1,352 MiB4.00.75
Portable fp32fp32not measured ––––
Portablefp16 29.41.3×705 MiB/742 MiB1.70.69
Kernelsfp16 21.51.8×739 MiB/812 MiB1.50.37
Portable + torch.compile 25.51.5×719 MiB/756 MiB17 (build)–
TensorRTplanned for 0.2.1fails––––

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

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-13Originalfp32340 3,236 MiB process–1080x1920
Portablefp32266 3,023 MiB processmatches1080x1920
Kernelsfp16not 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 LICENSE
Weights
Apache-2.0 source
Training data

Our reading of the licences, not legal advice.

Weights

anycalib_pinhole.pt 1.3 GB· hosted on GitHub

fastforks 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 %

Rundtypevfov_auc5 ↑imagesms / image
Original fp32fp3251.6 2000 61.5
Original fp16not measured
Portable fp32fp3251.6 2000 52.9
Portablefp1651.6 2000 30.6
Kernelsfp1651.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 %

Rundtypevfov_auc5 ↑imagesms / image
Original fp32fp3248.5 200 61.7
Original fp16fp1648.5 200 40.1
Portable fp32fp3248.5 200 52.9
Portablefp1648.4 200 30.1
Kernelsfp1648.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).

CheckToleranceMeasured
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 backbones
  • dpt_fusedfused fp16 matrix multiplies and convolutions for DINOv2 backbones and DPT depth heads
  • cudnn_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.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
anycalib-pinholesynthetic (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-pinhole TensorRT 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-pinhole 3000x4000 (1.0 GiB peak allocated, 1.1 reserved)
  • anycalib-pinhole 1080x1920, first call: portable + torch.compile 17 s (cold Inductor cache).
  • anycalib-pinhole original 1080x1920: torch.autocast(float16) around the call; javrtg/AnyCalib@027a8497d893 AnyCalib.predict (pinhole), its resize / crop / linear + GN fit
  • anycalib-pinhole load / 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.

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
anycalib-pinholeLaMAR2k, all 2000 images, roll / pitch / vertical FoV error AUC@5 degrees %– / – / 51.6– / – / 51.6– / – / 51.6– / – / 51.5
anycalib-pinholeLaMAR2k, 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).

variantkernels error vs original, mean / p99GPU, torchkernels used
anycalib-pinhole0.06214 / 0.33598RTX 5060 Ti, torch 2.14.1+cu130cudnn_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=false or release_graphs() frees it.

Example output

No example rendered for this checkpoint yet.