File size: 2,095 Bytes
479a367
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
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.