stylegan-encoder(实践-4)

1.Extract and align faces from images

1.1下载代码

git clone Puzer/stylegan-encoder

conda activate tensorflow

1.2Windows10 conda安装dlib包

conda install -c conda-forge dlib

1.3http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2下载报错

先用迅雷下载然后修改代码
stylegan-encoder(实践-4)
stylegan-encoder(实践-4)
1.4提取头部图片

在根目录新建文件夹raw_images(存放原始图片)与aligned_images
stylegan-encoder(实践-4)
python align_images.py raw_images/ aligned_images/
stylegan-encoder(实践-4)
结果
stylegan-encoder(实践-4)
2.Find latent representation of aligned images

2.1安装包依赖

pip install tqdm
stylegan-encoder(实践-4)
2.2运行代码

2.2.1因为网络问题无法下载karras2019stylegan-ffhq-1024x1024.pkl

手动下载后,放在项目根目录,然后修改代码
stylegan-encoder(实践-4)
stylegan-encoder(实践-4)
2.2.2运行代码
python encode_images.py aligned_images/ generated_images/ latent_representations/
stylegan-encoder(实践-4)
结果
stylegan-encoder(实践-4)
stylegan-encoder(实践-4)
stylegan-encoder(实践-4)
stylegan-encoder(实践-4)
3.Jupyter Notebook的使用

3.1安装使用

pip install jupyter

pip install matplotlib

jupyter notebook

3.2用杨紫的头像进行人脸属性编辑

Loss最后收敛在0.5504198
stylegan-encoder(实践-4)
stylegan-encoder(实践-4)
stylegan-encoder(实践-4)
stylegan-encoder(实践-4)
感觉效果不太好
stylegan-encoder(实践-4)
微信号:herry7788