锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

StyleClip

时间:2023-10-05 11:37:01 603a系列微差压变送器fce连接器

准备代码
In [1]
!git clone --depth 1 https://github.com/ultranity/PaddleGAN
正克隆到 ‘PaddleGAN’…
remote: Enumerating objects: 568, done.
remote: Counting objects: 100% (568/568), done.
remote: Compressing objects: 100% (500/500), done.
remote: Total 568 (delta 127), reused 273 (delta 48), pack-reused 0
接收对象: 100% (568/568), 21.01 MiB | 3.72 MiB/s, 完成.
处理 delta 中: 100% (127/127), 完成.
检查连接… 完成。
In [6]
#? ~
#!cp work/generator_styleganv2.py PaddleGAN/ppgan/models/generators/
#!cp work/styleganv2clip.py PaddleGAN/applications/tools/
#!cp -r work/apps PaddleGAN/ppgan
/home/aistudio
安装
In [3]
? ~/PaddleGAN/
!pip install -e .
/home/aistudio/PaddleGAN
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Obtaining file:///home/aistudio/PaddleGAN
Preparing metadata (setup.py) … done
Requirement already satisfied: tqdm in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from ppgan2.1.0) (4.27.0)
Requirement already satisfied: PyYAML>=5.1 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from ppgan
2.1.0) (5.1.2)
Collecting scikit-image>=0.14.0
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2d/ba/63ce953b7d593bd493e80be158f2d9f82936582380aee0998315510633aa/scikit_image-0.19.3-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (13.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.5/13.5 MB 6.2 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: scipy>=1.1.0 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from ppgan2.1.0) (1.6.3)
Requirement already satisfied: opencv-python in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from ppgan
2.1.0) (4.1.1.26)
Collecting imageio2.9.0
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/6e/57/5d899fae74c1752f52869b613a8210a2480e1a69688e65df6cb26117d45d/imageio-2.9.0-py3-none-any.whl (3.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 6.2 MB/s eta 0:00:0000:0100:01m
Requirement already satisfied: imageio-ffmpeg in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from ppgan
2.1.0) (0.3.0)
Collecting librosa0.8.1
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/54/19/a0e2bdc94bc0d1555e4f9bc4099a0751da83fa6e1e6157ec005564f8a98a/librosa-0.8.1-py3-none-any.whl (203 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 203.8/203.8 KB 6.2 MB/s eta 0:00:00
Collecting numba
0.53.1
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/bb/73/d9c127eddbe3c105a33379d425b88f9dca249a6eddf39ce886494d49c3f9/numba-0.53.1-cp37-cp37m-manylinux2014_x86_64.whl (3.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 5.7 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: easydict in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from ppgan2.1.0) (1.9)
Collecting munch
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/cc/ab/85d8da5c9a45e072301beb37ad7f833cd344e04c817d97e0cc75681d248f/munch-2.5.0-py2.py3-none-any.whl (10 kB)
Collecting natsort
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a9/76/0f624b7326f4458a249580c55e5654756084ec4572ce37a05f799b96bc24/natsort-8.1.0-py3-none-any.whl (37 kB)
Requirement already satisfied: matplotlib in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from ppgan
2.1.0) (2.2.3)
Requirement already satisfied: numpy in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from imageio2.9.0->ppgan2.1.0) (1.19.5)
Requirement already satisfied: pillow in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from imageio2.9.0->ppgan2.1.0) (8.2.0)
Requirement already satisfied: joblib>=0.14 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from librosa0.8.1->ppgan2.1.0) (0.14.1)
Requirement already satisfied: scikit-learn!=0.19.0,>=0.14.0 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from librosa0.8.1->ppgan2.1.0) (0.24.2)
Collecting pooch>=1.0
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/8d/64/8e1bfeda3ba0f267b2d9a918e8ca51db8652d0e1a3412a5b3dbce85d90b6/pooch-1.6.0-py3-none-any.whl (56 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.3/56.3 KB 2.5 MB/s eta 0:00:00
Requirement already satisfied: soundfile>=0.10.2 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from lirosa0.8.1->ppgan2.1.0) (0.10.3.post1)
Requirement already satisfied: packaging>=20.0 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from librosa0.8.1->ppgan2.1.0) (21.3)
Requirement already satisfied: audioread>=2.0.0 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from librosa0.8.1->ppgan2.1.0) (2.1.8)
Requirement already satisfied: resampy>=0.2.2 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from librosa0.8.1->ppgan2.1.0) (0.2.2)
Requirement already satisfied: decorator>=3.0.0 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from librosa0.8.1->ppgan2.1.0) (4.4.2)
Requirement already satisfied: setuptools in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from numba0.53.1->ppgan2.1.0) (56.2.0)
Collecting llvmlite<0.37,>=0.36.0rc1
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/54/25/2b4015e2b0c3be2efa6870cf2cf2bd969dd0e5f937476fc13c102209df32/llvmlite-0.36.0-cp37-cp37m-manylinux2010_x86_64.whl (25.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 25.3/25.3 MB 6.2 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: networkx>=2.2 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from scikit-image>=0.14.0->ppgan2.1.0) (2.4)
Collecting tifffile>=2019.7.26
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d8/38/85ae5ed77598ca90558c17a2f79ddaba33173b31cf8d8f545d34d9134f0d/tifffile-2021.11.2-py3-none-any.whl (178 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 178.9/178.9 KB 21.4 MB/s eta 0:00:00
Collecting PyWavelets>=1.1.1
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ae/56/4441877073d8a5266dbf7b04c7f3dc66f1149c8efb9323e0ef987a9bb1ce/PyWavelets-1.3.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (6.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.4/6.4 MB 4.4 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: python-dateutil>=2.1 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from matplotlib->ppgan
2.1.0) (2.8.2)
Requirement already satisfied: kiwisolver>=1.0.1 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from matplotlib->ppgan2.1.0) (1.1.0)
Requirement already satisfied: pytz in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from matplotlib->ppgan
2.1.0) (2019.3)
Requirement already satisfied: cycler>=0.10 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from matplotlib->ppgan2.1.0) (0.10.0)
Requirement already satisfied: six>=1.10 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from matplotlib->ppgan
2.1.0) (1.16.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from matplotlib->ppgan2.1.0) (3.0.8)
Requirement already satisfied: requests>=2.19.0 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from pooch>=1.0->librosa
0.8.1->ppgan2.1.0) (2.24.0)
Collecting appdirs>=1.3.0
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Requirement already satisfied: threadpoolctl>=2.0.0 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from scikit-learn!=0.19.0,>=0.14.0->librosa
0.8.1->ppgan2.1.0) (2.1.0)
Requirement already satisfied: cffi>=1.0 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from soundfile>=0.10.2->librosa
0.8.1->ppgan2.1.0) (1.15.0)
Requirement already satisfied: pycparser in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from cffi>=1.0->soundfile>=0.10.2->librosa
0.8.1->ppgan2.1.0) (2.21)
Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from requests>=2.19.0->pooch>=1.0->librosa
0.8.1->ppgan2.1.0) (2019.9.11)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from requests>=2.19.0->pooch>=1.0->librosa
0.8.1->ppgan2.1.0) (1.25.6)
Requirement already satisfied: chardet<4,>=3.0.2 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from requests>=2.19.0->pooch>=1.0->librosa
0.8.1->ppgan2.1.0) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages (from requests>=2.19.0->pooch>=1.0->librosa
0.8.1->ppgan==2.1.0) (2.8)
Installing collected packages: appdirs, tifffile, PyWavelets, natsort, munch, llvmlite, imageio, scikit-image, pooch, numba, librosa, ppgan
Attempting uninstall: llvmlite
Found existing installation: llvmlite 0.31.0
Uninstalling llvmlite-0.31.0:
Successfully uninstalled llvmlite-0.31.0
Attempting uninstall: imageio
Found existing installation: imageio 2.6.1
Uninstalling imageio-2.6.1:
Successfully uninstalled imageio-2.6.1
Attempting uninstall: numba
Found existing installation: numba 0.48.0
Uninstalling numba-0.48.0:
Successfully uninstalled numba-0.48.0
Attempting uninstall: librosa
Found existing installation: librosa 0.7.2
Uninstalling librosa-0.7.2:
Successfully uninstalled librosa-0.7.2
Running setup.py develop for ppgan
Successfully installed PyWavelets-1.3.0 appdirs-1.4.4 imageio-2.9.0 librosa-0.8.1 llvmlite-0.36.0 munch-2.5.0 natsort-8.1.0 numba-0.53.1 pooch-1.6.0 ppgan-2.1.0 scikit-image-0.19.3 tifffile-2021.11.2
WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
You should consider upgrading via the ‘/opt/conda/envs/python35-paddle120-env/bin/python -m pip install --upgrade pip’ command.
In [1]
!pip install paddleclip dlib-bin
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting paddleclip
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/04/c2/54e9cae4fb53fce9f038ba6ad8827525a749c47e74258e21f0e3451b3b85/paddleclip-1.0.0-py3-none-any.whl (1.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 11.6 MB/s eta 0:00:0000:0100:01
Collecting dlib-bin
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/73/04/a27c13bcad9979dde9dec95746fbf77d3122ef30072fe58e2147f8cb46e3/dlib_bin-19.22.0-cp37-cp37m-manylinux2010_x86_64.whl (4.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 10.9 MB/s eta 0:00:0000:0100:01
Collecting ftfy
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e1/1e/bf736f9576a8979752b826b75cbd83663ff86634ea3055a766e2d8ad3ee5/ftfy-6.1.1-py3-none-any.whl (53 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.1/53.1 KB 10.3 MB/s eta 0:00:00
Collecting wget
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/47/6a/62e288da7bcda82b935ff0c6cfe542970f04e29c756b0e147251b2fb251f/wget-3.2.zip (10 kB)
Preparing metadata (setup.py) … done
Collecting regex
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/0f/92/116de5ebb427f567c483768ad15944afb219d36545e09d667338ac3df58e/regex-2022.6.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (749 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 749.7/749.7 KB 11.2 MB/s eta 0:00:00a 0:00:01
Collecting wcwidth>=0.2.5
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/59/7c/e39aca596badaf1b78e8f547c807b04dae603a433d3e7a7e04d67f2ef3e5/wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Building wheels for collected packages: wget
Building wheel for wget (setup.py) … done
Created wheel for wget: filename=wget-3.2-py3-none-any.whl size=9673 sha256=bbf26d163575c6605bf120079c07ba293511fd1c88ff6e68362570e9cb8fc6e8
Stored in directory: /home/aistudio/.cache/pip/wheels/dc/31/7f/a4a4cbe7ae34f1a38f54f2a9fc77c06d20b10d1dc8557eb191
Successfully built wget
Installing collected packages: wget, wcwidth, dlib-bin, regex, ftfy, paddleclip
Attempting uninstall: wcwidth
Found existing installation: wcwidth 0.1.7
Uninstalling wcwidth-0.1.7:
Successfully uninstalled wcwidth-0.1.7
Successfully installed dlib-bin-19.22.0 ftfy-6.1.1 paddleclip-1.0.0 regex-2022.6.2 wcwidth-0.2.5 wget-3.2
WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
You should consider upgrading via the ‘/opt/conda/envs/python35-paddle120-env/bin/python -m pip install --upgrade pip’ command.
生成随机图片
In [14]
%cd ~/PaddleGAN/
!python -u applications/tools/styleganv2.py
–n_row 1 --n_col 1
–output_path ‘/home/aistudio/output_dir’ --model_type ffhq-config-f --seed 1
/home/aistudio/PaddleGAN
[06/16 23:30:17] ppgan INFO: Found /home/aistudio/.cache/ppgan/stylegan2-ffhq-config-f.pdparams
W0616 23:30:20.268061 2162 gpu_context.cc:278] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 10.1
W0616 23:30:20.272033 2162 gpu_context.cc:306] device: 0, cuDNN Version: 7.6.
生成风格向量
In [15]
%cd ~/PaddleGAN/
!python -u applications/tools/pixel2style2pixel.py
–input_image ‘/home/aistudio/output_dir/sample.png’
–output_path ‘/home/aistudio/output_dir’ --model_type ffhq-inversion --seed 2333
/home/aistudio/PaddleGAN
[06/16 23:30:34] ppgan INFO: Found /home/aistudio/.cache/ppgan/pSp-ffhq-inversion.pdparams
W0616 23:30:48.542668 2221 gpu_context.cc:278] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 10.1
W0616 23:30:48.546530 2221 gpu_context.cc:306] device: 0, cuDNN Version: 7.6.
dst.png
原图 重构
StyleCLIP 生成
参数说明:

