来源:http://www.knight-of-pi.org/deepdreaming-on-a-raspberry-pi-2/
我的环境 树莓派2 ubuntu16.04 ,
按原博的流程做下来好多出错——好像没人能按那个流程直接做出来——可能是环境不同导致的,做了多处小修改后,完美运行了。
另外,还需要一点点耐心:把putty扔后台,有几个地方半天不动,并不是跑死了,隔半天看一下是不是完成了就行……
Hooray, DeepDream runs on a Raspberry Pi 2! Please see the DeepDream on Ubuntu Linux installation tutorial for references, thanks and more comments on the installation or check out this gallery with deepdream images. This installation was tested on a Raspberry Pi 2; older models are probably too slow for running DeepDream, sadly. The complete installation will take around half a day; alternatively, the psychedelic surveilance camera PsyCam, which is based on DeepDream, could be installed from an Disk Image.
Update Ubuntu
First, the Ubuntu packages have to be refreshed. Do this with
Basic dependency installation
These are the basic dependencies required for installing DeepDream on a Raspberry Pi:
7处 scipy安装超级慢,出去吃个饭啥的比较合适。
Caffe installation
Caffe is the neural network engine used for DeepDream. Install it with
In the now-open file, change the line
to
and replace
with
上面事实上是cpu_only
按照原文编译的时候发生错误,增加两处改动可以解决:
同文件靠近末尾处,添加/usr/include/hdf5/serial/ 到 INCLUDE_DIRS,
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
改为:
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
保存。
然后:
sudo nano Makefile
将 LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
改为 LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
下面这处我没有找到,所以也没有改。
#
Then, open db_lmdb.cpp
with sudo nano ./src/caffe/util/db_lmdb.cpp
and change
to
#
按下面直接1。make all 失败,所以增加了以下几行:
mkdir build
cd build
cmake ..
然后再make all就OK了
Now, everything is ready for installing caffe. Execute in the terminal
下面的准备半天完成吧……
5 我没有成功,改为 sudo apt-get install python-skimage了
In the now open .bashrc
, add at the end of the file
and reload .bashrc
with
Protobuf installation
Protobuf is a framework for structured data and necessary for DeepDream. Install it with
行4,改为 cd protcdobuf-2.6.1
行6,改为sudo make
In the now-open .bashrc
, add at the end of the file
Then, type in the terminal
DeepDream installation
For installing DeepDream, enter
DeepDream usage
Running the DeepDream notebook was not tested, since loading the graphical Desktop environment takes too much RAM for the already exhausted Raspberry Pi. There is, however, the script deepdreaming.py
in this repository, which lets the Raspberry Pi deepdream from the ubuntu terminal.
Execute the script with
运行这一条出现了 no ipython错误,所以 pip install --upgrade IPython
to let the Raspi dream. To get some help, enter
Copy the images onto a host computer with scp for watching them.
The script was tested for a maximum input image width of 500px that did not crash the Raspberry Pi; i’d love to hear back if other image sizes work, too. The script is under development right now: another blog post on its usage will follow soon…
The complete script (beta)
Click on Full Script
to show all of the code.