准备使用艺术深度学习算法
neurartist的Python项目详细描述
神经艺术家
各种艺术深度学习的现成实施 算法。
- 使用卷积神经网络的图像样式传输,gatys等。 艾尔,2016年
- 控制神经风格转换中的知觉因素。 艾尔,2016年
安装
# It is recommended to install torch/torchvision manually before this command, according to your hardware configuration (see below) pip install neurartist
请注意,建议使用GPU,如CNN计算 在CPU上相当慢。
nb对于gpu用户:pip与cuda一起发布torch/torchvision。 工具包9.0。如果使用最新版本的CUDA工具包,请参见 的PyTorch website Pythorch与其他版本的 工具箱。
用法
控制台入口点
# Then see the builtin help for usage details neurartist --help
有关最常见的用例,请参见下面的示例。
库
import neurartist
待添加。
示例
- 基本用法:将图像的样式应用于内容图像,而 保留语义内容。
neurartist -c content.jpg -s style.jpg
- 颜色控制:应用样式,但保留内容的颜色 形象。
# Luminance only neurartist -c content.jpg -s style.jpg --color-control luminance_only # Luminance only, luma normalized neurartist -c content.jpg -s style.jpg --color-control luminance_only --cc-luminance-only-normalize # Color histogram matching neurartist -c content.jpg -s style.jpg --color-control histogram_matching
-
风格LIIN:混合风格1的粗略信息(更高)
层)具有Style2(较低层)的精细比例信息,
创建混合样式以应用于内容图像。
neurartist -c style1.jpg -s style2.jpg -o mixed.png --content-layers [22,29] --style-layers [1,6] neurartist -c content.jpg -s mixed.png
- 高效高分辨率:第一遍是低分辨率样式 第二,有效捕捉粗尺度样式特征的传输 pass是一种高分辨率的样式转换,它可以将 第一关,用细刻度填充丢失的细信息 风格特征。
neurartist -c content.jpg -s style.jpg -o lowres.png -S 500 neurartist -c content.jpg -s style.jpg -o highres.png -S 1000 --init-image-path lowres.png
- 空间控制:有制导通道的制导gram矩阵。 制导路径应包含黑白制导图像(带有 与内容和样式图像的大小比率相同),定义 每个图像语义区域的边界。样式引导图像 和内容指导图像应该有相同的名称,在 对应于语义区域。图像分割应该 详尽无遗。
neurartist -c content.jpg -s style.jpg --content-guidance content_image_guidance_path/ --style-guidance style_image_guidance_path/ --guidance-propagation-method inside
开发
强烈推荐使用水蟒:
conda create python=3.7 --name neurartist_env conda activate neurartist_env # with gpu conda install pytorch torchvision cudatoolkit=<your cudatoolkit version> -c pytorch conda install --file requirements.txt # with cpu conda install pytorch-cpu torchvision-cpu -c pytorch conda install --file requirements.txt
然后,您可以使用以下命令直接运行主入口点:
python -m neurartist --help
或者使用--editable标志生成并安装控制盘文件。
待办事项
- 文件。
- 实施总变化损失(见 this)。
- 实现引导求和。
- 检查是否需要为 没有被任何通道覆盖的像素(在 但很模糊)。简而言之:是的,它是需要的,更大的 内核大小样式传输不在边界处执行。
- 对于导航通道传播:研究它们的含义 “侵蚀”(见原始链接的补充材料文件 条款)。
- Semantic segmentation as described in this article as to limit spillovers:不同 比引导的gram矩阵更接近,但是使用空间 用于描述 图像。
- 更深入的艺术算法。