latent: 要编辑的代表图像的风格向量的路径。可来自于Pixel2Style2Pixel生成的dst.npy或StyleGANv2 Fitting模块生成的dst.fitting.npy
output_path: 生成图片存放的文件夹
weight_path: 或StyleGANv2 预训练模型路径
model_type: 模型类型,当前使用: ffhq-config-f
direction_path: 存放CLIP统计向量的文件路径
stats_path: 存放向量统计数据的文件路径
neutral: 对原图像的中性描述,如 face
target: 为对目标图像的描述,如 young face
beta_threshold: 向量调整阈值
direction_offset: 属性的偏移强度
cpu: 是否使用cpu推理,若不使用,请在命令中去除
!以下 参数需与StyleGAN 预训练模型保持一致

size: 模型参数,输出图片的分辨率
style_dim: 模型参数,风格z的维度
n_mlp: 模型参数,风格z所输入的多层感知层的层数
channel_multiplier: 模型参数,通道乘积,影响模型大小和生成图片质量
-direction_offset- 沿目标属性方向移动的修改强度,参考值为5。

-beta_threshold- 较大的值意味着更强的解纠缠,而使得更少通道被编辑,以使得只有目标属性被更改,但如果beta_threshold太大则不足以执行所需的编辑。较小的值意味着更多的通道被编辑,有可能使其他不相关属性也被更改。

