DCGANs | Implementation of some basic GAN architectures in Keras | Machine Learning library
kandi X-RAY | DCGANs Summary
kandi X-RAY | DCGANs Summary
Implementation of some basic GAN architectures in Keras
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Train model
- Generate sample data
- Normalize data
- Unnormalize display
- Toggle trainable state
- Generate random samples
DCGANs Key Features
DCGANs Examples and Code Snippets
Community Discussions
Trending Discussions on DCGANs
QUESTION
I am implementing DCGANs using PyTorch.
It works well in that I can get reasonable quality generated images, however now I want to evaluate the health of the GAN models by using metrics, mainly the ones introduced by this guide https://machinelearningmastery.com/practical-guide-to-gan-failure-modes/
Their implementation uses Keras which SDK lets you define what metrics you want when you compile the model, see https://keras.io/api/models/model/. In this case the accuracy of the discriminator, i.e. percentage of when it successfully identifies an image as real or generated.
With the PyTorch SDK, I can't seem to find a similar feature that would help me easily acquire this metric from my model.
Does Pytorch provide the functionality to be able to define and extract common metrics from a model?
...ANSWER
Answered 2021-Feb-25 at 10:51Pure PyTorch does not provide metrics out of the box, but it is very easy to define those yourself.
Also there is no such thing as "extracting metrics from model". Metrics are metrics, they measure (in this case accuracy of discriminator), they are not inherent to the model.
Binary accuracyIn your case, you are looking for binary accuracy metric. Below code works with either logits
(unnormalized probability outputed by discriminator
, probably last nn.Linear
layer without activation) or probabilities
(last nn.Linear
followed by sigmoid
activation):
QUESTION
I am analyzing a meta-learning class that uses DCGAN + Reptile within the image generation.
I have two questions about this code.
First question: why during DCGAN training (line 74)
...ANSWER
Answered 2020-May-21 at 16:59If you read the document reallllly carefully (look at the def initialize_gan(self):
function), you'll find that
QUESTION
ANSWER
Answered 2019-Mar-07 at 21:44Adding
QUESTION
I'm trying to run code for a Deep Convolutional GAN from the official PyTorch site (https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html) on my Mac.
When I try loading the data, I keep getting a "FileNotFound" error.
...ANSWER
Answered 2018-Dec-24 at 18:10The recognizable directory structure starts with /
. So I assume, you should be replacing
QUESTION
I am trying to use this version of the DCGAN code (implemented in Tensorflow) with some of my data. I run into the problem of the discriminator becoming too strong way too quickly for generator to learn anything.
Now there are some tricks typically recommended for that problem with GANs:
batch normalisation (already there in DCGANs code)
giving a head start to generator.
I did some version of the latter by allowing 10 iterations of generator per 1 of discriminator (not just in the beginning, but throughout the entire training), and that's how it looks:
Adding more generator iterations in this case helps only by slowing down the inevitable - discriminator growing too strong and suppressing the generator learning.
Hence I would like to ask for an advice on whether there is another way that could help the problem of a too strong discriminator?
...ANSWER
Answered 2017-Jun-16 at 13:26To summarise this topic - the generic advice would be:
- try playing with model parameters (like learning rates, for instance)
- try adding more variety to the input data
- try adjusting the architecture of both generator and discriminator networks.
However, in my case the issue was the data scaling: I've changed the format of the input data from the initial .jpg to .npy and lost the rescaling on the way. Please note that this DCGAN-tensorflow code rescales the input data to [-1,1] range, and the model is tuned to work with this range.
QUESTION
I want to use condition GANs with the purpose of generated images for one domain (noted as domain A
) and by having input images from a second domain (noted as domain B
) and the class information as well. Both domains are linked with the same label information (every image of domain A is linked to an image to domain B and a specific label). My generator so far in Keras is the following:
ANSWER
Answered 2018-Aug-27 at 09:29At first, following the suggestion which is given in Conditional Generative Adversarial Nets you have to define a second input. Then, just concatenate the two input vectors and process this concatenated vector.
QUESTION
I am working on GANs and decided to implement my algorithm using HyperGAN. Its a wrapper on DCGANs using TensorFlow. HyperGAN saves the output using TF
's checkpoint method.
Later, I tried to run the load the model using:
...ANSWER
Answered 2017-May-24 at 17:16You should try to print the list of tensors within the graph:
QUESTION
I am trying to adjust this DCGAN code to be able to work with 2x80 data samples.
All generator layers are tf.nn.deconv2d
other than h0, which is ReLu. Generator filter sizes per level are currently:
ANSWER
Answered 2017-Jun-09 at 05:25In your ops.py file
your problem come from the striding size in your deconv filter, modify the header for conv2d
and deconv2d
to:
QUESTION
Running the DCGANS-tensorflow tutorial, more precisely lines python download.py mnist celebA
and python main.py --dataset celebA --input_height=108 --train --crop
, I get the following error:
ANSWER
Answered 2017-May-22 at 16:00I realised what was the problem with this - just needed an updated version of the Tensorflow (had 0.9.0 versus required 0.12.1), and pip install tensorflow --upgrade
solved my problem.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install DCGANs
You can use DCGANs like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page