StyleMapGAN、有趣的风格迁移——评测【一】

简介: 一文读懂
🥇 版权: 本文由【墨理学AI】原创、各位大佬、一文读懂、敬请查阅
🎉 声明: 作为全网 AI 领域 干货最多的博主之一,❤️ 不负光阴不负卿 ❤️
声明:本博文按照官方readMe步骤,对测试实验过程进行简洁记录,仅供参考,码字不易,感谢支持

📔 StyleMapGAN 继 StyleGAN2 发扬光大

论文摘要

生成对抗网络 (GAN) 从随机潜在向量合成逼真的图像。 尽管操纵潜在向量控制了合成输出,但使用 GAN 编辑真实图像存在以下问题:i) 将真实图像投影到潜在向量的优化耗时,ii) 或通过编码器嵌入不准确。 我们提出 StyleMapGAN:中间潜在空间具有空间维度,并且空间变体调制替代了 AdaIN。 它使通过编码器的嵌入比现有的基于优化的方法更准确,同时保持 GAN 的特性。 实验结果表明,我们的方法在各种图像处理任务(例如本地编辑和图像插值)中明显优于最先进的模型。 最后但并非最不重要的一点是,GAN 上的传统编辑方法在我们的 StyleMapGAN 上仍然有效。

📕 环境搭建

服务器:ubuntu1~18.04 Quadro RTX 5000 16G

1-0

#!/bin/bash

conda install -y pytorch=1.4.0 torchvision=0.5.0 -c pytorch
conda install -y numpy=1.18.1 scikit-image=0.16.2 tqdm
conda install -y -c anaconda ipython=7.13.0
pip install lmdb==0.98 opencv-python==4.2.0.34 munch==2.5.0
pip install -U scikit-image==0.15.0 scipy==1.2.1 matplotlib scikit-learn
pip install flask==1.0.2 pillow==7.0.0
我博文已经搭建了很多环境,因此这里直接 activate 一个即可
conda activate torch15

📗 测试数据 + 预训练模型准备

2-0

这里 下载 afhq 相关数据 + 模型,对其进行测试
# Download raw images and create LMDB datasets using them
# Additional files are also downloaded for local editing
bash download.sh create-lmdb-dataset afhq

# Download the pretrained network (256x256)
bash download.sh download-pretrained-network-256 afhq

# Download the pretrained network (1024x1024 image / 16x16 stylemap / Light version of Generator)
bash download.sh download-pretrained-network-1024 ffhq_16x16


__

📘 Generate images 测试

__

🔴 Reconstruction

Reconstruction Results are saved to expr/reconstruction.
python generate.py --ckpt expr/checkpoints/afhq_256_8x8.pt --mixing_type reconstruction --test_lmdb data/afhq/LMDB_test
单卡 GPU 占用 11073MiB

3-0

reconstruction 目录下是对 afhq_raw\raw_images\test\images 目录下 500 test 图像的 重建:

3-1

🔴 Unaligned transplantation

Unaligned transplantation Results are saved to expr/transplantation. It shows local transplantations examples of AFHQ.
python generate.py --ckpt expr/checkpoints/afhq_256_8x8.pt --mixing_type transplantation --test_lmdb data/afhq/LMDB_test
transplantation 目录下是一个图像的合成转换:

3-2

🔴 w_interpolation

Results are saved to expr/w_interpolation.
python generate.py --ckpt expr/checkpoints/afhq_256_8x8.pt  --mixing_type w_interpolation --test_lmdb data/afhq/LMDB_test
单卡 GPU 占用 8769MiB

3-3

🔴 local_editing

Results are saved to expr/local_editing. We pair images using a target semantic mask similarity.
目标 mask 语义修复
python generate.py --ckpt expr/checkpoints/afhq_256_8x8.pt --mixing_type local_editing --test_lmdb data/afhq/LMDB_test
单卡 GPU 占用 9013MiB
  • mask 图像

3-4

local_editing\afhq\synthesized_image

3-5

🔴 Random Generation