每次操作都会打印被操作的通道数,通常10-20个通道就足够了。对于较大的结构变化,通常需要100-200个通道,需要对应调整beta_threshold和direction_offset的值。

变换对举例

Edit Neutral Text Target Text
Smile face smiling face
Gender female face male face
Blonde hair face with hair face with blonde hair
Hi-top fade face with hair face with Hi-top fade hair
Blue eyes face with eyes face with blue eyes
目前有两套不同随机种子训练所得模型权重可用,生成结果细节有不同

–direction_path=‘stylegan2-ffhq-config-f-styleclip-global-directions.pdparams’
–stat_path=‘stylegan2-ffhq-config-f-styleclip-stats.pdparams’
–direction_path=‘stylegan2-ffhq-config-f-styleclip-global-directions0.pdparams’
–stat_path=‘stylegan2-ffhq-config-f-styleclip-stats0.pdparams’
In [26]
%cd ~
!python PaddleGAN/ppgan/apps/styleganv2clip_predictor.py generate --latent ‘output_dir/dst.npy’
–neutral=‘face’ --target=‘short hair face’
–beta_threshold 0.12 --direction_offset 5
–direction_path=‘stylegan2-ffhq-config-f-styleclip-global-directions.pdparams’
–stat_path=‘stylegan2-ffhq-config-f-styleclip-stats.pdparams’
/home/aistudio
[06/16 23:35:40] ppgan INFO: Found /home/aistudio/.cache/ppgan/stylegan2-ffhq-config-f.pdparams
W0616 23:35:43.785570 3708 gpu_context.cc:278] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 10.1
W0616 23:35:43.789443 3708 gpu_context.cc:306] device: 0, cuDNN Version: 7.6.
max delta_s is 0.2481601983308792
112 channels will be manipulated under the beta threshold 0.12
dst.png
原图 生成
StyleCLIP 训练
在StyleCLIP论文中作者研究了 3 种结合 StyleGAN 和 CLIP 的方法:

