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)_第1张图片
stylegan-encoder(实践-4)_第2张图片
1.4提取头部图片

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

2.1安装包依赖

pip install tqdm
stylegan-encoder(实践-4)_第5张图片
2.2运行代码

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

手动下载后,放在项目根目录,然后修改代码
stylegan-encoder(实践-4)_第6张图片
stylegan-encoder(实践-4)_第7张图片
2.2.2运行代码
python encode_images.py aligned_images/ generated_images/ latent_representations/
stylegan-encoder(实践-4)_第8张图片
结果
stylegan-encoder(实践-4)_第9张图片
stylegan-encoder(实践-4)_第10张图片
stylegan-encoder(实践-4)_第11张图片
stylegan-encoder(实践-4)_第12张图片
3.Jupyter Notebook的使用

3.1安装使用

pip install jupyter

pip install matplotlib

jupyter notebook

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

Loss最后收敛在0.5504198
stylegan-encoder(实践-4)_第13张图片
stylegan-encoder(实践-4)_第14张图片
stylegan-encoder(实践-4)_第15张图片
stylegan-encoder(实践-4)_第16张图片
感觉效果不太好
stylegan-encoder(实践-4)_第17张图片
微信号:herry7788

你可能感兴趣的:(Stylegan)