在centos上运行neural_artistic_style 风格转换

一开始在git上面发现了一个我很喜欢的项目:

就是输入两个图片,一个做subject一个做style模板.之后把subject图转换成和模板风格差不多的图像如上图!

话不多说直接下载!

这是那一整个文件的结构,有1个目录和19个文件。主体是3个.py文件!

如何运行呢?

Execute

python neural_artistic_style.py --subject images/tuebingen.jpg --style images/starry_night.jpg

那个git主写得运行方式是这样运行!可是我运行的时候发生了问题!当然肯定会有问题的啦 我连numpy都没有装!

所以就是在运行neural_artistic_style.py时候第五行 import numpy时python不知道这个numpy是什么,简单的说就是没有

装numpy!

而这里先简单地介绍一下numpy :(从numpy官网上看的!)

NumPy is the fundamental package for scientific computing with Python. It contains among other things:

  • a powerful N-dimensional array object
  • sophisticated (broadcasting) functions
  • tools for integrating C/C++ and Fortran code
  • useful linear algebra, Fourier transform, and random number capabilities

Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional container of generic data. Arbitrary data-types can be defined. This allows NumPy to seamlessly and speedily integrate with a wide variety of databases.

 简而言之numpy 就是用来弥补python 数值计算的垃圾性能。毕竟数值运算还是用C/C++厉害一点。所以有人就写了一整套

数值运算的C-API 来当作python的库函数!

 

在 http://www.numpy.org/ 下找到getting numpy的连接按照提示去下载.

 

 1 用unzip numpy-1.12.1.zip 解压之并且进入该文件夹

 2 用python setup.py install 安装之

但是遇到了很多问题,很多先要安装的东西都没有安装!上网查了查才知道:原来上官网去安装神烦要各种配置path 预安装其他包

所以如果不想管这破事就直接安装这个!

Enthought Canopy:一个集合了numpy scipy matplotlib 等包的大包而且很方便!

 

结果证明一个一个包下载安装会好很多!

建议看这个博客 http://www.cnblogs.com/luxiaorui/p/3931061.html

第一个包 numpy 和 scipy 包

sudo yum -y install gcc gcc-c++ numpy python-devel scipy(这一句话就搞定了。不用什么手动安装包)

第二个包 pip源头安装包

sudo yum install python-pip

第三个包cython(用pip安装)

第四个包cudarray

 

第五个包 deeppy 

然后就是运行 deeppy 安装之!

根据安装依赖的话deeppy 是需要cudarray

 

这里选择了没有cuda支持的安装方式

第6个包是pil 但是直接pip install PIL 会出现很多问题。所以换成装 pillow

pip install pillow

最后一个元素就是安装 模型文件。从http://www.vlfeat.org/matconvnet/pretrained/这里下载。 

imagenet-vgg-verydeep-19 

原文地址:https://www.cnblogs.com/zzzPark/p/6625976.html