StyleFlow编辑自己的表情

流程是:使用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
在这里插入图片描述
现在就可以编辑自己想要编辑的图片效果了

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值