|
Download README.md from AdelZakirov/ColorMF: direct link, hf CLI and curl.
- Browser
- Download file 5.08 kB
-
https://huggingface.co/AdelZakirov/ColorMF/resolve/main/README.md
- Command line
-
hf download hf://AdelZakirov/ColorMF/README.md
-
curl -L -o README.md https://huggingface.co/AdelZakirov/ColorMF/resolve/main/README.md
5.08 kB
| license: cc-by-nc-4.0 | |
| pipeline_tag: image-to-image | |
| library_name: pytorch | |
| datasets: | |
| - ILSVRC/imagenet-1k | |
| tags: | |
| - image-colorization | |
| - colorization | |
| - one-step-generation | |
| - mean-flow | |
| # ColorMF | |
| ColorMF colorizes gray images and gives a different plausible colorization for each noise seed, | |
| **in one forward pass per sample**. It is a conditional pixel mean-flow transformer that maps the | |
| CIELAB lightness and Gaussian noise to the `a*b*` chroma channels. The generator was trained from | |
| scratch on ImageNet-1k at 256×256. The `-d` models also read frozen DINOv3 features of the gray | |
| image. | |
| Code, training and evaluation: **[github.com/AdelZakirov/ColorMF](https://github.com/AdelZakirov/ColorMF)** | |
|  | |
| *One forward pass, several plausible colorizations (selected examples). Left: ImageNet validation | |
| images and three noise seeds of ColorMF-B+D (`ω = 2`), compared with DDColor, which always gives | |
| the same answer. Right: genuine black-and-white press photographs from 1940 and earlier | |
| (Finna-JOKA, Finnish Heritage Agency, CC BY 4.0), for which no ground truth exists, and one sample | |
| of ColorMF-B+D★.* | |
| ## Usage | |
| ```bash | |
| pip install git+https://github.com/AdelZakirov/ColorMF.git | |
| ``` | |
| ```python | |
| from colormf import ColorMF | |
| model = ColorMF.from_pretrained("b-d-star") # any folder name of this repository | |
| images = model.colorize("photo.jpg", num_samples=3) # PIL images at the photo's full size | |
| for seed, image in enumerate(images): | |
| image.save(f"colorized_{seed}.png") | |
| ``` | |
| Or from the command line: `colormf photo.jpg --samples 3 --output colorized/`. | |
| The models `b-d`, `l-d` and `b-d-star` load the DINOv3 encoder from the Hub, where it is | |
| distributed under Meta's DINOv3 license. Before the first use, accept the license on the page of | |
| [facebook/dinov3-vitb16-pretrain-lvd1689m](https://huggingface.co/facebook/dinov3-vitb16-pretrain-lvd1689m) | |
| (`b-d`, `b-d-star`) or | |
| [facebook/dinov3-vitl16-pretrain-lvd1689m](https://huggingface.co/facebook/dinov3-vitl16-pretrain-lvd1689m) | |
| (`l-d`), and log in with `hf auth login`. | |
| ## Models | |
| Each folder holds `model.safetensors` (float32) and `config.json` (architecture and the default | |
| sampling settings). The metrics are on ImageNet val images 1–5000 (center crop, 256×256), first | |
| seed, guidance `ω = 2`. Diversity is the LPIPS between two seeds, and CF is the colorfulness | |
| (38.5 for the ground truth). Time is per image on one RTX 4090. | |
| | folder | model | inference parameters | encoder (frozen) | ms | FID ↓ | FD<sub>CLIP</sub> ↓ | LPIPS ↓ | ΔE00 ↓ | CF | diversity | | |
| |---|---|---:|---|---:|---:|---:|---:|---:|---:|---:| | |
| | `tiny` | ColorMF-Tiny | 4M | – | 0.1 | 12.20 | 13.82 | 0.208 | 13.18 | 28.3 | 0.179 | | |
| | `s` | ColorMF-S | 22M | – | 0.5 | 8.78 | 9.26 | 0.190 | 12.55 | 30.6 | 0.171 | | |
| | `b` | ColorMF-B | 116M | – | 1.9 | 6.70 | 7.61 | 0.166 | 11.57 | 28.9 | 0.126 | | |
| | `l` | ColorMF-L | 406M | – | 6.0 | 6.38 | 6.75 | 0.160 | 11.33 | 30.7 | 0.104 | | |
| | `b-d` | ColorMF-B+D | 116M | DINOv3 ViT-B/16 | 2.5 | 5.32 | 6.09 | 0.148 | 10.66 | 29.5 | 0.106 | | |
| | `b-d-star` | ColorMF-B+D★ | 116M | DINOv3 ViT-B/16 | 2.5 | 5.14 | 6.28 | 0.149 | 10.30 | 37.0 | 0.088 | | |
| | `l-d` | ColorMF-L+D | 406M | DINOv3 ViT-L/16 | 7.8 | 4.98 | 5.76 | 0.142 | 10.57 | 30.5 | 0.090 | | |
| The safetensors files also hold the auxiliary head that is used only in training, so they are | |
| larger than the inference parameter count suggests. ColorMF-B+D★ is ColorMF-B+D after | |
| Fréchet-distance post-training and distilled autoguidance (weight 2, still one pass). In a blind | |
| pairwise study, people preferred it to DDColor in 55% of 3867 comparisons. ColorMF-L+D has the | |
| best FID and FD<sub>CLIP</sub>. | |
| Weights: the EMA (power-function, 500 kimg) of epoch 500 for the six base models, and the raw | |
| post-trained weights for ColorMF-B+D★. | |
| ## Intended use and limitations | |
| - The models are for research and non-commercial colorization of photographs. They were | |
| trained on ImageNet-1k, whose terms allow non-commercial research use only, so the weights are | |
| released under CC BY-NC 4.0. | |
| - The models work at 256×256. Larger images are resized to 256×256 for the prediction, and the | |
| colors are resized back and combined with the original lightness. Fine colored details smaller | |
| than about 1/256 of the image are therefore not resolved. | |
| - About half of the difference between two seeds is a global tint, and some old photographs get | |
| a strong overall color cast. Draw several seeds and pick one. | |
| - The models' outputs are less saturated than real photos on average (colorfulness 29–31 against | |
| 38.5 for the ground truth), except for ColorMF-B+D★ (37.0). | |
| - The colors are guesses learned from ImageNet statistics, not a reconstruction of the true colors. | |
| Do not use the outputs as evidence of what a historical scene looked like. | |
| ## License | |
| Weights: [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/). Code: MIT | |
| ([GitHub](https://github.com/AdelZakirov/ColorMF)). The `-d` models need DINOv3, which has its own | |
| license. | |