williamyang1991 / VToonify

[SIGGRAPH Asia 2022] VToonify: Controllable High-Resolution Portrait Video Style Transfer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

seems pretrain model is not used

JohnnieXDU opened this issue · comments

Hi, nice work, appreciate it! But two questions confuse me.

  1. in train_vtoonify_d.py, for pre-training, why save the weights of g_ema in line 172 / 387? Looks g_ema.eval() keep the weights unchanged, and g is the generator should to be trained.

  2. after pre-training, in full train process, looks the pre-trained model is not loaded (from vtoonifu_d_cartoon/pretrain.pth).

Thanks!

This part updates g_ema with g, so its weight changes.

accumulate(g_ema.encoder, g_module.encoder, accum)
accumulate(g_ema.fusion_out, g_module.fusion_out, accum)
accumulate(g_ema.fusion_skip, g_module.fusion_skip, accum)

This part loads pre-trained model

if self.opt.encoder_path is None:
self.opt.encoder_path = os.path.join('./checkpoint/', self.opt.name, 'pretrain.pt')

if not args.pretrain:
generator.encoder.load_state_dict(torch.load(args.encoder_path, map_location=lambda storage, loc: storage)["g_ema"])

thanks a lot :D appreciate it ~

one more question, could you please provide the full pipeline for training all nets from scratch? just a brief flowchart works fine for me, just a little bit confusing since training ALL-models looks tough. :(

we only has two steps
pretrain the encoder (train the green part) and train the full network (train the green and blue parts).

image

Thanks! By the way, what does ema in g_ema mean? (non-abbrevation version is?)

exponential running average
rosinality/stylegan2-pytorch#34

thanks a lot!