This project addresses the image recolorization problem: adding colors to grayscale images when only limited information (mean intensity of R, G, and B channels) is available.
The solution is based on a U-Net architecture with residual blocks, enhanced by AdaIN conditioning inspired by StyleGAN.
The main idea is to leverage the separation of luminance and chrominance in the Lab color space:
- The L channel (lightness) preserves geometric and intensity information from the grayscale image.
- The ab channels (chrominance) are predicted by the network, responsible for reconstructing realistic colors.
This design reduces the complexity of the learning task, letting the model focus only on colorization.
We use the Oxford Flowers 102 dataset, which contains 102 flower categories with varying shapes and appearances.
To simplify training:
- Images are resized to a lower resolution (128Γ128).
- The dataset is split into grayscale (L) and color components (ab).
- Data augmentation (geometric transformations and noise) increases robustness and reduces overfitting, since the dataset is relatively small.
- Generator returns a tuple:
- Input: (grayscale image, condition vector)
- Target: ab color channels
- Training is done in Lab space.
- For inference: concatenate
L + predicted abβ convert back to RGB.
As a reference, a naive baseline uniformly assigns colors from the provided palette. This model serves as a benchmark to evaluate the networkβs performance.
- U-Net with residual blocks ensures effective feature extraction.
- AdaIN conditioning integrates style information, guiding color prediction.
- Loss objective focuses only on chrominance channels.
- Clone this repository:
git clone https://github.com/FiloSamo/Colorization_OxfordFlowers102.git cd Colorization_OxfordFlowers102 pip install -r requirements.txt jupyter notebook recolorization_project.ipynb
-
Richard Zhang, Phillip Isola, and Alexei A. Efros.
Colorful Image Colorization.
In European Conference on Computer Vision (ECCV), 2016.
[Paper] -
Patricia Vitoria, Lara Raad, and Coloma Ballester.
ChromaGAN: Adversarial Picture Colorization with Semantic Class Distribution.
In IEEE Winter Conference on Applications of Computer Vision (WACV), pp. 2445β2454, 2020.
[Paper] -
Andrea Asperti.
Deep Learning β Lecture Slides.
University of Bologna, Academic Year 2024/2025.
Filippo Samorì Project developed as part of academic work in deep learning.
- The network produces colorized images that are visually closer to the ground truth compared to the baseline.
- Results are evaluated qualitatively by comparing reconstructed images with real colored ones.
- Flowers with distinctive shapes and strong chromatic cues are recolored more faithfully.

