Giter VIP home page Giter VIP logo

infocapsgan's Introduction

InfoCapsGAN

Introduction

In this work, I implemented a generative adversarial network based on the theories of capsules, dynamic routing by agreement and mutual information. The GAN is for the most part symmetric, given the similarity in the architecture between the generator and discriminator networks. This project pursues the idea of a path toward unsupervised classification of MNIST digits, achieving an accuracy much close and comparable to baseline classifier trained in a supervised manner; where the two approaches would share the same encoder architecture. However in the unsupervised approach, at least during training stage, the architecture of the trainable infrastructure required is more complex, harder to deal with, due to training stability and an accentuated stochastic behavior.

During training, in order for the discriminator to act as a classifier while capturing the class information from the unlabeled dataset, a random set of class labels, is given as input to the generator, whereas that exact set is used afterwards to penalize the discriminator. Hence the mutual information technique.

Link to a pdf report

Network Architecture

Picture of network architecture

Environment

  • Pytorch 1.0
  • Python 3.6
  • opencv 3.4.1
  • numpy 1.16.2

For a more comprehensive list of required packages you may refer to the file conda_environment.yaml You may also use conda package manager to recreate that specific working environment, with the following command:

conda env create -f conda_environment.yaml

Training

python main.py

Branch: mimic

The current code implementation on the branch master reflects the architecture shown above in this repository. In this branch, however, the network design is not aligned with the final objective of this project, whereas it is in the branch called mimic.

Unlike in the standard architecture as in GAN theory where the input to the generator is randomly sampled, in here the input is the directly correlated to the output of the discriminator. More specifically in this implementation the last capsule layer of discrimination is provided as input to the generator, and currently the class info is not integrated in the network.

Generated Images

Training on unlabeled dataset at Epoch 17:

epoch: 17 epoch: 17

Branch: master

The input to the generator is the concatenation of a one dimensional tensor of continuous code (random normal distribution) of size 32, and a second tensor of discrete code (random hot-encoded class info) of the same size of the number of classes, 10 in the case of MNIST.

Generated Images

Training on unlabeled dataset at Epoch 17:

epoch: 17 epoch: 17

infocapsgan's People

Contributors

aymenx17 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.