title: Neural Network StyleGAN Style mixing trouble
body: <p>The neural network is loaded from GitHub with pre-trained files and successfully generates random photos. It seems to be random. But when you run the script generate_figures.py displays a photo of a mixed forest of the other two, also random. 
  Question. How to make a neural network to make a mix of two user-defined rather than generated photos? 
  I made changes to the code, specifying the path to your photos, but in the end, it generates all the same random not related to my photo face.</p>
  
  <pre><code>import os
  import pickle
  import numpy as np
  import PIL.Image
  import dnnlib
  import dnnlib.tflib as tflib
  import config
  
  #----------------------------------------------------------------------------
  # Helpers for loading and using pre-trained generators.
  
  url_ffhq        = 'https://drive.google.com/uc?id=1MEGjdvVpUsu1jB4zrXZN7Y4kBBOzizDQ' # karras2019stylegan-ffhq-1024x1024.pkl
  
  synthesis_kwargs = dict(output_transform=dict(func=tflib.convert_images_to_uint8, nchw_to_nhwc=True), minibatch_size=4)
  
  _Gs_cache = dict()
  
  def load_Gs(url):
      if url not in _Gs_cache:
          with dnnlib.util.open_url(url, cache_dir=config.cache_dir) as f:
              _G, _D, Gs = pickle.load(f)
          _Gs_cache[url] = Gs
      return _Gs_cache[url]
  </code></pre>
  
  <h1>Figure 3: Style mixing.</h1>
  
  <pre><code>def draw_style_mixing_figure(png, Gs, w, h, src_seeds, dst_seeds, style_ranges):
     print(png)
  
     src_latents = np.stack(np.random.RandomState(seed).randn(Gs.input_shape[1]) for seed in src_seeds)
     dst_latents = np.stack(np.random.RandomState(seed).randn(Gs.input_shape[1]) for seed in dst_seeds)
     src_dlatents = Gs.components.mapping.run(src_latents, None) # [seed, layer, component]
     dst_dlatents = Gs.components.mapping.run(dst_latents, None) # [seed, layer, component]
     src_images = Gs.components.synthesis.run(src_dlatents, randomize_noise=False, **synthesis_kwargs)
     dst_images = Gs.components.synthesis.run(dst_dlatents, randomize_noise=False, **synthesis_kwargs)
  
     canvas = PIL.Image.new('RGB', (w * (len(src_seeds) + 1), h * (len(dst_seeds) + 1)), 'white')
  
     for col, src_image in enumerate(list(src_images)):
         canvas.paste(PIL.Image.open(r"C:\Users\Kurmyavochka\Desktop\NN\REALISM\stylegan-master\results\1.png"), ((col + 1) * w, 0))
     for row, dst_image in enumerate(list(dst_images)):
         canvas.paste(PIL.Image.open(r"C:\Users\Kurmyavochka\Desktop\NN\REALISM\stylegan-master\results\2.png"), (0, (row + 1) * h))
  
         row_dlatents = np.stack([dst_dlatents[row]] * len(src_seeds))
         row_dlatents[:, style_ranges[row]] = src_dlatents[:, style_ranges[row]]
  
         row_images = Gs.components.synthesis.run(row_dlatents, randomize_noise=False, **synthesis_kwargs)
  
         for col, image in enumerate(list(row_images)):
             canvas.paste(PIL.Image.fromarray(image, 'RGB'), ((col + 1) * w, (row + 1) * h))
     canvas.save(png)
  
  def main():
  
     tflib.init_tf()
     os.makedirs(config.result_dir, exist_ok=True)
  
     issa = 5067
     for iter in range(1):
         draw_style_mixing_figure(
             os.path.join(config.result_dir,
                          str(issa) + 'figure03-style-mixing.png'),
             load_Gs(url_ffhq),
             w=1024,
             h=1024,
             src_seeds=[0],
             dst_seeds=[0],
             style_ranges=[range(0, 4)] * 3 + [range(4, 8)] * 2 +
             [range(8, 18)])
         issa = issa + 1
  
  
  if __name__ == "__main__":
     main()
  
  
  </code></pre>