mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-13 00:23:51 -07:00
update GAN model
This commit is contained in:
parent
54fc3162ed
commit
11add4cd4f
2 changed files with 7 additions and 7 deletions
|
@ -94,7 +94,7 @@ class UNetPatchDiscriminator(nn.ModelBase):
|
||||||
ts *= s
|
ts *= s
|
||||||
return rf
|
return rf
|
||||||
|
|
||||||
def find_archi(self, target_patch_size, max_layers=6):
|
def find_archi(self, target_patch_size, max_layers=9):
|
||||||
"""
|
"""
|
||||||
Find the best configuration of layers using only 3x3 convs for target patch size
|
Find the best configuration of layers using only 3x3 convs for target patch size
|
||||||
"""
|
"""
|
||||||
|
@ -106,12 +106,12 @@ class UNetPatchDiscriminator(nn.ModelBase):
|
||||||
|
|
||||||
layers = []
|
layers = []
|
||||||
sum_st = 0
|
sum_st = 0
|
||||||
|
layers.append ( [3, 2])
|
||||||
|
sum_st += 2
|
||||||
for i in range(layers_count-1):
|
for i in range(layers_count-1):
|
||||||
st = 1 + (1 if val & (1 << i) !=0 else 0 )
|
st = 1 + (1 if val & (1 << i) !=0 else 0 )
|
||||||
layers.append ( [3, st ])
|
layers.append ( [3, st ])
|
||||||
sum_st += st
|
sum_st += st
|
||||||
layers.append ( [3, 2])
|
|
||||||
sum_st += 2
|
|
||||||
|
|
||||||
rf = self.calc_receptive_field_size(layers)
|
rf = self.calc_receptive_field_size(layers)
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ class UNetPatchDiscriminator(nn.ModelBase):
|
||||||
self.upres1 = []
|
self.upres1 = []
|
||||||
self.upres2 = []
|
self.upres2 = []
|
||||||
layers = self.find_archi(patch_size)
|
layers = self.find_archi(patch_size)
|
||||||
|
|
||||||
level_chs = { i-1:v for i,v in enumerate([ min( base_ch * (2**i), 512 ) for i in range(len(layers)+1)]) }
|
level_chs = { i-1:v for i,v in enumerate([ min( base_ch * (2**i), 512 ) for i in range(len(layers)+1)]) }
|
||||||
|
|
||||||
self.in_conv = nn.Conv2D( in_ch, level_chs[-1], kernel_size=1, padding='VALID')
|
self.in_conv = nn.Conv2D( in_ch, level_chs[-1], kernel_size=1, padding='VALID')
|
||||||
|
|
|
@ -152,10 +152,10 @@ Examples: df, liae, df-d, df-ud, liae-ud, ...
|
||||||
self.options['gan_power'] = np.clip ( io.input_number ("GAN power", default_gan_power, add_info="0.0 .. 1.0", help_message="Forces the neural network to learn small details of the face. Enable it only when the face is trained enough with lr_dropout(on) and random_warp(off), and don't disable. The higher the value, the higher the chances of artifacts. Typical fine value is 0.1"), 0.0, 1.0 )
|
self.options['gan_power'] = np.clip ( io.input_number ("GAN power", default_gan_power, add_info="0.0 .. 1.0", help_message="Forces the neural network to learn small details of the face. Enable it only when the face is trained enough with lr_dropout(on) and random_warp(off), and don't disable. The higher the value, the higher the chances of artifacts. Typical fine value is 0.1"), 0.0, 1.0 )
|
||||||
|
|
||||||
if self.options['gan_power'] != 0.0:
|
if self.options['gan_power'] != 0.0:
|
||||||
gan_patch_size = np.clip ( io.input_int("GAN patch size", default_gan_patch_size, add_info="3-640", help_message="The higher patch size, the higher the quality, the more VRAM is required. Typical fine value is resolution / 8." ), 3, 640 )
|
gan_patch_size = np.clip ( io.input_int("GAN patch size", default_gan_patch_size, add_info="3-640", help_message="The higher patch size, the higher the quality, the more VRAM is required. You can get sharper edges even at the lowest setting. Typical fine value is resolution / 8." ), 3, 640 )
|
||||||
self.options['gan_patch_size'] = gan_patch_size
|
self.options['gan_patch_size'] = gan_patch_size
|
||||||
|
|
||||||
gan_dims = np.clip ( io.input_int("GAN dimensions", default_gan_dims, add_info="16-512", help_message="The dimensions of the GAN network. Change this value only if you want to experiment. Typical fine value is 16." ), 16, 512 )
|
gan_dims = np.clip ( io.input_int("GAN dimensions", default_gan_dims, add_info="4-64", help_message="The dimensions of the GAN network. The higher dimensions, the more VRAM is required. You can get sharper edges even at the lowest setting. Typical fine value is 16." ), 4, 64 )
|
||||||
self.options['gan_dims'] = gan_dims
|
self.options['gan_dims'] = gan_dims
|
||||||
|
|
||||||
if 'df' in self.options['archi']:
|
if 'df' in self.options['archi']:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue