People who code: we want your input. Take the Survey

Hot answers tagged

19

Yes, GANs can be used for text. However, there is a problem in the combination of how GANs work and how text is normally generated by neural networks: GANs work by propagating gradients through the composition of Generator and Discriminator. Text is normally generated by having a final softmax layer over the token space, that is, the output of the network ...


13

Here is the correct formula for computing the size of the output with tf.layers.conv2d_transpose(): # Padding==Same: H = H1 * stride # Padding==Valid H = (H1-1) * stride + HF where, H = output size, H1 = input size, HF = height of filter e.g., if `H1` = 7, Stride = 3, and Kernel size = 4, With padding=="same", output size = 21, with padding=="valid", ...


11

The main differences are the philosophy that drives the loss metric, and consequently the architecture (the latter goes without saying, obviously). Autoencoders The job of an autoencoder is to simultaneously learn an encoding network and decoding network. This means an input (e.g. an image) is given to the encoder, which attempts to reduce the input to a ...


10

This is unlikely to add much beyond your direct data collection efforts. The quality of current GAN outputs (as of 2017) will not be high enough. The images produced by a GAN are typically small and can have unusual/ambiguous details and odd distortions. In the paper you linked, the images generated by the system from a sentence have believable blocks of ...


7

Take a look at the source code for tf.keras.Conv2DTranspose, which calls the function deconv_output_length when calculating its output size. There's a subtle difference between the accepted answer and what you find here: def deconv_output_length(input_length, filter_size, padding, output_padding=None, stride=0, dilation=1): """...


6

Generating text as an image is extremely difficult and I have never seen a GAN applied in the image space to generate pages of text. The reason this is so hard is because of the way in which text is perceived by humans and the way a GAN works. Humans read arbitrary symbols which are sequenced from left to right along the same line and combined into rows. ...


6

A Generative Adversarial Network (GAN) takes the idea of using a generator model to generate fake examples and discrimator model that tries to decide if the image it receives is a fake (i.e. from the generator) or a real sample. This was originally shown with relatively simple fully connected networks. A Deep Convolution GAN (DCGAN) does something very ...


6

