Giter Club home page Giter Club logo

gan_01's Introduction

My first GAN implementation

Here we implement a basic GAN implementation that aims to create fake number images based on the MNIST dataset.

GANs belong to the set of algorithms named generative models. These algorithms belong to the field of unsupervised learning, a sub-set of Machine Learning which aims to study algorithms that learn the underlying structure of given data, without specifying a target value.

Tips

Losses

Discriminator loss

max [ log(D(real)) + log(1 - D(G(z)) ]

Generator loss

min [ log(1 - D(G(z))) ] <-> max [ log(D(G(z))) ]

In these losses the logarithm of the probability is used in the loss function instead of raw probabilities, since using a log loss heavily penalises classifiers that are confident about an incorrect classification.

Droput layers

It is used to prevent over-fitting.

During training, randomly zeroes some of the elements of the input tensor with probability p using samples from a Bernoulli distribution. Each channel will be zeroed out independently on every forward call.

This has proven to be an effective technique for regularization and preventing the co-adaptation of neurons as described in the paper Improving neural networks by preventing co-adaptation of feature detectors .

loss.backward()

The backward pass consists of computing the local gradients and dLoss/dWeights using the chain rule to backpropagate the error.

Load Tensorboard in google colab

# Load the TensorBoard notebook extension.
%load_ext tensorboard
# Opens tensorboard with "runs" as the directory where the images are stored.
%tensorboard --logdir runs

About explicitly setting the gradients to zero before starting backpropagation.

https://stackoverflow.com/questions/48001598/why-do-we-need-to-call-zero-grad-in-pytorch

GAN hacks

https://github.com/soumith/ganhacks

Questions

  • 2 backward passes for discriminator with fake and real loss or combination of fake an real loss in 1 backward pass?

gan_01's People

Contributors

maxibove13 avatar

Stargazers

Mauricio Vanzulli 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.