AnyCalib (fastforks)

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.

This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/javrtg/AnyCalib at 027a8497d893.

Task: calibration. Tier: experimental. Outputs: intrinsics, vfov. Backends: portable, kernels.

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.

Variants

Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.

variant weights (author link) SHA-256 weights licence commercial use
anycalib-pinhole@1 anycalib_pinhole.pt e73b174563bc Apache-2.0 yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: LICENSE.

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.).

Licence evidence: https://github.com/javrtg/AnyCalib/blob/027a8497d893f4b2596f23d6324c05e4b81064ed/LICENSE ; https://github.com/javrtg/AnyCalib/blob/027a8497d893f4b2596f23d6324c05e4b81064ed/README.md

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)

Speed and memory

Calibration, synthetic, 1080x1920

model time (ms): original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
anycalib-pinhole 38.4 29.4 21.3 1.8x 1.4x 1343 / 1352 705 / 742 741 / 816

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
anycalib-pinhole 4.09 0.60 1.59 0.58 0.45 0.33

torch.compile and TensorRT

model input time: portable compile TensorRT fp16 kernels preparation: compile (cold first call) ONNX + engine build peak MiB (alloc / reserved): portable compile kernels TensorRT (engine + torch)
anycalib-pinhole 1080x1920 29.4 ms 25.5 ms planned for 0.2.1 21.3 ms 16.5 s – 705 / 742 719 / 756 741 / 816 –

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.

Accuracy

On public datasets

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 kernels note
anycalib-pinhole LaMAR2k, all 2000 images, roll / pitch / vertical FoV error AUC@5 degrees % – / – / 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.4

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6637f957, 2026-11-13.

Parity with the original code

Every variant is checked against reference outputs of the original code at its pinned commit. 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).

Usage

from fastforks import calibration

model = calibration.load("anycalib-pinhole")  # mode="auto": the preferred backend from recorded measurements
result = model("photo.jpg")
result.intrinsics  # [3, 3] float32 K in input pixels
# result.roll, result.pitch, result.vfov (radians), result.gravity [3]: where the model estimates them
result.backend  # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')

Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: anycalib-pinhole.

Kernels backend

calibration.load("anycalib-pinhole", mode="kernels") runs our CUDA kernels (fastbb, dpt_fused, cudnn_hacc). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including fastforks/anycalib