Skip to content

Various applications based on Stylegan2 Style mixing that can be inference on cpu.

License

Notifications You must be signed in to change notification settings

TalkUHulk/realworld-stylegan2-encoder

Repository files navigation

RealWorld StyleGan2 Encoder


The demo of different style with age edit.

Description

Various applications based on Stylegan2 Style mixing that can be inference on cpu.

Citation

This code is heavily based on stylegan2-pytorch. Thanks rosinality so much to make his work available 🙏🙏🙏

Application


The demo of different style of psp-mobile-256p.


The demo of different style of psp-res50-256p.


The demo of different style of e4e-mobile-1024p.


The demo of different style of e4e-res50-1024p.


The demo of different style with age edit of e4e-res50-1024p

The demo of different style with gender edit of e4e-res50-1024p

The demo of different style with pose edit of e4e-res50-1024p

The demo of different style with smile edit of e4e-res50-1024p

Pretrained Models

I provide some of the model to test.

Google Drive 百度云 Description
torch weight torch weight 密码:0mgk cartoon of e4e-mbv3 1024p and psp-mbv3 256p
onnx weight onnx weight 密码:inn8 stylegan2 onnx, cartoon of e4e-mbv3 1024p and psp-mbv3 256p
openvino weight openvino weight 密码:759q openvino cartoon of e4e-mbv3 1024p and psp-mbv3

Comparison

All test on MacOs 11.4 | 2.6 GHz Intel Core i7 | 32 GB 2667 MHz DDR4

pSp-mbv3-256p

Name Time(s)
torch 1.9860
onnx 0.5869
openvino 0.4533

e4e-mbv3-1024p

Name Time(s)
torch 4.8058
onnx 1.5155
openvino 0.8690

Test

torch

python scripts/test.py \
--ckpt ./best_model.pt \
--network psp \
--platform torch \
--align \
--images_path ./test_images

onnx

python scripts/test.py \
--ckpt ./cartoon_psp_mobile_256p.onnx \
--network psp \
--platform onnx \
--align \
--images_path ./test_images

openvino

python scripts/test.py \
--ckpt_encoder ./art_mobile_encoder_1024p \
--ckpt_decoder ./art_decoder_1024p \
--network e4e \
--platform openvino \
--align \
--images_path ./test_images \
--edit \
--edit_direction ./editings/smile.npy

Convert

torch2onnx

function can find in tools/torch2onnx.py

onnx2openvino

Inference Engine version: 2021.4.0-3839-cd81789d294-releases/2021/4 Model Optimizer version: 2021.4.0-3839-cd81789d294-releases/2021/4

python3 mo.py \
--input_model psp_mobile_256p.onnx \
--output_dir ./openvino  \
--data_type FP16 \
--mean_values [127.5,127.5,127.5] \
--scale_values [127.5,127.5,127.5] \
--move_to_preprocess

About

Various applications based on Stylegan2 Style mixing that can be inference on cpu.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published