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},
}