GitXplorerGitXplorer
b

Image-Recolorization

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
00672a4bf6eb64a74b02261d7f544b876edf22d1

update GAN code

bbhavitvyamalik committed 3 years ago
Unverified
e612acba5acb34956d3fcce07e6642718bacb525

update results

bbhavitvyamalik committed 3 years ago
Unverified
b6297f1e09528c94c7cfe718ba7604f3f3494560

update captions

bbhavitvyamalik committed 3 years ago
Unverified
2363d2abfae060b4824e14d65af28f814a4e0653

update captions

bbhavitvyamalik committed 3 years ago
Unverified
2bd7da82fb5ffe53fe61a85d993c81bb91082a9b

update captions

bbhavitvyamalik committed 3 years ago
Unverified
4fa6850858cebc77c52f8182a2382aa8647a7b54

add spongebob results

bbhavitvyamalik committed 3 years ago

README

The README file for this repository.

Image Colorization using GANs

Introduction

This repository is the implementation of Conditional GANs, to convert images from greyscale to RGB. It was done as part of Bachelor's Thesis project titled Recolorisation of Images using Deep Neural Networks by Athmay Nambiar and Bhavitvya Malik, in the department of Instrumentation and Control Engineering, Netaji Subhas Institute of Technology, University of Delhi, New Delhi, in partial fulfilment of requirements for the award of the degree of Bachelor of Engineering in Instrumentation and Control Engineering, University of Delhi in the academic year 2018-2019.

The input of the network is 1-channel greyscale image (specifically, the 'L' channel of LAB color space), and the Generator will create a 3-channel colorful version of the input image.

The generator has an encoder-decoder architecture; the discriminator is just one encoder plus fully-connected layers which gives one-class output. Skip-connection is applied in generator (U-Net). For 224x224 images, the architecture of generator is shown below.

Each block contains Conv(transpose Conv) layer, BatchNormalization and Leaky ReLU. Final activation function for generator is tanh; for discriminator its sigmoid. Input images are normalized before feeding into the network.

Overall, the objective function for Conditional GAN is:

for generator, a regularization term is added using L1 distance:

where the coefficient lambda 100 is used. The model is optimized using Adam optimizer with minor changes.

The model is universal for all kinds of colorful image dataset. Three datasets are experimented here: OxFlower, and SpongeBob

  • OxFlower: Flower dataset generated by Oxford VGG group. It consists of 17 flower categories with 80 images for each class.

  • SpongeBob SquarePants: The famous American animated TV series. Images from one episode are extracted and processed.

Instruction

Prepare Dataset

OxFlower

Download the dataset from VGG webpage. Make sure jpg/ and datasplits.mat are in the same directory.

SpongeBob SquarePants

Download from Google Drive.

Training (and validation)

  • Example command to train Spongebob dataset:

python gan_main.py my_path --dataset bob --batch_size 32 --lr 1e-3 --num_epoch 50 --lamb 100 -s --gpu 0

Replace my_path by the root path of Spongebob dataset.

Image samples created during validation will be saved in img/; and the model will be saved in model/ if -s option is used.

Results

Due to paucity of computation, we could only train upto 100 epochs. Below are the attached outputs for Flowers and Spongebob datasets (each set contains 3 images Left- Input image in greyscale, Middle- Original image, Right- Output image):

OxFlower Dataset

Left- Results at 0 epoch, Middle- Results at 50 epochs, Right- Results at 100 epochs

SpongeBob Dataset

Left- Results at 0 epoch, Middle- Results at 50 epochs, Right- Results at 100 epochs