文本引导的风格向量优化,使用 CLIP 模型作为损失网络对现有风格向量进行多次迭代更新,但该方法对每次处理都需要重新训练。
训练 风格向量映射器,使CLIP文本特征向量映射至StyleGAN 风格向量空间,避免(1)方法的训练问题,但可控性较差,经论文对比其生成质量也不如(3)。
在 StyleGAN 的 StyleSpace 中,把文本描述映射到输入图像的全局方向 (Global Direction),进而运行自由控制图像操作强度以及分离程度,实现类似于StyleGAN Editing 模块的使用体验。
本次仅复现论文中效果最好的 (3)Global Direction 方法。

StyleCLIP Global Direction 训练过程分两步:

提取风格向量并统计
python styleclip_getf.py
结合CLIP模型计算转换矩阵
python ppgan/apps/styleganv2clip_predictor.py extract
In [27]
!python PaddleGAN/tools/styleclip_getf.py
[06/16 23:36:27] ppgan INFO: Found /home/aistudio/.cache/ppgan/stylegan2-ffhq-config-f.pdparams
W0616 23:36:31.398654 3895 gpu_context.cc:278] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 10.1
W0616 23:36:31.402468 3895 gpu_context.cc:306] device: 0, cuDNN Version: 7.6.
100%|███████████████████████████████████████| 1000/1000 [00:48<00:00, 20.51it/s]
100%|██████████████████████████████████████████| 20/20 [00:00<00:00, 106.77it/s]
100%|███████████████████████████████████████████| 20/20 [00:00<00:00, 35.95it/s]
100%|█████████████████████████████████████████| 980/980 [00:17<00:00, 56.01it/s]
Done.
In [6]
!python PaddleGAN/ppgan/apps/styleganv2clip_predictor.py extract
[05/19 19:35:44] ppgan INFO: Downloading stylegan2-ffhq-config-f.pdparams from https://paddlegan.bj.bcebos.com/models/stylegan2-ffhq-config-f.pdparams to /home/aistudio/.cache/ppgan/stylegan2-ffhq-config-f.pdparams
100%|████████████████████████████████| 194006/194006 [00:02<00:00, 72709.93it/s]
W0519 19:35:51.973740 1169 gpu_context.cc:278] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 10.1, Runtime API Version: 10.1
W0519 19:35:51.977663 1169 gpu_context.cc:306] device: 0, cuDNN Version: 7.6.
total channels to manipulate: 6048

