GithubHelp home page GithubHelp logo

ct-gan's People

Contributors

biuyq 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

Watchers

 avatar  avatar  avatar

ct-gan's Issues

If the consistency term should operate on the instance data rather than on the batch data?

Hi, I wonder if this code snippet is an issue:
"CT_ = tf.reduce_mean(CT_)" operates on the batch data.
Is it proper to change it to "CT_ = tf.reduce_mean(CT_)[0]" to operate on the first instance.

https://github.com/biuyq/CT-GAN/blob/master/CT-GANs/tensorflow_generative_model/CT_gan_cifar_resnet.py
#consistency term
CT = LAMBDA_2tf.square(disc_real-disc_real_)
CT += LAMBDA_2
0.1tf.reduce_mean(tf.square(disc_real_2-disc_real_2_),reduction_indices=[1])
CT_ = tf.maximum(CT-Factor_M,0.0
(CT-Factor_M))
CT_ = tf.reduce_mean(CT_) <-----
disc_costs.append(CT_)
disc_costs.append(gradient_penalty)

inplimatation details about the consistency regularization (CT)

Hi, I am confused about the implementation in the code file CT-GAN/Theano_classifier/CT_MNIST, detailed below,

mom_gen = T.mean(LL.get_output(layers[-3], gen_dat), axis=0)
mom_real = T.mean(LL.get_output(layers[-3], x_unl), axis=0)
loss_gen = T.mean(T.square(mom_gen - mom_real))

I am not sure why there has LL.get_output(layers[-3], gen_dat), since Eq.(5) just contains the last-two-layer outputs in the paper copied below.
image

But the LL.get_output(layers[-3], gen_dat) actually refers to the third-to-last layer output. And the loss loss_gen is joined to the model training detailed in the code file CT-GAN/Theano_classifier/CT_MNIST (for convenience, copied below as well).

image

It seems different from Eq.(5) and makes me confusing. Hope you can give me some help to disentangle this confusion. Thanks in advance.

Performance of standard CNN network

HI,

I run your code of CT_gan_cifar.py,I evaluate the Inception Score of CT-GAN with 1000 generated images, the best score is 5.65 within the running 10000 iterations. To compare CT-GAN with original WGAN-GP, I also run WGAN-GP 10000 iterations, and evaluate the Inception Score of WGAN-GP with 1000 generated images, the best score of WGAN-GP is 5.96. Such results show that the performance of CT-GAN is lower than WGAN-GP on the standard CNN structure.

So I have two questions to ask: 1, is that the same result that CT-GAN obtain low Inception Score than WGAN-GP ran on standard CNN on your experiments? if not, is that any trick should be noticed? 2, is that CT-GAN outperform WGAN-GP due to ResNet structure? which occurs in your paper Improving the Improved Training of Wasserstein GANs.

Thank you for any reply or response.

Best wishes to you!

ValueError: Shape must be rank 2 but is rank 1 for 'MatMul' (op: 'MatMul') with input shapes: [2048], [2048,1008].

Hi,

Excellent work. I am trying to run CT_gan_cifar_resnet.py and I am getting the next error:

Traceback (most recent call last):
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 686, in _call_cpp_shape_fn_impl
    input_tensors_as_shapes, status)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 516, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 2 but is rank 1 for 'MatMul' (op: 'MatMul') with input shapes: [2048], [2048,1008].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "CT_gan_cifar_resnet.py", line 14, in <module>
    import tflib.inception_score
  File "/media/proto/942ea58f-5397-4c08-aa32-b507c86d1c07/IA/GANs/CT-GAN/CT-GANs/tensorflow_generative_model/tflib/inception_score.py", line 94, in <module>
    _init_inception()
  File "/media/proto/942ea58f-5397-4c08-aa32-b507c86d1c07/IA/GANs/CT-GAN/CT-GANs/tensorflow_generative_model/tflib/inception_score.py", line 90, in _init_inception
    logits = tf.matmul(tf.squeeze(pool3), w)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py", line 2108, in matmul
    a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/ops/gen_math_ops.py", line 4209, in mat_mul
    name=name)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3292, in create_op
    compute_device=compute_device)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3332, in _create_op_helper
    set_shapes_for_outputs(op)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2496, in set_shapes_for_outputs
    return _set_shapes_for_outputs(op)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2469, in _set_shapes_for_outputs
    shapes = shape_func(op)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2399, in call_with_requiring
    return call_cpp_shape_fn(op, require_shape_fn=True)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn
    require_shape_fn)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl
    raise ValueError(err.message)
ValueError: Shape must be rank 2 but is rank 1 for 'MatMul' (op: 'MatMul') with input shapes: [2048], [2048,1008].

Before this I had to change the line 88 in inception_score.py:

        o._shape = tf.TensorShape(new_shape)  
        to:
        o.set_shape = tf.TensorShape(new_shape)

to fix this:

Traceback (most recent call last):
  File "CT_gan_cifar_resnet.py", line 14, in <module>
    import tflib.inception_score
  File "/media/proto/942ea58f-5397-4c08-aa32-b507c86d1c07/IA/GANs/CT-GAN/CT-GANs/tensorflow_generative_model/tflib/inception_score.py", line 94, in <module>
    _init_inception()
  File "/media/proto/942ea58f-5397-4c08-aa32-b507c86d1c07/IA/GANs/CT-GAN/CT-GANs/tensorflow_generative_model/tflib/inception_score.py", line 88, in _init_inception
    o._shape = tf.TensorShape(new_shape)
  File "/home/proto/anaconda3/envs/tensor/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 395, in _shape
    "Tensor._shape cannot be assigned, use Tensor.set_shape instead.")
ValueError: Tensor._shape cannot be assigned, use Tensor.set_shape instead.

python 3.5

Cannot reproduce the classification accuracy on CIFAR-10 in the paper

Hi,
Thanks for sharing the code. I am trying to reproduce the experiment on Cifar-10 in the paper by running CT_gan_cifar_resnet.py for 100000 iterations. But for the classification accuracy I just got 88.2%. Is it because hyper parameters? Do you have any suggested hyperparameter setting to reproduce the experiment?

Thanks!

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.