The ImageNet dataset consists of more than 14M images, divided into approximately 22k different labels/classes. However the ImageNet challenge is conducted on just 1k high-level categories (probably because 22k is just too much). ImageNet Stats When people mention results on the ImageNet, they almost always mean the 1k labels (if some paper uses the ...


5

Instead of using tf.nn.conv2d_transpose you can use tf.layers.conv2d_transpose It is a wrapper layer and there is no need to input output shape or if you want to calculate output shape you can use the formula: H = (H1 - 1)*stride + HF - 2*padding H - height of output image i.e H = 28 H1 - height of input image i.e H1 = 7 HF - height of filter


5

Typically to extract features, you can use the top layer of the network before the output. The intuition is that these features are linearly separable because the top layer is just a logistic regression. For GANs, you can use the features from the discriminator. These features are supposed to give a probability if the input came from the training dataset, "...


5

What you are experiencing is called mode collapse, which can occur in GAN Training and is one of its "training instability problems". If you are using Vanilla GAN one effective way is to implement mini batch discrimination, which for my understanding does give the discriminator batches of real and fakes and it has to decide batchwise if its fake or real. So ...


5

It's a very specific problem and there's no right or wrong solution. I'll just write what I'd do in your position and hope that it is useful. How many "before and after" images will I need? You'll need a lot of images to consistently get good results, in the range of tens or preferably hundreds of thousands. What architecture should I use? i.e. ...


4

The discriminator must classify individual elements as being fake (i.e. created by the generator) or real (i.e. taken from the training dataset). The discriminator generates labels (real/fake) for each element in the batch. The loss functions are computed based on those labels. Elements are fed to the discriminator in batches of the same type (i.e. all ...


4

In algorithm 1 of the original GAN article (https://arxiv.org/pdf/1406.2661.pdf), the discriminator is said to be updated by "ascending its stochastic gradient". This is referring to equation 1: $$ \min_G \max_D V(D, G)= \mathbb{E}_{x\sim p_{data}(x)}[\log D(x)] + \mathbb{E}_{z\sim p_z(z)}[\log(1 - D(G(z)))] $$ When we want to minimize something, we do ...


4

Suppose we want to fit a function $f(x)$. We can either try to learn a neural network model $F(\cdot)$ so that $F(x) \approx f(x)$. Or, in the residual network approach, we try to learn a neural network model $R(\cdot)$ so that $x+R(x) \approx f(x)$. Why is the latter easier to learn? There's no fundamental reason why it should necessarily be so, in ...


4

Reading the article, it seems like they define VGG54 as the loss calculated from the euclidean distance between the $\phi_{5,4}$ feature maps derived from both the high and low resolution images using the VGG19 network. Where $\phi_{i,j}$ is defined as "the feature map obtained by the j-th convolution (after activation) and before the i-th max-pooling layer ...


4

Why people often choose the input to a GAN (z) to be samples from a Gaussian? Generally, for two reasons: (1) mathematical simplicity, (2) working well enough in practice. However, as we explain, under additional assumptions the choice of Gaussian could be more justified. Compare to uniform distribution. Gaussian distribution is not as simple as uniform ...


4

I think that there are several issues with your model: First of all - Your generator's loss is not the generator's loss. You have on binary cross-entropy loss function for the discriminator, and you have another binary cross-entropy loss function for the concatenated model whose output is again the discriminator's output (on generated images). The "...


4

Training GANs is only a partially unsupervised task, IMHO. It's certainly unsupervised for the Generator, but it's supervised for the Adversarial Network. So it might be useful to test the Disciminator's ability to distinguish fake and true cases on new data it has never seen before. In other words, it makes sense to split your dataset in train(-validation)-...


3

The parts of your code that need to be inside the with tf.device('/gpu:0'): context is the actual computation graph, where the neural network lives. All the parameters that should be updated on the GPU should be defined within there. I don't know tflearn very well, but I assume if you wrap the code from IN 6 to IN 12 inside the context manager, it should ...


3

There is even more specific research on this topic: The trained generator is capable of producing sentences with certain level of grammar and logic. Xuerong Xiao, "Text Generation using Generative Adversarial Training" This question relates to this one: https://linguistics.stackexchange.com/questions/26448/how-to-translate-pelevins-creative-unit-idea-...


3

In terms of generating an image "layer", that is just the same as generating an output image that can be overlaid on the input using standard graphics software. If you want pixel-level accuracy in the output then the output will need to be the same size as the input, otherwise it could be smaller, provided it is the same aspect ratio, and in which case it ...


3

I have the exact same issue with a DNN that I am currently building. Taking my data set and synthesizing new data with a GAN seems like a great idea. But the GAN itself will only learn to output images with the same image variance and standard deviations as was learned in the training set. So your newly generated data will simply represent more permutations ...


3

Just from a purely theoretical perspective this cannot be possible. Any given training dataset represents a certain amount of information about the structure of a certain space. If you train a GAN on this dataset, it will only ever learn from the information represented by that dataset. The data synthesized by the GAN can never be from a larger space than ...


3

If you are using WGAN with Gradient Penalty, I think the Framework you are using is the limited factor since computing all the gradients will take time. If you are using WGAN with Gradient Penalty one way to get faster results is to omit the gradient penalty and just do weight clipping as mentioned in original WGAN Paper. But be careful in Improved WGAN (...


3

There is really nothing special about the backpropagation algorithm in a generative adversarial network (GAN). It is the same as that of a convolutional neural network (CNN), as CNNs are usually what the generator and discriminator of the GAN are made of. I will assume the MNIST toy example for the explanation and I will provide code to get a GAN working ...


3

In the subsection of the figure, they compute the average loss across 100 iterations, which is why the loss is monotonically decreasing because on average the loss does decrease with the training. You are correct in inferring that if this was reported on an iteration to iteration basis, the loss would be a zig zag curve, which is less nice to look at than a ...


3

I would doubt there's a single correct answer for best available architecture, but the current best results come from this paper by NVIDIA and this technical report by Adobe. The latter paper is the second iteration of the repo you linked. Both papers focus on non-rectangular inpainting, which seems to be your targeted interest. Neither has publicly ...


3

Passing directly the output of the softmax is also common (among the few textual GANs out there), e.g. see the improved Wasserstein GANs (WGAN-GP). With hard Gumbel-softmax (+ straight-through estimator), you pass one-hot encoded vectors, which is the same as what you have with real data. If you pass the output of the softmax, the discriminator should be ...


3

Your notation is a little confusing, but I suspect this is because you're not reading the original equation exactly right. $\mathbb{E}_{x \sim p_{data}(x)}$ means "the expectation over $x$ drawn from the distribution described by $p_{data}(x)$". It looks like you're trying to multiply the expected value of $x$ times $\log(D(x))$ for all $x$, which isn't what'...


Only top voted, non community-wiki answers of a minimum length are eligible