Skip to content

disha2553/colorization-gans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Landscape Image Colorization using GANs

Project Overview

This project implements a Generative Adversarial Network (GAN) to automatically colorize grayscale landscape images. The model learns to generate visually pleasing color versions of black-and-white images using paired grayscale and color training data.


Dataset


Technical Details

Model Architecture

  • Generator: A convolutional encoder-decoder network with skip connections (similar to U-Net) that takes a grayscale image as input and outputs a 3-channel RGB color image.
  • Discriminator: A convolutional PatchGAN classifier that distinguishes between real color images and those generated by the generator.
  • Loss Functions:
    • GAN loss encouraging the generator to produce realistic images.
    • L1 loss (mean absolute error) to enforce pixel-level similarity between generated and real images.

Training Setup

  • Framework: TensorFlow 2.x and Keras API
  • Optimizers: Adam with learning rate 2e-4 and beta1=0.5 for both generator and discriminator
  • Batch Size: 32
  • Number of Epochs: 20 (modifiable)
  • Image preprocessing includes normalization to [0,1].

How to Run This Project

Prerequisites

  • You need a Kaggle account to download the dataset using the Kaggle API.
  • Download your Kaggle API key (kaggle.json) from your Kaggle account:
    1. Go to Kaggle Account
    2. Scroll down to "API" section and click Create New API Token
    3. This will download kaggle.json file to your computer.

Steps to Run on Google Colab (Recommended)

  1. Upload kaggle.json file to your Colab environment.
  2. Set up Kaggle API and download the dataset
  3. Run your training and evaluation scripts as per the notebook or script provided.

GPU Support on Colab

  • Google Colab provides free access to GPU runtime (Tesla T4/P100/K80) which significantly speeds up training deep learning models.
  • To enable GPU:
    • Go to Runtime > Change runtime type in Colab
    • Select GPU as hardware accelerator
  • Note:
    • GPU sessions are limited to approximately 12 hours and may disconnect after periods of inactivity.
    • You can restart the runtime and run your notebook again; however, you may need to re-download datasets and reload/save your model.

Runtime Notes

  • Colab’s runtime environment is ephemeral — files and models stored in /content will be deleted after disconnect or idle timeout.
  • To preserve your trained models and data, consider mounting your Google Drive and saving/loading from there.
  • Each time you restart, your environment (dataset, models) needs to be set up again (downloaded or loaded from Drive).

About

This project focuses on the task of automatic image colorization using Conditional Generative Adversarial Networks (cGANs). The goal is to generate realistic color versions of black and white images by learning patterns and color distributions from a dataset of paired grayscale and color images.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors