Play with caffe on ubuntu

1. Using system python

#!/bin/sh
sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install -y --no-install-recommends libboost-all-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
sudo apt-get install gfortran

cd ~/src
git clone https://github.com/BVLC/caffe.git

cd caffe
cp Makefile.config.example Makefile.config
# Adjust Makefile.config 
# set CPU_ONLY
# set MATLAB_DIR
make all
make test
make runtest

cd caffe
sudo pip install -r requirements.txt
make pycaffe

But errors may occur while piping. Anaconda is a good substitution.

Or, you can try pip install package in requirements.txt one by one.

2. Using anaconda

#!/bin/sh
sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install -y --no-install-recommends libboost-all-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

cd ~/
git clone https://github.com/BVLC/caffe.git

cd ~/Downloads
wget https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh
chmod +x Anaconda2-4.2.0-Linux-x86_64.sh
./Anaconda2-4.2.0-Linux-x86_64.sh

# edit Makefile.conf
# set CPU_ONLY
# set USE_OPENCV
# set OPENCV_VERSION
# set ANACONDA_HOME (check path carefully!)
# set PYTHON_INCLUDE
# set PYTHON_LIB
# set WITH_PYTHON_LAYER
cd ~/caffe
make all
make test
make runtest
make pycaffe

# using anaconda python
source ~/.bashrc

export PYTHONPATH=$PYTHONPATH:~/caffe/python
python -c 'import caffe'

If no error occurs, done.

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值