Combining WGAN loss with other loss functions (L1, VGG, etc.)

ZimoNitrome: <p>Hello,<br>
I am re-writing a GAN (cGAN) into a Wasserstein GAN.<br>
My original generator is trained both with adversarial loss from the discriminator but also with L1-loss between the generated fake and the target (I am also experimenting with VGG-loss and L2-loss).</p>
<p>My Wasserstein GAN works as expected when only using an adversarial loss but since it uses Wasserstein distance, the critic outputs losses which can range between 1e-5 to 1e6, shifting throughout the training. Combining other loss functions which generally have ranges from 0-1 feels next to impossible even with scaling factors.</p>
<p>I have therefore currently added a Tanh activation function for my discriminator, but I wonder if this is the way to go. It is not the true Wasserstein distance but the loss is “standardized”.</p>
<p>If you know of any project using WGAN loss in combination with other loss functions, please let me know.</p>

ZimoNitrome: <p>I found two articles using WGAN with other losses:</p>
<aside class="onebox allowlistedgeneric">
  <header class="source">
      <a href="https://ieeexplore.ieee.org/abstract/document/8902992" target="_blank" rel="noopener nofollow ugc">ieeexplore.ieee.org</a>
  </header>
  <article class="onebox-body">
    <img src="" class="thumbnail" width="16" height="16">

<h3><a href="https://ieeexplore.ieee.org/abstract/document/8902992" target="_blank" rel="noopener nofollow ugc">Single Image Haze Removal Using Conditional Wasserstein Generative...</a></h3>



  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>

<aside class="onebox allowlistedgeneric">
  <header class="source">
      <img src="https://sdfestaticassets-us-east-1.sciencedirectassets.com/shared-assets/13/images/favSD.ico" class="site-icon" width="16" height="16">
      <a href="https://www.sciencedirect.com/science/article/abs/pii/S0925231218306209" target="_blank" rel="noopener nofollow ugc">sciencedirect.com</a>
  </header>
  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:113/150;"><img src="https://ars.els-cdn.com/content/image/1-s2.0-S0925231218X00344-cov150h.gif" class="thumbnail" width="113" height="150"></div>

<h3><a href="https://www.sciencedirect.com/science/article/abs/pii/S0925231218306209" target="_blank" rel="noopener nofollow ugc">Auto-painter: Cartoon image generation from sketch by using conditional...</a></h3>

<p>Recently, realistic image generation using deep neural networks has become a hot topic in machine learning and computer vision. Such an image can be g…</p>


  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>

<p>Both of these have available implementations on Github but they seem to simply scale the other losses i.e. VGGloss with a huge constant like 1000. In my experience trying this out, the adversarial Wasserstein loss started out way too small to have much impact on what was being learned until it passes the other losses, at which point the other losses have no impact.</p>
<p>My current solution is to revert back to using a normal GAN.</p>

ZimoNitrome: <p>Apparently "it just works"™</p>
<p>The key might be to backprop in different stages. More specifically the following training scheme seems to work well:</p>
<ol>
<li>
<p>Train D on real images</p>
</li>
<li>
<p>Train D on generated images</p>
</li>
<li>
<p>Train G with loss from D</p>
</li>
<li>
<p>Train G with any other objectives (i.e. L1)</p>
</li>
</ol>
<p>After each stage, I used backwards() on each network while calling optimizer.step after stage 2 and 4.</p>