PPGN代码安装测试

即插即用神经网络

本笔记记录在ubuntu14.10+python2.7下的caffe环境配置和跑通全部PPGN测试样例


源码https://github.com/Evolving-AI-Lab/ppgn

1. Setup

1.1 Installing software

This code is built on top of Caffe. You'll need to install the following:

1.1.1 Install Caffe; follow the official installation instructions.

见笔记http://blog.csdn.net/lien0906/article/details/46816273

1.1.2 Build the Python bindings for Caffe

If you want to try example 5 (image captioning), you would need to use the Caffe provided here instead

这个意思是用绑定了python的caffe包代替一般的caffe。

1.1.3 You can optionally build Caffe with the GPU option to make it run faster (recommended)

将1.1.2中下载的caffe_lrcn-master文件夹中的Makefile.config.example原地赋值一份并重命名为Makefile.config,打开该文件,将CPU_ONLY := 1前面的#去掉(也就是反注释),选择只用cpu

1.1.4 Make sure the path to your caffe/python folder in settings.py is correct

settings.py中的caffe_root="/home/bigbug/caffe_lrcn-master"

1.1.5 Install ImageMagick command-line interface on your system (for post-processing the images)

ubuntu系统中默认安装了ImageMagick,可以通过ubuntu终端输入identify -version查看版本信息

1.2 Downloading models

1.2.1 You will need to download a few models to run the examples below. There are download.sh scripts provided for your convenience.

cd到对应的.sh文件回车即可。

generator.caffemodel

bvlc_reference_caffenet.caffemodel

placesCNN.tar.gz

lrcn_caffenet_iter_110000.caffemodel

1.2.2 Settings:

  • Paths to the downloaded models are in settings.py. They are relative and should work if the download.sh scripts run correctly.
settings.py中的caffe_root="/home/bigbug/caffe_lrcn-master",其他路径在默认下载之后保持不变。

2. Usage

Examples

We provide here 5 different examples as a starting point. Feel free to fork away to produce even cooler results!

1_class_conditional_sampling.sh: Sampling conditioning on the class "junco" (output unit #13 of the CaffeNet DNN trained on ImageNet dataset). This script produces a sampling chain for a single given class.

  • Running ./1_class_conditional_sampling.sh 13
注意:这个.sh文件需要一个参数,例如13

另外,如果运行报错ImportError no module named caffe,说明python和caffe的接口没有设置好,方法为:

1)、更改配置文件

sudo vim ~/.bashrc

打开的文件末尾输入两行

#caffe

export PYTHONPATH=/home/bigbug/caffe_lrcn-master/python

保存

source ~/.bashrc

2)、安装其他接口模块

先安装

sudo apt-get install python-numpy python-scipy python-matplotlib python-sklearn python-skimage python-h5py python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags Cython ipython

再更新

sudo apt-get update

最后在/home/bigbug/caffe_lrcn-master路径下执行

make pycaffe -j8

3)、测试

在终端输入python进入python环境,输入命令import caffe,没有出现报错即可,再输入exit()返回ubuntu终端

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值