@@ -22,32 +22,38 @@ def setup_model(opt, config, metadata, mpi_xyz_input, mpi_xyz_only_z, vis_mesh=F
2222 n_g_out_channels  =  4 
2323 n_g_out_planes  =  opt .nplanes 
2424
25-  if  "depth2alpha_n_z_bins"  in  config .GMPI .MPI  and  config .GMPI .MPI .depth2alpha_n_z_bins  is  not   None :
26-  from  gmpi .models .networks .networks_vanilla_depth2alpha  import  Generator  as  StyleGAN2Generator 
27- 
28-  if  config .GMPI .TRAIN .normalized_xyz_range  ==  "01" :
29-  depth2alpha_z_range  =  1.0 
30-  elif  config .GMPI .TRAIN .normalized_xyz_range  ==  "-11" :
31-  depth2alpha_z_range  =  2.0 
32-  else :
33-  raise  ValueError 
34-  else :
25+  if  config .GMPI .TRAIN .normalized_xyz_range  ==  "01" :
3526 depth2alpha_z_range  =  1.0 
36- 
37-  if  "depth2alpha_n_z_bins"  not  in   config .GMPI .MPI :
38-  config .defrost ()
39-  config .GMPI .MPI .depth2alpha_n_z_bins  =  None 
40-  config .freeze ()
41- 
42-  if  config .GMPI .MODEL .STYLEGAN2 .torgba_cond_on_pos_enc  !=  "none" :
27+  elif  config .GMPI .TRAIN .normalized_xyz_range  ==  "-11" :
28+  depth2alpha_z_range  =  2.0 
29+  else :
30+  raise  ValueError 
31+ 
32+  if  "depth2alpha_n_z_bins"  not  in   config .GMPI .MPI :
33+  config .defrost ()
34+  config .GMPI .MPI .depth2alpha_n_z_bins  =  None 
35+  config .freeze ()
36+ 
37+  if  config .GMPI .MODEL .STYLEGAN2 .torgba_cond_on_pos_enc  !=  "none" :
38+  if  config .GMPI .MODEL .STYLEGAN2 .torgba_cond_on_pos_enc  ==  "depth2alpha" :
39+  print ("\n Generator comes from depth2alpha\n " )
40+  from  gmpi .models .networks .networks_vanilla_depth2alpha  import  Generator  as  StyleGAN2Generator 
41+  elif  config .GMPI .MODEL .STYLEGAN2 .torgba_cond_on_pos_enc  ==  "normalize_add_z" :
4342 if  config .GMPI .MODEL .STYLEGAN2 .torgba_cond_on_pos_enc_embed_func  in  ["learnable_param" ]:
43+  print ("\n Generator comes from learnable_param\n " )
44+  n_g_out_planes  =  config .GMPI .MPI .n_gen_planes 
4445 from  gmpi .models .networks .networks_pos_enc_learnable_param  import  Generator  as  StyleGAN2Generator 
45- 
46-  n_g_out_planes  =  n_g_out_planes  =  config .GMPI .MPI .n_gen_planes 
47-  else :
46+  elif  config .GMPI .MODEL .STYLEGAN2 .torgba_cond_on_pos_enc_embed_func  in  ["modulated_lrelu" ]:
47+  print ("\n Generator comes from cond_on_depth\n " )
4848 from  gmpi .models .networks .networks_cond_on_pos_enc  import  Generator  as  StyleGAN2Generator 
49+  else :
50+  raise  NotImplementedError 
4951 else :
50-  from  gmpi .models .networks .networks_vanilla  import  Generator  as  StyleGAN2Generator 
52+  raise  NotImplementedError 
53+  else :
54+  print ("\n Generator comes from vanilla\n " )
55+  n_g_out_planes  =  config .GMPI .MPI .n_gen_planes 
56+  from  gmpi .models .networks .networks_vanilla  import  Generator  as  StyleGAN2Generator 
5157
5258 synthesis_kwargs  =  convert_cfg_to_dict (config .GMPI .MODEL .STYLEGAN2 .synthesis_kwargs )
5359 synthesis_kwargs_D  =  convert_cfg_to_dict (config .GMPI .MODEL .STYLEGAN2 .synthesis_kwargs )
0 commit comments