• Stars
    star
    486
  • Rank 90,527 (Top 2 %)
  • Language
    Python
  • Created almost 8 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tensorflow implementation of Gated Conditional Pixel Convolutional Neural Network

Image Generation with Gated PixelCNN Decoders

This is a Tensorflow implementation of Conditional Image Generation with PixelCNN Decoders which introduces the Gated PixelCNN model based on PixelCNN architecture originally mentioned in Pixel Recurrent Neural Networks. The model can be conditioned on latent representation of labels or images to generate images accordingly. Images can also be modelled unconditionally. It can also act as a powerful decoder and can replace deconvolution (transposed convolution) in Autoencoders and GANs. A detailed summary of the paper can be found here.

These are some conditioned samples generated by the authors of the paper:

Paper Sample

Architecture

This is the architecture for Gated PixelCNN used in the model:

Gated PCNN

The gating accounts for remembering the context and model more complex interactions, like in LSTM. The network stack on the left is the Vertical stack that takes care of blind spots that occure while convolution due to the masking layer (Refer the Pixel RNN paper to know more about masking). Use of residual connection significantly improves the model performance.

Usage

This implementation consists of the following models based on the Gated PixelCNN architecture:

  • Unconditional image generation:

    python main.py
    

    Sample generated by training MNIST dataset after 70 epochs with a cross-entropy loss of 0.104610:

    Unconditional image

  • Conditional image generation based on class labels:

    python main.py --model=conditional
    

    As mentioned in the paper, conditionally generated images are more visually appealing though the loss difference is almost same. It has a loss of 0.102719 after 40 epochs:

    Conditional image

  • Autoencoder with PixelCNN decoder:

    python main.py --model=autoencoder
    

    The encoder part of the autoencoder has the original architecture as mentioned in Stacked Convolutional Auto-Encoders for Hierarchical Feature Extraction. The representation is encoded into 10d tensor. The image generated after 10 epochs with a loss of 0.115306:

    AE image

To only generate images append the --epochs=0 flag after the command.

To train the any model on CIFAR-10 dataset, add the --data=cifar flag.

Refer main.py for other available flags for hyperparameter tuning.

Training Details

The system was trained on a single AWS p2.xlarge spot instance. The implementation was only done on MNIST dataset. Generation of samples based on CIFAR-10 images took the authors 32 GPUs trained for 60 hours.

To visualize the graph and loss during training, run:

tensorboard --logdir=logs

Loss minimization for the autoencoder model:

Loss

More Repositories

1

Language-Modeling-GatedCNN

Tensorflow implementation of "Language Modeling with Gated Convolutional Networks"
Python
270
star
2

VQA-Keras-Visual-Question-Answering

Visual Question Answering task written in Keras that answers questions about images
Python
154
star
3

Ostrich

E-commerce Rental Platform written in Flask & React
Python
52
star
4

Medical-Diagnosis-Learning

Learning from Discharge Summaries to extract mentioned diagnoses using Hierarchical Attention Model
Jupyter Notebook
34
star
5

BEGAN-pytorch

Implementation of BEGAN in Pytorch and other interpolation experiments
Python
22
star
6

CUDA-Genetic-Algorithm-Travelling-Salesman-Problem

Implementation of Parallel Genetic Algorithm in CUDA to solve TSP (Berlin52)
Cuda
5
star
7

Naive-Bayes-Classifier

PHP
5
star
8

deep-dreamer-web

Web client for Google's deepdream
JavaScript
3
star
9

Recurrent-Entity-Networks-pytorch

Pytorch implementation of "Tracking the World State with Recurrent Entity Networks"
Python
2
star
10

iGoogle-interface

Basic iGoogle layout (widgets)
JavaScript
2
star
11

PyBuddy

This is a simple AI Android App made in Python
Python
2
star
12

Lister

Create and share lists
ApacheConf
1
star
13

Violence-detection-from-audio

Detection of violence from media by analyzing audio streams
MATLAB
1
star
14

Database-Anonymization

Database anonymization techniques : k-anonymity and l-diversity
PHP
1
star
15

Kaggle-Leaf-Classification

My solution to Kaggle's Leaf Classification competition
Jupyter Notebook
1
star
16

Comment-Spam-Classification-in-Reviews

This was a weekend project aiming to remove spams from comments in zomato food reviews. Zomato's comment data was used to train and test the classifier.
Python
1
star