Skip to content

小学期作业,基于华为mindspore框架的stylegan2-ada,以及简单的反投影和编辑

License

Notifications You must be signed in to change notification settings

GhostCai/stylegan2-ada-mindspore

Repository files navigation

MindSpore版的StyleGAN2-ada,以及简单的反投影(使用ModelZoo的VGG16实现lpips loss)以及属性编辑

image-20230818161105253

安装

conda install mindspore=2.1.0 -c mindspore -c conda-forge
pip install torch rich pretty_errors face_alignment dlib tqdm
  • NVlabs/stylegan2-ada-pytorch获取stylegan2-ffhq-config-f.pkl,放置到./ckpt下,
  • official/cv/VGG/vgg16获取vgg16_bn_ascend_v170_imagenet2012_official_cv_top1acc74.33_top5acc92.1.ckpt,改名为vgg16.ckpt,放置到./ckpt下。
  • http://dlib.net/files/获取shape_predictor_68_face_landmarks.dat.bz2,解压后将shape_predictor_68_face_landmarks.dat放置到./ckpt下。

运行

首先得到mindspore版的权重

python 1.convert-to-mindspore.py

随机生成图片

python 2.generate-using-seeds.py

反投影图片(以obama.png为例)

python 3.project-real-image.py

说明

大量参考了https://github.com/NVlabs/stylegan2-ada-pytorch

实现不完全正确,可能有精度问题,图像输出和torch版本相差较大,同时自定义算子都采用了最笨的实现方式,速度也慢许多。

About

小学期作业,基于华为mindspore框架的stylegan2-ada,以及简单的反投影和编辑

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published