r0nn13 / conditional-dcgan-keras Goto Github PK
View Code? Open in Web Editor NEWKeras implementation of the conditional GAN.
Keras implementation of the conditional GAN.
Hi,
Thanks for sharing! and I have two questions,
-I have 2 classes and for each one 2k images with same size 250x250, I wont to resize them but I get error, How come over with this???
Thanks in Advance,
Maryam
Hi,
I've got an error related to the merge part of generative network:
"
ValueError: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer shapes: [(None, 1024, 2, 512), (None, 512, 2, 2)]
"
Is a bug in you code?
beside this I've got an error for using "mode" in "BatchNormalization"
In the sampled code for the keras implementation in the generator there is the batchnormalization step that it is coded as follow:
e1 = BatchNormalization(mode=2)(e1)
However, when the mode = 2 then there is an emerging error from keras. I noticed that when i set the mode=0 the whole thing is working. However, what it the difference between mode=2 and mode =0. And if it is crucial difference how can I have mode = 2. I guess that error has to do with the keras version (I am using keras 2.1.5).
Is it possible to take into account as a conditional information also the actual labels of the image 2 image translation? As I understood my input image Xa from the a belongs to A domain is transformed and mapped to Xb where b belongs to B domain and also Xb belongs to X_train while the Xa belongs to y_train. Is it possible to add the actual classes of the X_a and X_b into the loss function of the discriminator?
I am trying to understand the loss function of discriminator:
`def discriminator_loss(y_true,y_pred):
return K.mean(K.binary_crossentropy(K.flatten(y_pred), K.concatenate([K.ones_like(K.flatten(y_pred[:BATCH_SIZE,:,:,:])),K.zeros_like(K.flatten(y_pred[:BATCH_SIZE,:,: :])) ]) ), axis=-1)`
I am wandering why the y_true is not used at all and only y_pred is used twice. Is it kind of mistake? They way that the discriminator is trained is:
`# Training D:
real_pairs = np.concatenate((X_train[index * BATCH_SIZE:(index + 1) * BATCH_SIZE, :, :, :], image_batch),axis=1)
fake_pairs = np.concatenate((X_train[index * BATCH_SIZE:(index + 1) * BATCH_SIZE, :, :, :], generated_images), axis=1)
X = np.concatenate((real_pairs, fake_pairs))
y = np.concatenate((np.ones((BATCH_SIZE, 1, 64, 64)), np.zeros((BATCH_SIZE, 1, 64, 64))))
d_loss = discriminator.train_on_batch(X, y)`
Is it that I need to add also the y_true in the discriminator or no?
Hello, first I was using keras 2.0. Then i realized thousands of things have changed in 2.0. So I downgrade keras to 1.0.8. Now I am getting the following error.
Exception: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer shapes: [(None, 512, 1, 1), (None, 512, 2, 2)]
Is there any problem in your code? Or is it some kind of version problem?
https://github.com/r0nn13/conditional-dcgan-keras/blob/master/conditional_gan.py#L193
This creates an array of all zeros. Surely half should be zero and the other half ones?
Is it possible to run the code using keras-tensorflow? If so what should be the arguments in that case?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.