流程是:使用StyleGAN-encoder获取自己图片的潜码,然后替换到StyleFlow,直接上代码
1.安装配置环境-StyleFlow
git clone https://github.com/justinjohn0306/StyleFlow.git

cd StyleFlow
conda env create -f env_windows.yml

conda activate styleflow
conda install pytorch1.2.0 torchvision0.4.0 cudatoolkit=10.0 -c pytorch

期间遇到两个bug,都是以下两条命令解决了
pip install --upgrade protobuf
pip install --upgrade numpy
pip install streamlit
cd webui
streamlit run app.py
即可编辑随机生成人脸的表情,需要编辑我们自己的图片,还需要我们先前说的StyleGAN-encoder,可以参考我先前的文章配置环境
https://blog.csdn.net/zs858570636/article/details/105260018?spm=1001.2014.3001.5501
2.使用StyleGAN-encoder获得潜码
python align_images.py raw_images/ aligned_images/
aligned_images文件夹生成人脸图片

python encode_images.py aligned_images/ generated_images/ latent_representations/

记住潜码文件目录,一会要替换到StyleFlow E:\StyleFlow\stylegan2encoder\latent_representations\36_01.npy
3.修改StyleFlow潜码
raw_w[‘Latent’][2][0] = np.load(r"E:\StyleFlow\stylegan2encoder\latent_representations\21_01.npy")

(styleflow) PS E:\StyleFlow\webui> streamlit run app.py

现在就可以编辑自己想要编辑的图片效果了

1512

被折叠的 条评论
为什么被折叠?



