Answers.Body: <p><strong>Short Answer</strong></p>
  
  <p>Generative networks in generative network arrangements do not learn about input images directly. Their input during training is feedback from the discriminative network.</p>
  
  <p><strong>The Theory in Summary</strong></p>
  
  <p>The seminal paper, <em>Generative Adversarial Networks</em>, Goodfellow, Pouget-Abadie, Mirza, Xu, Warde-Farley, Ozair, Courville, and Bengio, June 2014, states, "We propose a new framework for estimating generative models via an adversarial process, in which we simultaneously train two models ..." The two models are defined as MLPs (multilayer perceptrons) in the paper.</p>
  
  <ul>
  <li>Generative model, G</li>
  <li>Discriminative model, D</li>
  </ul>
  
  <p>These two models are interconnected such that they form a negative feedback loop.</p>
  
  <ul>
  <li>G is trained to capture the feature relational distribution of a set of examples and generate new examples based on that relational distribution well enough to fool D.</li>
  <li>D is trained to differentiate G's mocks from the set of externally procured examples.</li>
  </ul>
  
  <p><strong>Applying Concepts</strong></p>
  
  <p>If G were to receive input images, their presence would merely frustrate network training, in that the goal of the training would likely be inadequately defined. The objective of the convergence of G, stated above, is not the learning of how to process the images to produce some other form of output. Its objective in the generative approach is to learn how to generate well, an entirely incompatible objective with either image evaluation or image processing.</p>
  
  <p><strong>Additional Information</strong></p>
  
  <p>Additionally, one image is not nearly enough. There must be a sufficiently large set of example images for training to converge at all and then many more to expect the convergence to be both accurate and reliable. The PAC (probably approximately correct) learning analysis framework may be helpful to determine how many examples are needed for a specific case.</p>
  
  <p><strong>Essential Discriminator</strong></p>
  
  <p>The discriminator is essential to the generative approach because the feedback loop referenced above is essential to the convergence mechanism. The bidirectional interdependence between G and D is what allows a balanced approach toward accuracy in the feature relational distribution. That accuracy facilitates the human perception that the generated images fit adequately within a cognitive class.</p>
  
  <p>.</p>
  
  <hr>
  
  <p><strong>Response to Comments</strong></p>
  
  <p>The attempt to use a generative approach, "To paint in gaps in an image," is reasonable. In such a case, using Goodfellow's nomenclature, G would be generating the missing pixels and D would be trying to discriminate between G's gap filling and the pixels that were in the scenes in the regions of gaps prior to their introduction.</p>
  
  <p>There are two additional requirements in the scenario of filling in pixels.</p>
  
  <ul>
  <li>G must be strongly incentivized against allowing a large gradient between the generated pixels and the adjacent non-gap pixels, unless that gradient is appropriate to the scene, as in the case of an object edge, or a change in reflectivity, such as a surface abrasion or the edge of a spray painted shape.</li>
  <li>D must train using the entire image, which means the examples should be images without gaps, the gaps must be introduced in a way that matches the expected distribution of features of gaps that may be encountered later, and the result of G must be superimposed over the full image to produce the input arising from G and discriminated from the original by D.</li>
  </ul>
  
  <p>It is recommended to begin with a standard GAN design, create a test for it (in TDD fashion), implement it, experiment with it, and otherwise become familiar with it and the mathematics involved. Most important to understand is how the balance between G's convergence and D's convergence is obtained in the loss (a.k.a. error or disparity) functions for each, and what concepts of feedback are employed using those functions.</p>
  
  <ul>
  <li>Does your point about input images frustrating network training apply to this kind of problem, or just to GANNs that generate from scratch?</li>
  </ul>
  
  <p>It applies to both.</p>
  
  <ul>
  <li>Would I have to have the generator compare the original image with the generated image and pick which one it thinks is better in order to deal with the "adequately defined" issue? </li>
  </ul>
  
  <p>D compares, not G. That is the delegated arrangement. It is not that other arrangements cannot work. They may. But Goodfellow and the others understood what worked in artificial networks long before they discovered a new approach, and they likely worked out the math of that approach and diagrammed it, perhaps on a white board, long before they typed a single line of code.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-21T10:45:05.783Z
