Instructions to use mnmly/anycalib-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mnmly/anycalib-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir anycalib-mlx mnmly/anycalib-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: javrtg/AnyCalib
|
| 4 |
+
tags:
|
| 5 |
+
- mlx
|
| 6 |
+
- camera-calibration
|
| 7 |
+
- swift
|
| 8 |
+
library_name: mlx
|
| 9 |
+
pipeline_tag: image-feature-extraction
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# AnyCalib — MLX weights
|
| 13 |
+
|
| 14 |
+
Converted weights for [mlx-swift-AnyCalib](https://github.com/mnmly/mlx-swift-AnyCalib), a Swift/MLX port of
|
| 15 |
+
[AnyCalib](https://github.com/javrtg/AnyCalib) (Tirado-Garín & Civera, ICCV 2025):
|
| 16 |
+
single-view camera calibration with a camera model chosen after the network runs.
|
| 17 |
+
|
| 18 |
+
These are **not** new weights. They are the official AnyCalib checkpoints in a
|
| 19 |
+
different container.
|
| 20 |
+
|
| 21 |
+
## What was changed
|
| 22 |
+
|
| 23 |
+
* Repacked from PyTorch `.pt` into `safetensors`.
|
| 24 |
+
* Convolution tensors transposed `(out, in, kH, kW) → (out, kH, kW, in)` for MLX's
|
| 25 |
+
native NHWC layout. That same rule also reshapes the `(1, 3, 1, 1)` ImageNet
|
| 26 |
+
mean/std buffers to `(1, 1, 1, 3)`.
|
| 27 |
+
* Optionally cast to `float16`; the default build is `float32`.
|
| 28 |
+
|
| 29 |
+
No weight *values* are altered beyond that optional cast. The port is verified
|
| 30 |
+
stage by stage against the PyTorch reference — on MLX's CPU backend every stage
|
| 31 |
+
matches to within float32's own noise floor (ray field within 0.0003°).
|
| 32 |
+
|
| 33 |
+
## Layout
|
| 34 |
+
|
| 35 |
+
One subdirectory per pretrained variant, each holding `config.json` and
|
| 36 |
+
`weights.safetensors`:
|
| 37 |
+
|
| 38 |
+
```
|
| 39 |
+
anycalib_dist/
|
| 40 |
+
anycalib_edit/
|
| 41 |
+
anycalib_gen/
|
| 42 |
+
anycalib_pinhole/
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
The variants differ only in training imagery: `pinhole` (perspective only),
|
| 46 |
+
`gen` (perspective + distorted), `dist` (distorted + strongly distorted),
|
| 47 |
+
`edit` (stretched and cropped perspective).
|
| 48 |
+
|
| 49 |
+
## Usage
|
| 50 |
+
|
| 51 |
+
```bash
|
| 52 |
+
anycalib calibrate photo.jpg --cam pinhole --repo mnmly/anycalib-mlx
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
The Swift loader resolves these through the shared Hugging Face cache, so a copy
|
| 56 |
+
pulled by `huggingface_hub` is reused and vice versa.
|
| 57 |
+
|
| 58 |
+
## License and attribution
|
| 59 |
+
|
| 60 |
+
Apache 2.0, inherited from upstream. See `LICENSE` and `NOTICE` in this repo.
|
| 61 |
+
|
| 62 |
+
Original work © Javier Tirado-Garín and Javier Civera, I3A, University of
|
| 63 |
+
Zaragoza. The backbone is DINOv2, © Meta Platforms, Inc., also Apache 2.0.
|
| 64 |
+
|
| 65 |
+
```bibtex
|
| 66 |
+
@InProceedings{tirado2025anycalib,
|
| 67 |
+
author={Javier Tirado-Gar{\'i}n and Javier Civera},
|
| 68 |
+
title={{AnyCalib: On-Manifold Learning for Model-Agnostic Single-View Camera Calibration}},
|
| 69 |
+
booktitle={ICCV},
|
| 70 |
+
year={2025}
|
| 71 |
+
}
|
| 72 |
+
```
|