lucidrains / stylegan2-pytorch

Simplest working implementation of Stylegan2, state of the art generative adversarial network, in Pytorch. Enabling everyone to experience disentanglement
https://thispersondoesnotexist.com
MIT License
3.68k stars 592 forks source link

Transfer Learning #50

Open MorningAISeeker opened 4 years ago

MorningAISeeker commented 4 years ago

Is it possible to use a pre-trained model (for example FFHQ) as a starting point?

dancrew32 commented 4 years ago

I am curious how this works for GANs. Do you just train FFHQ maximally then completely change out the dataset until it adapts?

MorningAISeeker commented 4 years ago

@dancrew32 . Yes. I've seen in various articles that transfer learning for GANs is a common task. for example, this link.

dancrew32 commented 4 years ago

@lucidrains this seems like the best way to create a model instead of building ones from scratch. Say you train until you get high quality results with FFHQ (https://github.com/NVlabs/ffhq-dataset). How would you go about branching models to a brand new dataset?

Given this directory structure:

/datasets
  /ffhq
    /1.jpg, /2.jpg, /3.jpg, ...
  /my_dataset
    /a.jpg, /b.jpg, /c.jpg, ...
/models
   /ffhq
     /model_120.pt
/results
   /ffhq

Does it make sense to clone the /models/ffhq/ directory and rename it to my_transfer1, then continue training on a completely new dataset (/datasets/my_dataset) like this?

/datasets
  /ffhq
    /1.jpg, /2.jpg, /3.jpg, ...
  /my_dataset
    /a.jpg, /b.jpg, /c.jpg, ...
/models
   /ffhq
     /model_120.pt
   /my_transfer1
     /model_120.pt
/results
   /ffhq
   /my_transfer
stylegan2_pytorch --name=my_transfer1 --data=/datasets/my_dataset