MobileStyleGAN.pytorch
initial public release
Pytorch官方实施

随附的视频可以在YouTube上找到。有关更多详细信息,请参阅论文。
pip install -r requirements.txt
python train.py --cfg configs/mobile_stylegan_ffhq.json --gpus < n_gpus > 我们的框架支持Rosinality/stylegan2-Pytorch的stylegan2检查点格式。要将您自己的stylegan2检查站转换为我们的框架:
python convert_rosinality_ckpt.py --ckpt < path_to_rosinality_stylegan2_ckpt > --ckpt-mnet < path_to_output_mapping_network_ckpt > --ckpt-snet < path_to_output_synthesis_network_ckpt > --cfg-path < path_to_output_config_json >要检查检查点是否正确转换,只需运行演示可视化:
python demo.py --cfg < path_to_output_config_json > --ckpt " " --generator teacherpython generate.py --cfg configs/mobile_stylegan_ffhq.json --device cuda --ckpt < path_to_ckpt > --output-path < path_to_store_imgs > --batch-size < batch_size > --n-batches < n_batches > 为了评估FID分数,我们使用Pytorch-FID库的修改版本:
python evaluate_fid.py < path_to_ref_dataset > < path_to_generated_imgs > 使用Mobilestylegan运行演示可视化:
python demo.py --cfg configs/mobile_stylegan_ffhq.json --ckpt < path_to_ckpt >使用stylegan2 vs. mobilestylegan进行视觉比较:
python compare.py --cfg configs/mobile_stylegan_ffhq.json --ckpt < path_to_ckpt > python train.py --cfg configs/mobile_stylegan_ffhq.json --ckpt < path_to_ckpt > --export-model onnx --export-dir < output_dir > python train.py --cfg configs/mobile_stylegan_ffhq.json --ckpt < path_to_ckpt > --export-model coreml --export-dir < output_dir > 我们提供外部库Random_face作为使用OpenVino框架在边缘设备上部署模型的示例。
| 姓名 | fid |
|---|---|
| MobileStyLegan_FFHQ.CKPT | 7.75 |
(*)我们的框架支持自动下载预处理的型号,只需使用--ckpt <pretrined_model_name>即可。
| 代码 | 来源 | 执照 |
|---|---|---|
| 自定义CUDA内核 | https://github.com/nvlabs/stylegan2 | NVIDIA许可证 |
| stylegan2块 | https://github.com/rosinality/stylegan2-pytorch | 麻省理工学院 |
我们要感谢那些为我们的项目做出贡献的人们::
如果您正在使用此工作的结果和代码,请将其引用为:
@misc{belousov2021mobilestylegan,
title={MobileStyleGAN: A Lightweight Convolutional Neural Network for High-Fidelity Image Synthesis},
author={Sergei Belousov},
year={2021},
eprint={2104.04767},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@article{BELOUSOV2021100115,
title = {MobileStyleGAN.pytorch: PyTorch-based toolkit to compress StyleGAN2 model},
journal = {Software Impacts},
year = {2021},
issn = {2665-9638},
doi = {https://doi.org/10.1016/j.simpa.2021.100115},
url = {https://www.sciencedirect.com/science/article/pii/S2665963821000452},
author = {Sergei Belousov},
}