Skip to content

Using Pix2Pix Conditional GAN architecture to colourize image using Places365 dataset and use that model to colourize video clips

License

Notifications You must be signed in to change notification settings

pranavphoenix/Pix2Pix-Image-Video-Colourizing

Repository files navigation

Pix2Pix-Image-Video-Colourizing

Using Pix2Pix Conditional GAN architecture to colourize image using Places365 dataset and use that model to colourize video clips

Dataset

The Places365 dataset contains 1.8 million train images from 365 scene categories for varying sizes. 2000 images were used to train and 500 were used to test the Pix2Pix network. We resized the train and test images to size 256 x 256 x3. Then we created the corresponding grayscale images using a grayscale function which converted the image dimensions to 256 x 256 x1.

Video

We took 2 videos. One was a 5 min clip from ‘The Great Dictator’, a black and white Charlie Chaplin movie and another was a 1 min colored video clip from YouTube which showed different sceneries.

  • The frames of the videos were extracted as jpg at a rate of 20 frames per second using VLC player
  • The extracted images were converted to NumPy arrays and fed to the trained generator to colorize. The color video frames were gray-scaled before being fed to the generator.
  • The output of the generator was combined again using matplotlib to obtain a video and it was analyzed.

Training

We can observe from figure that from epoch 6, the GAN has learned to identify the sky and color it blue. As the training progresses, it learns to color grass and trees green and other outdoor cues.

Top row grayscale image input, middle row is generated image by GAN, last row is actual image

Epoch 1

plot_000001

Epoch 6

plot_000006 (1)

Epoch 11

plot_000011 (1)

Epoch 16

plot_000016 (1)

Epoch 21

plot_000021

Epoch 26

plot_000026

Epoch 31

plot_000031

Epoch 36

plot_000036

Epoch 41

plot_000041

Epoch 46

plot_000046

Figure shows an interesting case we observed while testing the GAN model, even though the input grayscale image or actual image showed a dark silhouette of a house, the model filled in the details it learned from trained by putting a window and door and lightening the image. Even the ground and sky are colored correctly.

Generated Image

image

Actual Image

image

Video Colourizing

Alt Text

The network is trying to colour the field with yellow, and sometimes with green.

About

Using Pix2Pix Conditional GAN architecture to colourize image using Places365 dataset and use that model to colourize video clips

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published