--- license: apache-2.0 base_model: javrtg/AnyCalib tags: - mlx - camera-calibration - swift library_name: mlx pipeline_tag: image-feature-extraction --- # AnyCalib — MLX weights Converted weights for [mlx-swift-AnyCalib](https://github.com/mnmly/mlx-swift-AnyCalib), a Swift/MLX port of [AnyCalib](https://github.com/javrtg/AnyCalib) (Tirado-Garín & Civera, ICCV 2025): single-view camera calibration with a camera model chosen after the network runs. These are **not** new weights. They are the official AnyCalib checkpoints in a different container. ## What was changed * Repacked from PyTorch `.pt` into `safetensors`. * Convolution tensors transposed `(out, in, kH, kW) → (out, kH, kW, in)` for MLX's native NHWC layout. That same rule also reshapes the `(1, 3, 1, 1)` ImageNet mean/std buffers to `(1, 1, 1, 3)`. * Optionally cast to `float16`; the default build is `float32`. No weight *values* are altered beyond that optional cast. The port is verified stage by stage against the PyTorch reference — on MLX's CPU backend every stage matches to within float32's own noise floor (ray field within 0.0003°). ## Layout One subdirectory per pretrained variant, each holding `config.json` and `weights.safetensors`: ``` anycalib_dist/ anycalib_edit/ anycalib_gen/ anycalib_pinhole/ ``` The variants differ only in training imagery: `pinhole` (perspective only), `gen` (perspective + distorted), `dist` (distorted + strongly distorted), `edit` (stretched and cropped perspective). ## Usage ```bash anycalib calibrate photo.jpg --cam pinhole --repo mnmly/anycalib-mlx ``` The Swift loader resolves these through the shared Hugging Face cache, so a copy pulled by `huggingface_hub` is reused and vice versa. ## License and attribution Apache 2.0, inherited from upstream. See `LICENSE` and `NOTICE` in this repo. Original work © Javier Tirado-Garín and Javier Civera, I3A, University of Zaragoza. The backbone is DINOv2, © Meta Platforms, Inc., also Apache 2.0. ```bibtex @InProceedings{tirado2025anycalib, author={Javier Tirado-Gar{\'i}n and Javier Civera}, title={{AnyCalib: On-Manifold Learning for Model-Agnostic Single-View Camera Calibration}}, booktitle={ICCV}, year={2025} } ```