การใช้งาน Pytorch อย่างเป็นทางการ

วิดีโอประกอบสามารถพบได้บน YouTube สำหรับรายละเอียดเพิ่มเติมโปรดดูที่กระดาษ
pip install -r requirements.txt
python train.py --cfg configs/mobile_stylegan_ffhq.json --gpus < n_gpus > เฟรมเวิร์กของเรารองรับรูปแบบจุดตรวจ Stylegan2 จาก Rosinality/Stylegan2-Pytorch ในการแปลง CKPT จุดตรวจของคุณเองของ 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 > เราให้บริการไลบรารีภายนอกแบบสุ่มเป็นตัวอย่างของการปรับใช้โมเดลของเราที่อุปกรณ์ขอบโดยใช้เฟรมเวิร์ก OpenVino
| ชื่อ | บด |
|---|---|
| Mobilestylegan_ffhq.ckpt | 7.75 |
(*) เฟรมเวิร์กของเรารองรับการดาวน์โหลดแบบอัตโนมัติรุ่นที่ผ่านการฝึกอบรมเพียงแค่ใช้ --ckpt <pretrined_model_name>
| รหัส | แหล่งที่มา | ใบอนุญาต |
|---|---|---|
| เคอร์เนล cuda ที่กำหนดเอง | https://github.com/nvlabs/stylegan22 | ใบอนุญาต 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},
}