neural-style

学习画作风格,将风格施加到另外一张图片中

例如将名画《星夜》的风格施加到一副建筑照片中:

【图片】机器学习--名画风格 neural-style

源码 https://github.com/jcjohnson/neural-style

安装步骤:

  1.torch7

  2.loadcaff

  torch7的安装详见 前文:开源 人脸识别 openface 实用介绍 实例演示 训练自己的模型

  loadcaff的安装:

1 sudo apt-get install libprotobuf-dev protobuf-compiler
2 git clone https://github.com/szagoruyko/loadcaffe.git
3 cd loadcaffe
4 luarocks install loadcaffe-1.0-0.rockspec

  neural-style的安装:

1 git clone https://github.com/jcjohnson/neural-style.git
2 cd neural-style
3 sh models/download_models.sh

  经过第三步,下载好模型之后就可以运行了。注意,内存占用较大,一定要有足够内存否则不能运行,建议分配9GB内存,虚拟机宿主机最好有16GB内存。

  试运行:使用CPU模式(-gpu -1),此时cpu核心全开,cpu核数越多越快,4核3.3GHz 跑完一次大约需要40分钟。

th neural_style.lua -gpu -1 -print_iter 1

  基本功能:使用style_image作为风格,content_image为等待修改图片,程序会自动合成第三张图片。

th neural_style.lua -gpu -1 -print_iter 1 -style_image <image.jpg> -content_image <image.jpg> 

   网上找了一张川普的动感图:

【图片】机器学习--名画风格 neural-style

给女神施加一下:

【图片】机器学习--名画风格 neural-style

结果:

【图片】机器学习--名画风格 neural-style

 =========完=========

2017年4月16日

  

 

相关文章:

  • 2021-12-15
  • 2021-05-27
  • 2021-04-17
  • 2021-07-21
  • 2021-09-13
  • 2021-04-14
  • 2022-03-06
  • 2021-12-04
猜你喜欢
  • 2021-08-30
  • 2021-09-17
  • 2021-04-29
  • 2021-07-19
  • 2021-11-27
  • 2021-12-04
相关资源
相似解决方案