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

One forward pass, several plausible colorizations

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

pip install git+https://github.com/AdelZakirov/ColorMF.git
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 (b-d, b-d-star) or 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 ↓ FDCLIP ↓ 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 FDCLIP.

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. Code: MIT (GitHub). The -d models need DINOv3, which has its own license.

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

Dataset used to train AdelZakirov/ColorMF