Ubuntu 14.04 安装Caffe(CPU) 且支持 PYTHON接口
来源:互联网 发布:网络测试命令 编辑:程序博客网 时间:2024/06/06 12:23
Caffe Installation on Ubuntu 14.04 (CPU) with PYTHON support
本篇文章将会详细的介绍关于Ubuntu14.04系统,安装的Caffe(CPU版)的每个过程。一旦我们安装完成,我们可以通过使用caffe测试
首先,让我们在$HOME下创建一个名为deep-learning的目录,我们将在这个在这个目录里下载所有所需要的包。
cd ~ mkdir deep-learningcd deep-learning
1、建立依赖关系包
为了让caffe编译成功,我们需要首先安装一些依赖包。在终端里执行下面的命令.
提示:博主在亲自安装的时候,发现有些包会安装不上。所以,更换了一些包的安装顺序就可以了。大家可以多试试。
# General Dependencies sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler sudo apt-get install --no-install-recommends libboost-all-dev # BLAS -- for better CPU performance sudo apt-get install libatlas-base-dev # Python -- It comes preinstalled on Ubuntu 14.04 # Required if you want to use Python wrappers for Caffe sudo apt-get install the python-dev # Remaining dependencies sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
安装依赖包的另一版本(上面的三条指令成功,则无需在试!):
sudo apt-get install libatlas-base-devsudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-devsudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
2、编译和安装Caffe
caffe的包被公布在GitHub上。通过在终端输入下面的命令来完成caffe包的克隆。
cd ~/deep-learning git clone http://github.com/BVLC/caffe.git cd caffe
Makefile.config.example文件的内容是验证文件的模板。我们使用他来重写Makefile。config文件。
cp Makefile.config.example Makefile.config
在Makefile.config文件中我们需要设置的是使用CPU还是GPU。打开你最喜欢的编辑器,取消注释CPU_ONLY:=1
8 CPU_ONLY := 1
设置完验证文件后,接下的步骤就是编译caffe了。
make all make test make runtest
注意
可能像下面所示:
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)' .build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)' .build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)' collect2: error: ld returned 1 exit status make: *** [.build_release/tools/caffe.bin] Error 1点击这里可以看到更加详细的解答(点击打开链接)
为了更正这个错误,我们需要在opencv_imgcodecs在176行(可能)添加下面的内容:
174 LIBRARIES += glog gflags protobuf leveldb snappy \ 175 mdb boost_system hdf5_hl hdf5 m \ 176 opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs
现在我们清楚build文件下的所有内容。这是一个很重要的步骤,不然会有其他的错误产生。
rm -rf ./build/*
现在,我们重新开始上面失败的指令。
make all make test make runtest
3、增加PYTHON支持
为了增加python的支持,我们需要在终端下执行下面的命令。我们需要python能够支持运行deepdream下的代码。
cd ~/deep-learning/caffe make pycaffe echo export PYTHONPATH=~/deep-learning/caffe/python:$PYTHONPATH >> ~/.bashrc
4. Running the INCEPTIONISM code
4.1. Download the GoogLeNet model and clone the deepdream GitHub repository.
cd ~/deep-learningwget http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel mv bvlc_googlenet.caffemodel caffe/models/bvlc_googlenet/ git clone https://github.com/google/deepdream.git
4.2. Install the dependencies
sudo pip install "ipython[all]" sudo pip install numpy sudo pip install scipy sudo pip install protobufsudo pip install skimage
4.3. Run the IPython Notebook
cd ~/deep=learning/deepdream ipython notebook
Now the IPython notebook dashboard will open up in your default browser as shown below.
In the list of files, click on dream.ipynb and you will get an output as shown in the figure below.
So, this is it ! Use this IPython Notebook to play with the deepdream code to generate some awesome images. I hope you liked the post and THANK YOU :smile: for reading.
原文:http://hanzratech.in/2015/07/27/installing-caffe-on-ubuntu.html
In this tutorial, I will detail the steps for installing Caffe on a non-GPU(CPU) machine with Ubuntu 14.04 OS. Once we are done with the installation, we’ll also test theGOOGLE INCEPTIONISM (deepdream
) code which uses Caffe. This is a follow up post to my last post –Generating images with Google’s “INCEPTIONISM” – deepdream where I had shared some awesome images generated usingdeepdream
code. So, let’s get our hands dirty straight away.
Firstly, let’s make a directory named deep-learning
in the$HOME
folder where we will download all the packages.
In this tutorial, I will detail the steps for installing Caffe on a non-GPU(CPU) machine with Ubuntu 14.04 OS. Once we are done with the installation, we’ll also test theGOOGLE INCEPTIONISM (deepdream
) code which uses Caffe. This is a follow up post to my last post –Generating images with Google’s “INCEPTIONISM” – deepdream where I had shared some awesome images generated usingdeepdream
code. So, let’s get our hands dirty straight away.
Firstly, let’s make a directory named deep-learning
in the$HOME
folder where we will download all the packages.
In this tutorial, I will detail the steps for installing Caffe on a non-GPU(CPU) machine with Ubuntu 14.04 OS. Once we are done with the installation, we’ll also test theGOOGLE INCEPTIONISM (deepdream
) code which uses Caffe. This is a follow up post to my last post –Generating images with Google’s “INCEPTIONISM” – deepdream where I had shared some awesome images generated usingdeepdream
code. So, let’s get our hands dirty straight away.
Firstly, let’s make a directory named deep-learning
in the$HOME
folder where we will download all the packages.
In this tutorial, I will detail the steps for installing Caffe on a non-GPU(CPU) machine with Ubuntu 14.04 OS. Once we are done with the installation, we’ll also test theGOOGLE INCEPTIONISM (deepdream
) code which uses Caffe. This is a follow up post to my last post –Generating images with Google’s “INCEPTIONISM” – deepdream where I had shared some awesome images generated usingdeepdream
code. So, let’s get our hands dirty straight away.
Firstly, let’s make a directory named deep-learning
in the$HOME
folder where we will download all the packages.
- Ubuntu 14.04 安装Caffe(CPU) 且支持 PYTHON接口
- Ubuntu 14.04上Caffe安装:CPU-Only与GPU支持
- caffe cpu版 Anaconda3 python 接口安装
- caffe 安装,只cpu情况,python接口
- Ubuntu-CPU-Caffe安装
- Ubuntu下安装caffe的Python接口
- cpu caffe cifar10 ubuntu 14.04 python
- Ubuntu 14.04安装caffe only CPU
- Windows+CPU only+VS2013安装caffe以及配置Python接口
- ubuntu14.04下安装caffe 仅cpu python接口
- Windows+CPU only+VS2013安装caffe以及配置Python接口
- Ubuntu 14.04 python caffe 安装
- Ubuntu 14.04 caffe 学习系列一,caffe安装only CPU
- ubuntu安装faster r-cnn(caffe,python,only cpu)
- ubuntu安装cpu版caffe
- Vmware虚拟机安装caffe,Ubuntu安装caffe,CPU only版本
- Ubuntu 16.04上安装Caffe(CPU only)
- Ubuntu安装caffe指南(cpu only)
- 直方图均衡化程序 c++
- 兼容性问题
- 使用HDFS的Java API
- Activity 的生命周期
- jq e.target与e.currentTarget的异同
- Ubuntu 14.04 安装Caffe(CPU) 且支持 PYTHON接口
- lua闭包全面解析
- LeetCode 226. Invert Binary Tree 题解(C++)
- Linux系统用户/文件&用户和组命令 练习案例
- MS CRM 2016 certificate备考摘要(1) - 2016的新功能from MSDN
- HDU_2955 动态规划
- INV-MO-The material sourcing Process failed to create picking suggestions
- 递归与迭代的区别
- 健康的体质