Photo-colorizing GAN is a deep learning model designed to add color to black-and-white photos, providing a vivid and realistic resul
This is my first project involving machine learning, where I decided to train a GAN for photo colorization. The model architecture and the datasets used for training can be found in the Model Specification section. To enhance the user experience, I’ve integrated some front-end features as well.
The application is divided into two main components:
- A Java Spring server, which handles the core of the web page.
- A Python Flask application, responsible for processing images through the GAN.
Feel free to try it out and add vibrant colors to your old black-and-white photos!
| Section | Description |
|---|---|
| Installation using Gradle | Instructions for installing the project using Gradle |
| Installation using Docker | Instructions for installing the project using Docker |
| Training Datasets | Information about the datasets used for training the GAN model |
| Model Specification | A detailed breakdown of the model's architecture and training process |
| Examples of Colorizing | Sample images demonstrating the results of colorizing black-and-white photos |
First of all install docker (https://www.docker.com/) and gradle (https://gradle.org/) on your machine. Then run your docker-engine.
-
Clone the Repository: Open a terminal and clone the repository:
git clone https://github.com/AndreRab/Photo-colorizing-GAN.git
Don't forget to clone the model with the help of Git LFS
-
Navigate to the Project Directory: Change your directory to the project folder:
cd Photo-colorizing-GAN -
Build the Project: Use Docker-compose to build the project:
docker-compose up --build -d
-
Access the Application: Open your web browser and navigate to http://localhost:8082 to access the application.
First of all install docker (https://www.docker.com/) and gradle (https://gradle.org/) on your machine. Then run your docker-engine.
-
Clone the Repository: Open a terminal and clone the repository:
git clone https://github.com/AndreRab/Photo-colorizing-GAN.git
Don't forget to clone the model with the help of Git LFS
-
Navigate to the Project Directory: Change your directory to the project folder:
cd Photo-colorizing-GAN -
Build the Project: Use Gradle to build the project:
./gradlew deploy
-
Access the Application: Open your web browser and navigate to http://localhost:8082 to access the application.
For training datasets, I used the following sources: Image Colorization Dataset and ImageNet Mini. I converted all images to grayscale mode and used them as input for my model, while the original images served as the expected output.
Like all GANs, my GAN consists of a generator and a discriminator. You can see the architecture of my generator in the picture. Basically, I used a CNN with skip connections because I think that the best idea for colorizing a picture is to reference the original image and its features.

At the beginning of my training, the discriminator was really good while the generator wasn’t. That's why I trained the discriminator only for every 10 batches. When the results of my CNN started to be as good as the original pictures, my discriminator couldn't recognize which images were real and which were colorized, so I decided to focus on training only my generator.
This GAN resizes every image to 128x128 pixels, which is why it can colorize pretty good pictures at that size. However, if you provide a larger picture, the results may not be very good.
Here are examples of colorizing for the pictures that my model did not see during training.