Answers.Text: I'm currently trying to use a GANN to paint in gaps in an image in a format similar to this project https://arxiv.org/abs/1803.07422 (not using their architecture, I'm making my own GAN for learning purposes). Does your point about input images frustrating network training apply to this kind of problem, or just to GANNs that generate from scratch?
Answers.UserDisplayName: Bryan Tan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-21T10:49:32.283Z
Answers.Text: Would I have to have the generator compare the original image with the generated image and pick which one it thinks is better in order to deal with the "adequately defined" issue?
Answers.UserDisplayName: Bryan Tan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-20T14:42:45.883Z
Answers.LastActivityDate: 2019-04-21T13:19:57.953Z
Answers.LastEditDate: 2019-04-21T13:19:57.953Z
Answers.UserDisplayName: Douglas Daseeco
Answers.Body: <p>If you're building a straight "vanilla" generative adversarial network, it's best to understand the network as a statistical engine:  You are training the generator <em>on samples of a statistical distribution</em>.  (And you're training the discriminator to distinguish between "ground truth" images, and images from that generator.)</p>
  
  <p>Once you replace the input noise with another image... well.  Strictly speaking, it is probably still a generative adversarial network, if you're still doing everything else the same.  It is still a generator and a discriminator, acting in an adversarial fashion. </p>
  
  <p>But you've radically altered the input distribution, so there is a good chance that you're no longer accomplishing what you want to accomplish unless you're being very careful and clever. </p>
  
  <p>That said, there are GAN variants which do take images rather than noise as inputs.  See the wonderful <a href="https://junyanz.github.io/CycleGAN/" rel="nofollow noreferrer">paper</a> on CycleGANs by Zhu, et al, along with a substantial body of followup literature. And note that CycleGANs use not one, but two discriminators, so even here the discriminator is necessary.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-17T19:59:15.260Z
Answers.LastActivityDate: 2019-04-18T18:15:47.993Z
Answers.LastEditDate: 2019-04-18T18:15:47.993Z
Answers.UserDisplayName: Novak
Body: <p>I'm building a generative adversarial network that generates images based on an input image. From the literature I've read on GANs, it seems that the generator takes in a random variable and uses it to generate an image.</p>
  
  <p>If I were to have the generator receive an input image, would it no longer be a GAN? Would the discriminator be extraneous?</p>
  
Tags: <keras><generative-model><generative-adversarial-networks>
Title: How important is it that the generator of a generative adversarial network doesn't take in information about input classes?
UserDisplayName: Bryan Tan
ThreadText: # How important is it that the generator of a generative adversarial network doesn't take in information about input classes?
  
  (Asked by: username_0 on 2019-04-14)
  
  I'm building a generative adversarial network that generates images based on an input image. From the literature I've read on GANs, it seems that the generator takes in a random variable and uses it to generate an image.
  
  If I were to have the generator receive an input image, would it no longer be a GAN? Would the discriminator be extraneous?
  
  **Tags:** keras, generative-model, generative-adversarial-networks
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-04-20. Score: 0 | Accepted answer
  
  **Short Answer**
  
  Generative networks in generative network arrangements do not learn about input images directly. Their input during training is feedback from the discriminative network.
  
  **The Theory in Summary**
  
  The seminal paper, *Generative Adversarial Networks*, Goodfellow, Pouget-Abadie, Mirza, Xu, Warde-Farley, Ozair, Courville, and Bengio, June 2014, states, "We propose a new framework for estimating generative models via an adversarial process, in which we simultaneously train two models ..." The two models are defined as MLPs (multilayer perceptrons) in the paper.
  
  * Generative model, G
  * Discriminative model, D
  
  These two models are interconnected such that they form a negative feedback loop.
  
  * G is trained to capture the feature relational distribution of a set of examples and generate new examples based on that relational distribution well enough to fool D.
  * D is trained to differentiate G's mocks from the set of externally procured examples.
  
  **Applying Concepts**
  
  If G were to receive input images, their presence would merely frustrate network training, in that the goal of the training would likely be inadequately defined. The objective of the convergence of G, stated above, is not the learning of how to process the images to produce some other form of output. Its objective in the generative approach is to learn how to generate well, an entirely incompatible objective with either image evaluation or image processing.
  
  **Additional Information**
  
  Additionally, one image is not nearly enough. There must be a sufficiently large set of example images for training to converge at all and then many more to expect the convergence to be both accurate and reliable. The PAC (probably approximately correct) learning analysis framework may be helpful to determine how many examples are needed for a specific case.
  
  **Essential Discriminator**
  
  The discriminator is essential to the generative approach because the feedback loop referenced above is essential to the convergence mechanism. The bidirectional interdependence between G and D is what allows a balanced approach toward accuracy in the feature relational distribution. That accuracy facilitates the human perception that the generated images fit adequately within a cognitive class.
  
  .
  
  ---
  
  **Response to Comments**
  
  The attempt to use a generative approach, "To paint in gaps in an image," is reasonable. In such a case, using Goodfellow's nomenclature, G would be generating the missing pixels and D would be trying to discriminate between G's gap filling and the pixels that were in the scenes in the regions of gaps prior to their introduction.
  
  There are two additional requirements in the scenario of filling in pixels.
  
  * G must be strongly incentivized against allowing a large gradient between the generated pixels and the adjacent non-gap pixels, unless that gradient is appropriate to the scene, as in the case of an object edge, or a change in reflectivity, such as a surface abrasion or the edge of a spray painted shape.
  * D must train using the entire image, which means the examples should be images without gaps, the gaps must be introduced in a way that matches the expected distribution of features of gaps that may be encountered later, and the result of G must be superimposed over the full image to produce the input arising from G and discriminated from the original by D.
  
  It is recommended to begin with a standard GAN design, create a test for it (in TDD fashion), implement it, experiment with it, and otherwise become familiar with it and the mathematics involved. Most important to understand is how the balance between G's convergence and D's convergence is obtained in the loss (a.k.a. error or disparity) functions for each, and what concepts of feedback are employed using those functions.
  
  * Does your point about input images frustrating network training apply to this kind of problem, or just to GANNs that generate from scratch?
  
  It applies to both.
  
  * Would I have to have the generator compare the original image with the generated image and pick which one it thinks is better in order to deal with the "adequately defined" issue?
  
  D compares, not G. That is the delegated arrangement. It is not that other arrangements cannot work. They may. But Goodfellow and the others understood what worked in artificial networks long before they discovered a new approach, and they likely worked out the math of that approach and diagrammed it, perhaps on a white board, long before they typed a single line of code.
  
  > **Comments:**
  > **username_0**: I'm currently trying to use a GANN to paint in gaps in an image in a format similar to this project https://arxiv.org/abs/1803.07422 (not using their architecture, I'm making my own GAN for learning purposes). Does your point about input images frustrating network training apply to this kind of problem, or just to GANNs that generate from scratch?  
  > **username_0**: Would I have to have the generator compare the original image with the generated image and pick which one it thinks is better in order to deal with the "adequately defined" issue?  
  
  ---
  
  ### Answer by username_2 on 2019-04-17. Score: 1
  
  If you're building a straight "vanilla" generative adversarial network, it's best to understand the network as a statistical engine: You are training the generator *on samples of a statistical distribution*. (And you're training the discriminator to distinguish between "ground truth" images, and images from that generator.)
  
  Once you replace the input noise with another image... well. Strictly speaking, it is probably still a generative adversarial network, if you're still doing everything else the same. It is still a generator and a discriminator, acting in an adversarial fashion.
  
  But you've radically altered the input distribution, so there is a good chance that you're no longer accomplishing what you want to accomplish unless you're being very careful and clever.
  
  That said, there are GAN variants which do take images rather than noise as inputs. See the wonderful [paper](https://junyanz.github.io/CycleGAN/) on CycleGANs by Zhu, et al, along with a substantial body of followup literature. And note that CycleGANs use not one, but two discriminators, so even here the discriminator is necessary.
  
  
  ---
  
  