← Open Source
ErwannMillon

Color-diffusion

A diffusion model to colorize black and white images.

Model DevelopmentDomain-specific trainingPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
769
Stars
31
Forks
+-2
This week
1
Contributors
Created 2022-10-27 · Updated 2026-10-13 · #14012 today
Top developers
ErwannMillon

ErwannMillon/Color-diffusion is ranked 14,012 with 769 stars.

Same-category comparison

ErwannMillon/Color-diffusion is ranked 14,012 among these 8 peers; UM-ARM-Lab/pytorch_mppi is ranked 14,014.

Same-category comparison
NameRankMetrics
FlyMyAI/flymyai-lora-trainer14,001
Language:
Python
Stars:
770
Forks:
71
Description:
Qwen-Image text to image lora trainer.
JuliaPOMDP/POMDPs.jl14,002
Language:
Julia
Stars:
770
Forks:
106
Description:
MDPs and POMDPs in Julia - An interface for defining, solving, and simulating fully and partially observable Markov decision processes on discrete and continuous spaces.
facebookresearch/flores14,005
Language:
Python
Stars:
770
Forks:
136
Description:
Facebook Low Resource (FLoRes) MT Benchmark.
mila-iqia/babyai14,007
Language:
Python
Stars:
770
Forks:
152
Description:
BabyAI platform. A testbed for training agents to understand and execute language commands.
UM-ARM-Lab/pytorch_mppi14,014
Language:
Python
Stars:
769
Forks:
75
Description:
Model Predictive Path Integral (MPPI) with approximate dynamics implemented in pytorch.
awni/speech14,016
Language:
Python
Stars:
769
Forks:
178
Description:
A PyTorch Implementation of End-to-End Models for Speech-to-Text.
facebookresearch/multiface14,018
Language:
Python
Stars:
769
Forks:
53
Description:
Hosts the Multiface dataset, which is a multi-view dataset of multiple identities performing a sequence of facial expressions.
qgallouedec/panda-gym14,020
Language:
Python
Stars:
769
Forks:
135
Description:
Set of robotic environments based on PyBullet physics engine and gymnasium.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryDomain-specific training
KeywordsComputer vision, Datasets, Image production
Stars769
Forks31
Contributors1
Created date2022-10-27
Updated date2026-10-13
Stars in 1 day0
Stars in 7 days-2
Rank14,012
Previous rank13,888
Rank change-124
7-day stars rank18,431
Previous 7-day stars rank18,365
7-day stars rank change-66
Total stars rank13,783
Previous total stars rank13,761
Total stars rank change-22
README summary

Color Diffusion Using diffusion models to colorize black and white images. Overview This project is a simple example of how we can use diffusion models to colorize black and white images. This implementation uses the LAB color space, a 3 channel alternative to the RGB color space. The "L" (Lightness) channel in this space is equivalent to a greyscale image: it represents the luminous intensity of each pixel. The two other channels are used to represent the color of each

pixel. To train the model, we first load color images and convert them to LAB. Then, we add noise only to the color channels, keeping the L channel constant. The model gets this channel "for free" because it doesn't need to learn how to predict the greyscale image: it is always known at train and test time. Forward Diffusion Process *Note that we actually don't need to go through all of the steps of the diffusion process to get to

timestep t. Our forward diffusion process is non-Markovian, but the entire diffusion process is shown for illustrative purposes* The model is a UNet that takes a 3 channel LAB input (the ground-truth greyscale channel concatenated with noised AB channels) and outputs a 2 channel prediction of the color noise. Forward diffusion and denoising at train time In addition to receiving the greyscale channel as input, the UNet is also conditioned on features extracted from the greyscale channel. Intermediate

feature maps from an encoder (implemented as the first half of a UNet) are concatenated with the features of the main denoising UNet throughout the downsampling stage of the forward pass. Future Work / Ideas This was just a quick proof of concept to satisfy my curiosity and get a feel for training diffusion models from scratch, so the results are very basic. There are many ways this project could be improved, such as: Using pretrained face recognition networks like ArcFace

or FaceNet as feature extractors to get the conditioning features Implementing cross attention on the embeddings Pretraining the greyscale feature extractor as the encoder stage of a greyscale autoencoder References A lot of code for the dataset and LAB color operations was adapted from moein-sharitania's colorization project, which used Conditional GANs I implemented optional dynamic thresholding as in Assembly AI's Minimagen project (the Assembly AI blog posts are excellent for getting a deep understanding of the maths and concepts

behind diffusion models) The UNet architecture was adapted from denoising-diffusion-pytorch Usage Run to download the CelebA dataset and extract it Use inference.

Frequently asked questions

How many stars and forks are recorded?

ErwannMillon/Color-diffusion has 769 stars and 31 forks.

What is the repository rank?

ErwannMillon/Color-diffusion is ranked 14,012.

What language and category are recorded?

ErwannMillon/Color-diffusion has 769 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

ErwannMillon/Color-diffusion is compared with UM-ARM-Lab/pytorch_mppi, ranked 14,014 with 769 stars.

README

Color Diffusion

Using diffusion models to colorize black and white images.

Overview

This project is a simple example of how we can use diffusion models to colorize black and white images.

This implementation uses the LAB color space, a 3 channel alternative to the RGB color space. The "L" (Lightness) channel in this space is equivalent to a greyscale image: it represents the luminous intensity of each pixel. The two other channels are used to represent the color of each pixel.

To train the model, we first load color images and convert them to LAB. Then, we add noise only to the color channels, keeping the L channel constant. The model gets this channel "for free" because it doesn't need to learn how to predict the greyscale image: it is always known at train and test time.

Forward Diffusion Process

Note that we actually don't need to go through all of the steps of the diffusion process to get to timestep t. Our forward diffusion process is non-Markovian, but the entire diffusion process is shown for illustrative purposes

The model is a UNet that takes a 3 channel LAB input (the ground-truth greyscale channel concatenated with noised AB channels) and outputs a 2 channel prediction of the color noise.

Forward diffusion and denoising at train time

In addition to receiving the greyscale channel as input, the UNet is also conditioned on features extracted from the greyscale channel. Intermediate feature maps from an encoder (implemented as the first half of a UNet) are concatenated with the features of the main denoising UNet throughout the downsampling stage of the forward pass.

Future Work / Ideas

This was just a quick proof of concept to satisfy my curiosity and get a feel for training diffusion models from scratch, so the results are very basic. There are many ways this project could be improved, such as:

  • Using pretrained face recognition networks like ArcFace or FaceNet as feature extractors to get the conditioning features
  • Implementing cross attention on the embeddings
  • Pretraining the greyscale feature extractor as the encoder stage of a greyscale autoencoder

References

A lot of code for the dataset and LAB color operations was adapted from moein-sharitania's colorization project, which used Conditional GANs https://github.com/moein-shariatnia/Deep-Learning

I implemented optional dynamic thresholding as in Assembly AI's Minimagen project (the Assembly AI blog posts are excellent for getting a deep understanding of the maths and concepts behind diffusion models) https://www.assemblyai.com/blog/minimagen-build-your-own-imagen-text-to-image-model/

The UNet architecture was adapted from denoising-diffusion-pytorch https://github.com/lucidrains/denoising-diffusion-pytorch

Usage

Run bash download_dataset.sh to download the CelebA dataset and extract it

Use inference.py for command line colorization. python inference.py --image-path --checkpoint --output

Or run python app.py for a simple gradio web UI

Nearby in the ranking
Similar items