justinpinkney / toonify

606 stars 73 forks source link

no conv layer in pkl file. #17

Closed youjin-c closed 2 years ago

youjin-c commented 2 years ago

Hello @justinpinkney,

I am training a StyleGAN2 model with your adjusted StyleGAN2 repo. It looks pretty good because it generates good fake images.

But the thing is, when I tried to blend with the ffhq model, my model doesn't be extracted any Conv layer inside. When I directly print the return of extract_conv_names(model) with my model, it returns just an empty list.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
[<ipython-input-31-71c3d5ee09d7>](https://localhost:8080/#) in <module>()
----> 9   blend_models.main(lowpoly_model_path, face512_model_path, res, output_grid=filename, verbose = True)

1 frames
[/content/stylegan2/blend_models.py](https://localhost:8080/#) in blend_models(model_1, model_2, resolution, level, blend_width, verbose)
     62     assert all((x == y for x, y in zip(model_1_names, model_2_names)))
     63 
---> 64     model_out = model_1.clone()
     65 
     66     short_names = [(x[1:3]) for x in model_1_names]

ValueError: ('8x8', 0) is not in list

I used the latest snapshot that I trained, something like network-snapshot-000769.pkl, but it didn't reach the total kimg. I don't believe that is the problem, though.

Let me share the log of training. Any hints or comments will be appreciated. Thank you.

Local submit - run_dir: /content/Google/My Drive/stylegan2/results/00004-stylegan2-low_poly-1gpu-config-e
dnnlib: Running training.training_loop.training_loop() on localhost...
Streaming data using training.dataset.TFRecordDataset...
Dataset shape = [3, 640, 384]
Dynamic range = [0, 255]
Label size    = 0
Loading networks from "/content/Google/My Drive/stylegan2/results/00003-stylegan2-low_poly-1gpu-config-e/network-snapshot-000721.pkl"...
Setting up TensorFlow plugin "fused_bias_act.cu": Preprocessing... Compiling... Loading... Done.
Setting up TensorFlow plugin "upfirdn_2d.cu": Preprocessing... Compiling... Loading... Done.

G                             Params    OutputShape        WeightShape     
---                           ---       ---                ---             
latents_in                    -         (?, 512)           -               
labels_in                     -         (?, 0)             -               
lod                           -         ()                 -               
dlatent_avg                   -         (512,)             -               
G_mapping/latents_in          -         (?, 512)           -               
G_mapping/labels_in           -         (?, 0)             -               
G_mapping/Normalize           -         (?, 512)           -               
G_mapping/Dense0              262656    (?, 512)           (512, 512)      
G_mapping/Dense1              262656    (?, 512)           (512, 512)      
G_mapping/Dense2              262656    (?, 512)           (512, 512)      
G_mapping/Dense3              262656    (?, 512)           (512, 512)      
G_mapping/Dense4              262656    (?, 512)           (512, 512)      
G_mapping/Dense5              262656    (?, 512)           (512, 512)      
G_mapping/Dense6              262656    (?, 512)           (512, 512)      
G_mapping/Dense7              262656    (?, 512)           (512, 512)      
G_mapping/Broadcast           -         (?, 16, 512)       -               
G_mapping/dlatents_out        -         (?, 16, 512)       -               
Truncation/Lerp               -         (?, 16, 512)       -               
G_synthesis/dlatents_in       -         (?, 16, 512)       -               
G_synthesis/5x3/Const         7680      (?, 512, 5, 3)     (1, 512, 5, 3)  
G_synthesis/5x3/Conv          2622465   (?, 512, 5, 3)     (3, 3, 512, 512)
G_synthesis/5x3/ToRGB         264195    (?, 3, 5, 3)       (1, 1, 512, 3)  
G_synthesis/10x6/Conv0_up     2622465   (?, 512, 10, 6)    (3, 3, 512, 512)
G_synthesis/10x6/Conv1        2622465   (?, 512, 10, 6)    (3, 3, 512, 512)
G_synthesis/10x6/Upsample     -         (?, 3, 10, 6)      -               
G_synthesis/10x6/ToRGB        264195    (?, 3, 10, 6)      (1, 1, 512, 3)  
G_synthesis/20x12/Conv0_up    2622465   (?, 512, 20, 12)   (3, 3, 512, 512)
G_synthesis/20x12/Conv1       2622465   (?, 512, 20, 12)   (3, 3, 512, 512)
G_synthesis/20x12/Upsample    -         (?, 3, 20, 12)     -               
G_synthesis/20x12/ToRGB       264195    (?, 3, 20, 12)     (1, 1, 512, 3)  
G_synthesis/40x24/Conv0_up    2622465   (?, 512, 40, 24)   (3, 3, 512, 512)
G_synthesis/40x24/Conv1       2622465   (?, 512, 40, 24)   (3, 3, 512, 512)
G_synthesis/40x24/Upsample    -         (?, 3, 40, 24)     -               
G_synthesis/40x24/ToRGB       264195    (?, 3, 40, 24)     (1, 1, 512, 3)  
G_synthesis/80x48/Conv0_up    1442561   (?, 256, 80, 48)   (3, 3, 512, 256)
G_synthesis/80x48/Conv1       721409    (?, 256, 80, 48)   (3, 3, 256, 256)
G_synthesis/80x48/Upsample    -         (?, 3, 80, 48)     -               
G_synthesis/80x48/ToRGB       132099    (?, 3, 80, 48)     (1, 1, 256, 3)  
G_synthesis/160x96/Conv0_up   426369    (?, 128, 160, 96)  (3, 3, 256, 128)
G_synthesis/160x96/Conv1      213249    (?, 128, 160, 96)  (3, 3, 128, 128)
G_synthesis/160x96/Upsample   -         (?, 3, 160, 96)    -               
G_synthesis/160x96/ToRGB      66051     (?, 3, 160, 96)    (1, 1, 128, 3)  
G_synthesis/320x192/Conv0_up  139457    (?, 64, 320, 192)  (3, 3, 128, 64) 
G_synthesis/320x192/Conv1     69761     (?, 64, 320, 192)  (3, 3, 64, 64)  
G_synthesis/320x192/Upsample  -         (?, 3, 320, 192)   -               
G_synthesis/320x192/ToRGB     33027     (?, 3, 320, 192)   (1, 1, 64, 3)   
G_synthesis/640x384/Conv0_up  51297     (?, 32, 640, 384)  (3, 3, 64, 32)  
G_synthesis/640x384/Conv1     25665     (?, 32, 640, 384)  (3, 3, 32, 32)  
G_synthesis/640x384/Upsample  -         (?, 3, 640, 384)   -               
G_synthesis/640x384/ToRGB     16515     (?, 3, 640, 384)   (1, 1, 32, 3)   
G_synthesis/images_out        -         (?, 3, 640, 384)   -               
G_synthesis/noise0            -         (1, 1, 5, 3)       -               
G_synthesis/noise1            -         (1, 1, 10, 6)      -               
G_synthesis/noise2            -         (1, 1, 10, 6)      -               
G_synthesis/noise3            -         (1, 1, 20, 12)     -               
G_synthesis/noise4            -         (1, 1, 20, 12)     -               
G_synthesis/noise5            -         (1, 1, 40, 24)     -               
G_synthesis/noise6            -         (1, 1, 40, 24)     -               
G_synthesis/noise7            -         (1, 1, 80, 48)     -               
G_synthesis/noise8            -         (1, 1, 80, 48)     -               
G_synthesis/noise9            -         (1, 1, 160, 96)    -               
G_synthesis/noise10           -         (1, 1, 160, 96)    -               
G_synthesis/noise11           -         (1, 1, 320, 192)   -               
G_synthesis/noise12           -         (1, 1, 320, 192)   -               
G_synthesis/noise13           -         (1, 1, 640, 384)   -               
G_synthesis/noise14           -         (1, 1, 640, 384)   -               
images_out                    -         (?, 3, 640, 384)   -               
---                           ---       ---                ---             
Total                         24860423                                     

D                    Params    OutputShape        WeightShape     
---                  ---       ---                ---             
images_in            -         (?, 3, 640, 384)   -               
labels_in            -         (?, 0)             -               
640x384/FromRGB      128       (?, 32, 640, 384)  (1, 1, 3, 32)   
640x384/Conv0        9248      (?, 32, 640, 384)  (3, 3, 32, 32)  
640x384/Conv1_down   18496     (?, 64, 320, 192)  (3, 3, 32, 64)  
640x384/Skip         2048      (?, 64, 320, 192)  (1, 1, 32, 64)  
320x192/Conv0        36928     (?, 64, 320, 192)  (3, 3, 64, 64)  
320x192/Conv1_down   73856     (?, 128, 160, 96)  (3, 3, 64, 128) 
320x192/Skip         8192      (?, 128, 160, 96)  (1, 1, 64, 128) 
160x96/Conv0         147584    (?, 128, 160, 96)  (3, 3, 128, 128)
160x96/Conv1_down    295168    (?, 256, 80, 48)   (3, 3, 128, 256)
160x96/Skip          32768     (?, 256, 80, 48)   (1, 1, 128, 256)
80x48/Conv0          590080    (?, 256, 80, 48)   (3, 3, 256, 256)
80x48/Conv1_down     1180160   (?, 512, 40, 24)   (3, 3, 256, 512)
80x48/Skip           131072    (?, 512, 40, 24)   (1, 1, 256, 512)
40x24/Conv0          2359808   (?, 512, 40, 24)   (3, 3, 512, 512)
40x24/Conv1_down     2359808   (?, 512, 20, 12)   (3, 3, 512, 512)
40x24/Skip           262144    (?, 512, 20, 12)   (1, 1, 512, 512)
20x12/Conv0          2359808   (?, 512, 20, 12)   (3, 3, 512, 512)
20x12/Conv1_down     2359808   (?, 512, 10, 6)    (3, 3, 512, 512)
20x12/Skip           262144    (?, 512, 10, 6)    (1, 1, 512, 512)
10x6/Conv0           2359808   (?, 512, 10, 6)    (3, 3, 512, 512)
10x6/Conv1_down      2359808   (?, 512, 5, 3)     (3, 3, 512, 512)
10x6/Skip            262144    (?, 512, 5, 3)     (1, 1, 512, 512)
5x3/MinibatchStddev  -         (?, 513, 5, 3)     -               
5x3/Conv             2364416   (?, 512, 5, 3)     (3, 3, 513, 512)
5x3/Dense0           3932672   (?, 512)           (7680, 512)     
Output               513       (?, 1)             (512, 1)        
scores_out           -         (?, 1)             -               
---                  ---       ---                ---             
Total                23768609                                     

Building TensorFlow graph...
Initializing logs...
Training for 800 kimg...

tick 0     kimg 721.1    lod 0.00  minibatch 32   time 33s          sec/tick 33.1    sec/kimg 258.84  maintenance 0.0    gpumem 5.9
tick 1     kimg 727.1    lod 0.00  minibatch 32   time 14m 40s      sec/tick 832.0   sec/kimg 138.30  maintenance 15.3   gpumem 5.9
tick 2     kimg 733.2    lod 0.00  minibatch 32   time 28m 36s      sec/tick 832.0   sec/kimg 138.31  maintenance 3.6    gpumem 5.9
tick 3     kimg 739.2    lod 0.00  minibatch 32   time 42m 32s      sec/tick 832.1   sec/kimg 138.32  maintenance 3.5    gpumem 5.9
tick 4     kimg 745.2    lod 0.00  minibatch 32   time 56m 27s      sec/tick 832.2   sec/kimg 138.34  maintenance 3.5    gpumem 5.9
tick 5     kimg 751.2    lod 0.00  minibatch 32   time 1h 10m 23s   sec/tick 831.6   sec/kimg 138.24  maintenance 4.1    gpumem 5.9
tick 6     kimg 757.2    lod 0.00  minibatch 32   time 1h 24m 20s   sec/tick 833.3   sec/kimg 138.52  maintenance 3.5    gpumem 5.9
tick 7     kimg 763.2    lod 0.00  minibatch 32   time 1h 38m 17s   sec/tick 832.9   sec/kimg 138.45  maintenance 3.5    gpumem 5.9
tick 8     kimg 769.3    lod 0.00  minibatch 32   time 1h 52m 13s   sec/tick 833.1   sec/kimg 138.48  maintenance 3.5    gpumem 5.9
youjin-c commented 2 years ago

I was confused with the resolution of the model