Git Product home page Git Product logo

conditional-and-nonconditional-capsule-gans's Introduction

Conditional-and-nonConditional-Capsule-GANs

This is the repository for the code used in writing the paper, 'Generative Adversarial Network Architectures For Image Synthesis Using Capsule Network'. This paper proposes GAN architectures for incorporating Capsule networks for conditional and non-conditional image synthesis. The paper also demonstartes that such an architecture requires significantly lesser training data to generate good quality images in comparison to current architectures for image synthesis (DCGANs with Improved Wasserstein Loss). The paper also demonstrates an increase in the diversity of images generated owing to the robustness of Capsule GANs to small affine transformations.

Architectures

Discriminative Capsule GAN

The following diagram shows the architecture for the Discriminative Capsule GAN that is used for non-conditional image synthesis.

CapsGANArch

The discriminator has been substituted with a Capsule Network in place of a CNN. Also, the loss uses marginal losses described in the paper, "Dynamic Routing Between Capsules" by Sabour et al[1], for Capsule Networks to build a function analogous to the Wasserstein Loss, allowing the architecture to benefit from stable training and faster convergence of critic to optimality.

Split Auxiliary Conditional Capsule GAN

The following diagram shows the architecture for the Split-Auxiliary Conditional Capsule GAN that is used for conditional image synthesis. Alt text

The discriminator uses a split-auxiliary classifier architetcure for conditional image discrimination. The Primary Capsule layer is common to the Primary and Secondary Classifiers. The Primary Classifier classifies the image as real/fake and the Secondary Classifier predicts the most probable class of the image. The losses from these 2 networks is combined to develop a single discriminator loss.

Requirements

  • Python 3.5 or higher
  • Tensorflow 1.4
  • Matplotlib
  • Numpy
  • Imageio
  • Pickle
  • Scikit-Learn
  • Tqdm

Running Instructions

Improved Wasserstein GAN: Go to /Improved Wasserstein GAN/ and run,

python NonCondImprovedWassersteinGAN.py

Non-conditional Discriminative Capsule GAN: Go to /Discriminative Capsule GAN/ and run,

python DiscriminativeCapsGAN.py

Conditional Improved Wasserstein DCGAN Go to /Conditional Improved WDCGAN/ and run,

python ConditionalImprovedWDCGAN.py

Split-Auxiliary Capsule GAN: Go to /Condtional Capsule GAN/ and run,

python ConditionalCapsGAN.py

Results

Non-Conditional Models

Improved Wassersteain GAN

Following are the images generated by training the GAN over MNIST and Fashion-MNIST datasets for 5 epochs

Discriminative Capsule GAN

Following are the images generated by training the GAN over MNIST and Fashion-MNIST datasets for 5 epochs

Nearest Nighbour Distance Comparison

Following is the comparison of the mean nearest neighbour distances of the images generated from the Fashion-MNIST dataset by the Improved Wasserstein GAN and Discriminatative Capsule GAN models. As one can see, despite the images generated by Dicriminative Capsule GAN being more realistic, the mean nearest neighbour distances are consistently higher than that of the images generated by the Improved Wasserstein GAN. This points towards a greater diversity in the images generated by the Discriminative Capsule GAN.

Conditional Models

Improved Wasserstein GAN

Following are the images generated by training the GAN over rotated-MNIST for 100 epochs and flipped-Fashion-MNIST for 50 epochs.

Split-Auxiliary Conditional Capsule GAN

Following are the images generated by training the GAN over rotated-MNIST for 5 epochs and flipped-Fashion-MNIST for 10 epochs.

Nearest Neighbour Distance Comparison

Following is the comparison of the mean nearest neighbour distances of the images generated from the rotated-MNIST dataset by the Conditional Improved Wasserstein GAN (left) over 100 epochs and Split-Auxiliary Conditional Capsule GAN models (right) over 10 epochs. As one can see, despite the images generated by Capsule GAN being more realistic, the mean nearest neighbour distances are consistently higher than that of the images generated by the Improved Wasserstein GAN. This points towards a greater diversity in the images generated by the Capsule GAN.

conditional-and-nonconditional-capsule-gans's People

Contributors

yash-1995-2006 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.