# DDColor
DDColor predicts image color from luminance.
Tasks: Restoration. Install: pip install libreyolo.
Verified against LibreYOLO v1.6.0.

## Install

```bash
pip install "libreyolo"
```

## Predict

**Python**

```python
from libreyolo import LibreYOLO, SAMPLE_IMAGE

model = LibreYOLO("LibreDDColort-restore.pt", device="cpu")
result = model(SAMPLE_IMAGE)
result.restored.save("colorized.png")
```

The tiny and large variants return restored color images. Validation uses paired image data. Training and export are not supported.


## Validate

**Python**

```python
from libreyolo import LibreYOLO

model = LibreYOLO("LibreDDColort-restore.pt", device="cpu")
# Restore dataset YAML pairing grayscale inputs/val with color targets/val by file stem
metrics = model.val(data="path/to/your/restore.yaml", workers=0)
print(metrics)
```

Use the dataset format for this task. [Validation](/docs/train/validation) explains the dataset requirements and returned metrics.

## Checkpoints

| File | Input (px) | Task | Weights license |
| --- | --- | --- | --- |
| `LibreDDColort-restore.pt` |  | Restoration | apache-2.0 |
| `LibreDDColorl-restore.pt` |  | Restoration | apache-2.0 |

## Licensing

Check the license on the Hugging Face repository of the specific weights you download. That repository is authoritative and licenses are not always uniform across a family. This is a description of the licenses involved, not legal advice.

- Original work: DDColor, DDColor authors
- Upstream license: Apache-2.0
- Upstream source: https://github.com/piddnad/DDColor
- LibreYOLO code: MIT
- Weights: Apache-2.0, republished at https://huggingface.co/LibreYOLO
- Interpretation: The publisher declares Apache-2.0 for the mirrored artifacts.

## Citation

```bibtex
@inproceedings{kang2023ddcolor,
  title={DDColor: Towards Photo-Realistic Image Colorization via Dual Decoders},
  author={Kang, Xiaoyang and Yang, Tao and Ouyang, Wenqi and Ren, Peiran and Li, Lingzhi and Xie, Xuansong},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={328--338},
  year={2023}
}
```

Copied from https://raw.githubusercontent.com/piddnad/DDColor/master/README.md


## DDColor architecture

- t: [SVG](/diagrams/models/ddcolor/t-restore.svg), [interactive diagram](/diagrams/models/ddcolor/t-restore.html)
- l: [SVG](/diagrams/models/ddcolor/l-restore.svg), [interactive diagram](/diagrams/models/ddcolor/l-restore.html)
- Shared T/L topology: [SVG](/diagrams/models/ddcolor/family.svg), [interactive diagram](/diagrams/models/ddcolor/family.html)
