Giter VIP home page Giter VIP logo

catgan's Introduction

catgan

chainer implementatio of catgan (UNSUPERVISED AND SEMI-SUPERVISED LEARNING WITH CATEGORICAL GENERATIVE ADVERSARIAL NETWORKS)

Build the model
python catgan_train.py

generate the image in "fig" directory
python catgan_test.py

catgan's People

Contributors

smayru avatar

Stargazers

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

Watchers

 avatar

catgan's Issues

Which version of Chainer is used in your code?

I use the Chainer v1.9.0, but got an AssertionError when i run the catgan_test.py. I guess that the version of Chainer we have used are different.

$ python catgan_test.py
Traceback (most recent call last):
File "catgan_test.py", line 70, in
fake_x=gen(z,test=True).data
File "catgan_test.py", line 53, in call
h1=F.leaky_relu(self.bn0(self.l0(z),test),slope=0.1)
File "/usr/local/lib/python2.7/dist-packages/chainer/links/connection/linear.py", line 72, in call
return linear.linear(x, self.W, self.b)
File "/usr/local/lib/python2.7/dist-packages/chainer/functions/connection/linear.py", line 79, in linear
return LinearFunction()(x, W, b)
File "/usr/local/lib/python2.7/dist-packages/chainer/function.py", line 115, in call
self._check_data_type_forward(in_data)
File "/usr/local/lib/python2.7/dist-packages/chainer/function.py", line 182, in _check_data_type_forward
in_type = type_check.get_types(in_data, 'in_types', False)
File "/usr/local/lib/python2.7/dist-packages/chainer/utils/type_check.py", line 46, in get_types
_get_type(name, i, x, accept_none) for i, x in enumerate(data))
File "/usr/local/lib/python2.7/dist-packages/chainer/utils/type_check.py", line 46, in
_get_type(name, i, x, accept_none) for i, x in enumerate(data))
File "/usr/local/lib/python2.7/dist-packages/chainer/utils/type_check.py", line 60, in _get_type
isinstance(array, cuda.ndarray))
AssertionError

Line 164

Hello,

I keep getting this error when I try to compile your code:
GPU: -1

Minibatch-size: 100

epoch: 200

load MNIST dataset
Downloading train-images-idx3-ubyte.gz...
Done
Downloading train-labels-idx1-ubyte.gz...
Done
Downloading t10k-images-idx3-ubyte.gz...
Done
Downloading t10k-labels-idx1-ubyte.gz...
Done
Converting training data...
Done
Converting test data...
Done
Save output...
Done
Convert completed
epoch 1
Traceback (most recent call last):
File "catgan_train.py", line 164, in
fake_x=gen(z)
File "catgan_train.py", line 73, in call
h1=F.leaky_relu(self.bn0(self.l0(z),test),slope=0.1)
TypeError: call() takes exactly 2 arguments (3 given)

Could you please help? Thank you.

Error while executing at line #74

load MNIST dataset
epoch 1
Traceback (most recent call last):
File "catgan_train.py", line 164, in
fake_x=gen(z)
File "catgan_train.py", line 73, in call
h1=F.leaky_relu(self.bn0(self.l0(z),test),slope=0.1)
TypeError: call() takes 2 positional arguments but 3 were given


Someone in other issue page suggested to remove test in func call... tried it .. but didn't work..

Even after making above changes, I get this error..
load MNIST dataset epoch 1 Traceback (most recent call last): File "catgan_train.py", line 164, in <module> fake_x=gen(z) File "catgan_train.py", line 74, in __call__ h2=F.leaky_relu(self.bn1(self.l1(h1),test),slope=0.1) TypeError: __call__() takes 2 positional arguments but 3 were given


I removed test from all these 3 line..


h1=F.leaky_relu(self.bn0(self.l0(z)),slope=0.1)
h2=F.leaky_relu(self.bn1(self.l1(h1)),slope=0.1)
h3=F.leaky_relu(self.bn2(self.l2(h2)))
h4=F.sigmoid(self.l3(h3))

It still gives me this error..


load MNIST dataset
epoch 1
Traceback (most recent call last):
File "catgan_train.py", line 165, in
fake_y=dis(fake_x)
File "catgan_train.py", line 117, in call
h1=F.leaky_relu(self.bn0(self.l0(x)+F.gaussian(mu_array2,log_std_array2),test),slope=0.1)
TypeError: call() takes 2 positional arguments but 3 were given


So I removed test in other calls too... like this..

h1=F.leaky_relu(self.bn0(self.l0(x)+F.gaussian(mu_array2,log_std_array2)),slope=0.1)
h2=F.leaky_relu(self.bn1(self.l1(h1)+F.gaussian(mu_array3,log_std_array3)),slope=0.1)
h3=F.leaky_relu(self.bn2(self.l2(h2)+F.gaussian(mu_array4,log_std_array4)),slope=0.1)
h4=F.leaky_relu(self.bn3(self.l3(h3)+F.gaussian(mu_array5,log_std_array5)),slope=0.1)
h5=F.leaky_relu(self.bn4(self.l4(h4)+F.gaussian(mu_array6,log_std_array6)),slope=0.1)
h6=F.softmax(self.l5(h5))


It gives me this error..


load MNIST dataset
epoch 1
Traceback (most recent call last):
File "catgan_train.py", line 170, in
o_dis.zero_grads()
AttributeError: 'Adam' object has no attribute 'zero_grads'

Generator loss function

I am a little confused about the loss function of generator.
I think it should be L_gen=-d_entropy1(fake_y)+d_entropy2(fake_y)

How to run this code?

Sorry!! Got an ImportError: No module named net??

And how to train with my own dataset?

Thanks for the help

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.