Let the computer fill in colors of black and white images…!!!

Let the computer fill in colors of black and white images…!!!

Today, we will talk about that how can we use computer vision techniques to color black and white images. Woohoo!!! DeOldify is a colorizer made by Jason Antic with fastai.

Coloring the black and white images with neural networks traditionally produce dull colors. So such limitations were minimized with the use of GANs. The use of GAN pushes the model to use more vivid colors, even if they are not correct ones, leading to more realistic predictions.

I have used the deoldify repository. Training a GANs is very hard. So I have used the pre-trained model from the repository. We have to feed the black and white image to the model and the model will give the colored image. Tadaaa!!!

To have easily hands-on, I have created the GUI in which you have to upload the image from your files. GUI is developed in the flask. You have to clone the repository in your local machine. Make sure to install all the required files. You can simply install all the libraries by running the command.

pip install -r requirements.txt

After that, simply you have to open the command terminal redirect to the project directory. Type the command.

export FLASK_APP=main.py

If you are window user, type set instead of export. Then run the following command.

flask run

Demo of app running on my machine

This command will run the flask app by creating a local server in your machine. After that, the app will open in your web browser and you are good to go to color the images. Upload image in-app, Remember if your machine has GPU then it won’t take a time to generate the results. As my machine doesn’t have GPU so higher resolution black and white image took around 20 minutes to generate results. If you have GPU then it will generate the results in a minute.