对于有GAN的model怎么理解config文件 #2135
Unanswered
yyhtbs-yye
asked this question in
How-to
Replies: 1 comment
-
似乎是默认的? 在
is_disc (bool) 也就是说在设置了generator和discriminator之后。之前定义gan_loss会同时用在两个模型G/D上?只是配置不一样? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
哈喽,
想把TecoGAN移植进来MMagic试试,但是因为GAN有G和D两个模型要Train。一般判别器D貌似也不是用pretrained的。这种情况下训练的configure文件怎么写呢?
我看了一下ESRGAN的配置
esrgan_x4c64b23g32_1xb16-400k_div2k.py
...
generator=dict(
type='RRDBNet',
in_channels=3,
out_channels=3,
mid_channels=64,
num_blocks=23,
growth_channels=32,
upscale_factor=scale,
init_cfg=dict(
type='Pretrained',
checkpoint=pretrain_generator_url,
prefix='generator.')),
discriminator=dict(type='ModifiedVGG', in_channels=3, mid_channels=64),
pixel_loss=dict(type='L1Loss', loss_weight=1e-2, reduction='mean'),
perceptual_loss=dict(
type='PerceptualLoss',
layer_weights={'34': 1.0},
vgg_type='vgg19',
perceptual_weight=1.0,
style_weight=0,
norm_img=False),
gan_loss=dict(
type='GANLoss',
gan_type='vanilla',
loss_weight=5e-3,
real_label_val=1.0,
fake_label_val=0),
...
这里能看到3个loss。按照原文,感觉这三个应该是generator的loss。但是discriminator的loss难道是最后的
gan_loss
么?这里从代码的角度,不太理解MMagic是如何联系和区分“生成器和判别器的定义”和“loss的定义”。
Beta Was this translation helpful? Give feedback.
All reactions