An attempt to colorize my old photos
Among the countless architectural alternatives, we will design our own solution and train it using our own dataset. We will focus natural images, like those in the DIV2K dataset.
We use two approaches for the colorization task:
- A variational approach (see this): It consists of minimizing an energy functional with two terms, a smoothing term that diffuses colors across objects and a fidelity term that preserves user-provided color hints, solved via Euler-Lagrange PDEs.
![]() |
![]() |
- A Deep Learning aproach (see this): It uses a conditional GAN with U-Net generator and patch discriminator. The model combines adversarial loss (for realism), Huber loss (for color accuracy) and VGG loss (for perceptual integrity), trained in Lab space.
Ground Truth | Colorization |
---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
If you want to fork my project and explore new or existing techniques yourself, simply create a virtual environment and install the necessary dependencies as follows:
1. Clone the project and create a virtual environment
git clone https://github.com/agarnung/image-colorization-exploration.git
cd image-colorization-exploration
python3 -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
2. Install the mask creation application
cd colorMaskerApp && pip install -e .
3. Run the application from anywhere (inside the venv) with the grayscale image you want to colorize
colormaskerapp --input "path/to/grayscale.png" --output "path/to/result/mask.png"
Please refer to the references cited in both methods's README (variational and DL).