Random Generation Results are saved to expr/random_generation. It shows random generation examples.
python generate.py --mixing_type random_generation --ckpt expr/checkpoints/afhq_256_8x8.pt
单卡 GPU 占用 12995MiB

3-6

🔴 Style Mixing

Style Mixing Results are saved to expr/stylemixing. It shows style mixing examples.
python generate.py --mixing_type stylemixing --ckpt expr/checkpoints/afhq_256_8x8.pt --test_lmdb data/afhq/LMDB_test
单卡 GPU 占用 8765 MiB
  • 粗修复结果: 124_coarse.png

3-7

  • 细修复结果: 124_fine.png

3-8

🔴 Semantic Manipulation 【 celeba_hq 可正常运行】

Semantic Manipulation Results are saved to expr/semantic_manipulation.
It shows local semantic manipulation examples.
python semantic_manipulation.py --ckpt expr/checkpoints/afhq_256_8x8.pt --LMDB data/afhq/LMDB --svm_train_iter 10000
单卡 GPU 占用 6455MiB
遇到报错 | Semantic Manipulation 应该暂时只有 celeba_hq 可以使用和运行
validate boundary.
Accuracy for validation set: 535 / 999 = 0.535536
classifier.coef_.shape (1, 4096)
boundary.shape (64, 8, 8)
30000 images, 16130 latent_codes
Traceback (most recent call last):
  File "semantic_manipulation.py", line 348, in <module>
    assert total_number == len(latent_codes)
AssertionError

📙 博主 AI 领域八大干货专栏、诚不我欺


📙 预祝各位 2022 前途似锦、可摘星辰

🎉 作为全网 AI 领域 干货最多的博主之一,❤️ 不负光阴不负卿 ❤️
❤️ 如果文章对你有帮助、 点赞、评论鼓励博主的每一分认真创作
❤️ 比寻找温暖更重要的是,让自己成为一盏灯火 ❤️

8.png

相关实践学习
基于阿里云DeepGPU实例,用AI画唯美国风少女
本实验基于阿里云DeepGPU实例,使用aiacctorch加速stable-diffusion-webui,用AI画唯美国风少女,可提升性能至高至原性能的2.6倍。
目录
相关文章
|
2月前
|
机器学习/深度学习 人工智能 安全
千帆大模型平台再升级:接入大模型最多、Prompt模板最全面
千帆大模型平台再升级:接入大模型最多、Prompt模板最全面
83 1
|
安全 搜索推荐 数据可视化
|
3月前
|
弹性计算 Apache PHP
[开发者评测|e实例]
阿里云推出全新经济型e实例
27 0
|
8月前
|
自然语言处理 知识图谱
中文大模型体验评测
中文大模型体验评测
|
3月前
|
测试技术 调度 云计算
开发者评测|e实例
阿里云推出全新经济型e实例,为个人开发者、学生、小微企业带来福音 随着云计算技术的日益普及,越来越多的个人开发者、学生、小微企业开始选择使用云服务器来搭建自己的网站、开发测试应用等。
39 0
|
7月前
|
自然语言处理 人工智能
中文竞技场大模型测评后续之模型自动对话
中文竞技场大模型测评延续中,模型自动对话场景测评
308 0
中文竞技场大模型测评后续之模型自动对话
|
11月前
|
微服务
「参考架构模型」使用ArchiMate的参考企业架构模型
「参考架构模型」使用ArchiMate的参考企业架构模型
|
数据采集 机器学习/深度学习 自然语言处理
基于文心大模型套件ERNIEKit实现文本匹配算法,模块化方便应用落地
文心大模型开发套件ERNIEKit,面向NLP工程师,提供全流程大模型开发与部署工具集,端到端、全方位发挥大模型效能。
基于文心大模型套件ERNIEKit实现文本匹配算法,模块化方便应用落地
|
机器学习/深度学习 数据可视化 TensorFlow
使用风格迁移让汉子变成套马的汉子
使用风格迁移让汉子变成套马的汉子
94 0
使用风格迁移让汉子变成套马的汉子

热门文章

最新文章