Giter Club home page Giter Club logo

ac-gan's Introduction

AC-GAN ( Auxiliary Classifier GAN )

A tensorflow implementation of Augustus Odena (at Google Brains) et al's "Conditional Image Synthesis With Auxiliary Classifier GANs" paper ) I've already implemented this kind of GAN structure last Sep. (See : Supervised InfoGAN tensorflow implementation) I said that I had added supervised loss(in this paper auxiliary classifier) to InfoGAN structure to achieve the consistency of generated categories and training stability. And the result was promising. It helped the model to generate consistent categories and to converge fast compared to InfoGAN. The paper which propose the same architecture by researchers at Google Brains was published last Oct.
They've provided many results from diverse data set and tried to generate big images and explained why this architecture works plausibly. I think this paper is awesome. But they did not provide source codes and I re-introduce this codes.

AC-GAN architecture( from the paper. )

Dependencies

  1. tensorflow >= rc0.11
  2. sugartensor >= 0.0.1.7

Training the network

Execute


python train.py

to train the network. You can see the result ckpt files and log files in the 'asset/train' directory. Launch tensorboard --logdir asset/train/log to monitor training process.

Generating image

Execute


python generate.py

to generate sample image. The 'sample.png' file will be generated in the 'asset/train' directory.

Generated image sample

This image was generated by AC-GAN network.

And this image was generated with categorical auxiliary classifier.

And this image was generated by continuous auxiliary classifier. You can see the rotation change along the X axis and the thickness change along the Y axis.

The following image is the loss chart in the training process. This looks more stable than my original GAN implementation.

Other resources

  1. Original GAN tensorflow implementation
  2. EBGAN tensorflow implementation
  3. Supervised InfoGAN tensorflow implementation
  4. SRGAN tensorflow implementation
  5. Timeseries gan tensorflow implementation

Authors

Namju Kim ([email protected]) at Jamonglabs Co., Ltd.

ac-gan's People

Contributors

buriburisuri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ac-gan's Issues

Training problem!

Thank for sharing this code, but when I trying to train this model with python train.py, the following error occurs:

Traceback (most recent call last):
File "train.py", line 86, in
y_disc = tf.concat(0, [y, y * 0])
File "/home/hao/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1062, in concat
).assert_is_compatible_with(tensor_shape.scalar())
File "/home/hao/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/tensor_shape.py", line 737, in assert_is_compatible_with
raise ValueError("Shapes %s and %s are incompatible" % (self, other))
ValueError: Shapes (2, 32) and () are incompatible

generate problem

Traceback (most recent call last):
File "generate.py", line 98, in
fig_name='fake.png')
File "generate.py", line 73, in run_generator
saver.restore(sess, tf.train.latest_checkpoint('asset/train'))
File "/home/xujian/.local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1439, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/home/xujian/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 767, in run
run_metadata_ptr)
File "/home/xujian/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 965, in _run
feed_dict_string, options, run_metadata)
File "/home/xujian/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1015, in _do_run
target_list, options, run_metadata)
File "/home/xujian/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1035, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InternalError: Unable to get element from the feed as bytes.

data problem

Extracting ./asset/data/mnist/train-images-idx3-ubyte.gz
Traceback (most recent call last):
File "train.py", line 75, in
data = tf.sg_data.Mnist(batch_size=batch_size)
File "/home/xujian/ac-gan-master/ac-gan-master/sugartensor/sg_data.py", line 40, in init
data_set = input_data.read_data_sets(Mnist._data_dir, reshape=reshape, one_hot=one_hot)
File "/home/xujian/.local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py", line 213, in read_data_sets
train_images = extract_images(f)
File "/home/xujian/.local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py", line 53, in extract_images
magic = _read32(bytestream)
File "/home/xujian/.local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py", line 35, in _read32
return numpy.frombuffer(bytestream.read(4), dtype=dt)[0]
File "/usr/lib/python2.7/gzip.py", line 268, in read
self._read(readsize)
File "/usr/lib/python2.7/gzip.py", line 303, in _read
self._read_gzip_header()
File "/usr/lib/python2.7/gzip.py", line 197, in _read_gzip_header
raise IOError, 'Not a gzipped file'
IOError: Not a gzipped file

Loss to update G net

As is known, only generated samples are used to calculate adversarial loss for updating G net in classic gan. Here, I see that real image data was also used to calculate classification loss to update G net? Is it ok to do this?

An question about the code

  1. the "y_disc = tf.concat(0, [y, y * 0])" in 82 lines seems unused?

2.You divide the class info into categorical latent code and conditional latent code, Is this thought from InfoGan? I don't find the paper do it.

128x128 input

Hello,
If I want to use this code for 128x128 mages, all I have to do is adding more sg_upconv layers to the generator in order to achieve the desired output? And sg_conv for the discriminator of course.
Any thought?
Thanks.

[continuous factor loss]

Can you explain for me "what is continuous factor loss"? i read the paper about AC-Gan and can not find anything that related to "continuous factor loss".

Tensorboard problem

when i run trian.py, I don't find log, and when I run the tensorboard --logdir asset/train/log, the web don't display the result. Can you tell me how to use the tensorboard?

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.