xocialize's picture
Upload README.md with huggingface_hub
479a367 verified
|
Raw
History Blame Contribute Delete
2.1 kB
---
library_name: mlx
license: apache-2.0
license_link: https://github.com/piddnad/DDColor/blob/main/LICENSE
base_model: piddnad/DDColor-models
pipeline_tag: image-to-image
tags:
- mlx
- colorization
- image-colorization
- ddcolor
---
# mlx-community/DDColor-modelscope-fp16
[DDColor](https://github.com/piddnad/DDColor) automatic image colorization (ConvNeXt-L backbone,
`ddcolor_modelscope.pth`), converted to **Apple MLX** (`-fp16`) for Apple-Silicon inference via the
[`mlx-ddcolor-swift`](https://github.com/xocialize/mlx-ddcolor-swift) Swift package.
Best general tier. The recommended default β€” strongest on archival / multi-object scenes.
A from-scratch MLX-Swift architecture port (no MLX donor) of DDColor: ConvNeXt encoder β†’ quasi-UNet
decoder β†’ DETR-style multi-scale color decoder (100 color queries) β†’ predicts the **ab** chroma
channels, recombined with the source **L** (luminance). Grayscale / desaturated image in β†’ colorized
image at the same resolution out.
## Use with mlx-ddcolor-swift (Swift / MLX)
```swift
// Package.swift β†’ .package(url: "https://github.com/xocialize/mlx-ddcolor-swift", from: "0.1.0")
import DDColor
let colorizer = try DDColorColorizer.fromPretrained(
weightsPath, // model.safetensors from this repo
config: DDColorConfig(tier: .large), // .tiny for paper-tiny
dtype: .float16)
let colorized: CGImage = colorizer(sourceCGImage) // grayscale β†’ color, source resolution
```
Or as an MLXEngine `imageColorize` ModelPackage (`MLXDDColor.DDColorPackage`), which resolves this repo
automatically via the Hub.
## Parity
Architecture parity-locked against the PyTorch oracle (piddnad/DDColor) on the CPU stream, fp32:
**max_abs ≀ 1.5e-6** (large) / **3.3e-6** (tiny) on the model's ab output. The cv2-exact LAB pre/post
pipeline matches the reference `ColorizationPipeline` to **~9e-4 mean** BGR error. This `-fp16` build is
visually identical to fp32 (**cosine 1.000000**, mean 0.04/255 on colorized output).
Weights: Apache-2.0 (piddnad/DDColor). Port code: MIT.