Style manipulation in layer “0”
100%|███████████████████████████████████████| 512/512 [1:46:22<00:00, 12.40s/it]

Style manipulation in layer “2”
100%|███████████████████████████████████████| 512/512 [1:45:44<00:00, 12.39s/it]

Style manipulation in layer “3”
100%|███████████████████████████████████████| 512/512 [1:45:41<00:00, 12.38s/it]

Style manipulation in layer “5”
100%|███████████████████████████████████████| 512/512 [1:45:41<00:00, 12.39s/it]

Style manipulation in layer “6”
100%|███████████████████████████████████████| 512/512 [1:45:41<00:00, 12.39s/it]

Style manipulation in layer “8”
100%|███████████████████████████████████████| 512/512 [1:45:39<00:00, 12.39s/it]

Style manipulation in layer “9”
100%|███████████████████████████████████████| 512/512 [1:45:39<00:00, 12.37s/it]

Style manipulation in layer “11”
100%|███████████████████████████████████████| 512/512 [1:45:39<00:00, 12.38s/it]

Style manipulation in layer “12”
100%|███████████████████████████████████████| 512/512 [1:45:39<00:00, 12.39s/it]

Style manipulation in layer “14”
100%|███████████████████████████████████████| 512/512 [1:45:45<00:00, 12.37s/it]

Style manipulation in layer “15”
100%|█████████████████████████████████████████| 256/256 [52:48<00:00, 12.37s/it]

Style manipulation in layer “17”
100%|█████████████████████████████████████████| 256/256 [53:00<00:00, 12.44s/it]

Style manipulation in layer “18”
100%|█████████████████████████████████████████| 128/128 [26:32<00:00, 12.45s/it]

Style manipulation in layer “20”
100%|█████████████████████████████████████████| 128/128 [26:34<00:00, 12.45s/it]

Style manipulation in layer “21”
100%|███████████████████████████████████████████| 64/64 [13:16<00:00, 12.46s/it]

Style manipulation in layer “23”
100%|███████████████████████████████████████████| 64/64 [13:17<00:00, 12.46s/it]

Style manipulation in layer “24”
100%|███████████████████████████████████████████| 32/32 [06:38<00:00, 12.44s/it]
复现记录
PaddleGAN 实现中的StyleGAN模型将Style Affine层进行了模块耦合,而论文中使用到的S Space 需要用到,因此对StyleGAN 生成器代码也进行了魔改,增加style_affine 及 synthesis_from_styles 方法同时兼容现有接口。
Paddle Resize处理对Tensor和ndarray的处理方法不同,默认Tensor使用BCHW模式存储而非图像的BHWC。
现有 uppfirdn2d 模块中似乎存在多次不必要的Tensor拷贝、reshape过程,希望后续能够优化运算及显存占用。
切片拷贝:paddle中对Tensor进行切片时(有时)会创建新的拷贝,此时再对其进行赋值很可能不生效,两种写法a[ind1][ind2]=0 和 a[ind1, ind2]=0 前者并不改变a中的参数。
StyleCLIP论文中表示使用100张图像进行Global Direction 训练在V1080Ti需要约4h,但使用V100的训练数据及官方repo中也有issue提到实际需要约24h,该问题但作者还未能给出解答.

锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章