Skip to main content

Simple GAN

This is my attempt to make a wrapper class for a GAN in keras which can be used to abstract the whole architecture process.

Build Status

Overview

alt text

Flow Chart

Setting up a Generative Adversarial Network involves having a discriminator and a generator working in tandem, with the ultimate goal being that the generator can come up with samples that are indistinguishable from valid samples by the discriminator.

alt text

Installation

    pip install adversarials

Example

import numpy as np
from keras.datasets import mnist

from adversarials.core import Log
from adversarials import SimpleGAN

if __name__ == '__main__':
    (X_train, _), (_, _) = mnist.load_data()

    # Rescale -1 to 1
    X_train = (X_train.astype(np.float32) - 127.5) / 127.5
    X_train = np.expand_dims(X_train, axis=3)

    Log.info('X_train.shape = {}'.format(X_train.shape))

    gan = SimpleGAN(save_to_dir="./assets/images",
    save_interval=20)
    gan.train(X_train, epochs=40)

Credits

Contribution

You are very welcome to modify and use them in your own projects.

Please keep a link to the original repository. If you have made a fork with substantial modifications that you feel may be useful, then please open a new issue on GitHub with a link and short description.

License (MIT)

This project is opened under the MIT 2.0 License which allows very broad use for both academic and commercial purposes.

A few of the images used for demonstration purposes may be under copyright. These images are included under the "fair usage" laws.

Metadata

Release files for Adversarials 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Adversarials 1.0.1
File Size Uploaded
Adversarials-1.0.1.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Adversarials 1.0.1
File Interpreter ABI Platform
Adversarials-1.0.1-py3.6.egg Legacy Egg format - - Details

Total release size: 38.5 kB

Release files / Adversarials-1.0.1.tar.gz

Download URL Adversarials-1.0.1.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c18012f5a1e458f9675ef69ab0df89c6fa625f837ef7beca0aa8981cf8a350d9
BLAKE2b-256 checksum
How to use checksums
b597e8a2248a23c0c08176a57693eb5646cc869c652b8b90089a9ef620b63f91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release files / Adversarials-1.0.1-py3.6.egg

Download URL Adversarials-1.0.1-py3.6.egg
Size 28.4 kB
Tags Egg
SHA-256 checksum
How to use checksums
5b30961614808e3f7c8783c90d5e1ec1a541945d729d3cc2db7af20707e1fb31
BLAKE2b-256 checksum
How to use checksums
122bd6efadb7e2a7025231ddda581b917dc49de1ec93e78bab4f589fcd0e0554
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page