Unofficial PyTorch implementation of Surrogate Gradient Field for Latent Space Manipulation
- PyTorch
- dlib
- OpenCV
- StyleGAN2 model (from rosinality/stylegan2-pytorch)
- shape_predictor_68_face_landmarks.dat (link)
- Face Parsing model (from zllrunning/face-parsing.PyTorch)
- Face Attributes Classifier (my checkpoint)
- Auxiliary Mapping (my checkpoint)
Run python translate_keypoints.py
. This script aligns the face keypoints of a randomly generated image with another randomly generated image.
- Create a Classifier Network on
models/classifier.py
. - Run
make_dataset.py
to create a dataset by generating images and classifiering their properties.python make_dataset.py \ --size [images size of stylegan2] \ --g_ckpt [the pretrained checkpoint of stylegan2] \ --data_dir [where you want to save training data] \ --n_sample 200000 \ --batch 8 \ --truncation 0.8
- Run
train.py
.python train.py \ --total_iter 500000 \ --data_dir data \ --batch 8 \ --n_layer 15
StyleGAN2 codes and model are from rosinality/stylegan2-pytorch.
Face-Parsing codes and checkpoint are from Zllrunning/face-parsing.PyTorch.
senet.py
is from cydonia999/VGGFace2-pytorch, and the face attributes classifier model was transfer trained from pretrained weights provided by the above repository.