Coder Social home page Coder Social logo

gpn's Introduction

Build Status

GPN

Brief Overview

This repository relates to a research idea about stabilizing of generative neural networks training.

Suggested approach is called Generative Predictive Networks (GPN). It is a combination of two components:

  • Similarly to GANs, there are discriminator and generator;
  • Unlikely to GANs, they are not trained simultaneously — discriminator is trained in a predictive learning setup and then generator is trained.

To the best of the author's knowledge, this approach is novel. Any references to existing literature about the topic are highly appreciated.

The Approach

Screenshot

Above figure can be used for grasping internal terminology of the project.

To start with, original dataset consists of images of equal size. Suppose that such an image is shown in light blue in the above figure.

However, positive examples for discriminator are not taken from the initial dataset. They are fragments sampled from original images. Each such fragment consists of two parts:

  • The first one is called internal part, it is a square of size internal_size * internal_size, and all its pixels are also pixels of the corresponding original image. Example of internal part is marked with a solid red line in the figure.
  • The second one is a frame around internal part. Some of its pixels can be pixels from the original image, and some of its pixels can be pixels from zero padding around the image. Outer border of the frame is represented as dotted red line in the figure. Zero padding is represented as pixels with dotted borders. As for parameters, frame is characterized by the one named frame_size (it is set to 1 in the figure).

Thus, discriminator is trained on images of size fragment_size, where fragment_size = internal_size + 2 * frame_size. Positive examples are sampled from the original dataset. Negative examples have real frames, but altered internal parts. There are several ways to modify internal part:

  • To blur it;
  • To replace it with noise;
  • To replace it with internal part of another fragment.

Real frame is a context of central part, and so the setup of discriminator problem can be likened to predictive learning setup.

Now, go to generator. It is trained to turn random noise into full-size images (not fragments). Generator loss is based on discriminator performance on fragments sampled from generated images. The more discriminator is confident in fake origination of such fragments, the higher the loss is.

Usage

To use the Python package from this repository, build it from sources:

cd your/path
git clone https://github.com/Nikolay-Lysenko/gpn
cd gpn
pip install -r requirements.txt
pip install -e .

To study any settings, go to gpn/config.yml.

The recommended way to use the package is to execute it as a script. To see valid options, run:

python -m gpn -h

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.