Created
June 21, 2017 08:35
-
-
Save zeakey/527fae08040edd1156c82a10c928ab11 to your computer and use it in GitHub Desktop.
Script for caffe installation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# install common deps | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install -y build-essential cmake make | |
sudo apt-get install --no-install-recommends libboost-all-dev | |
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler | |
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev | |
sudo apt-get install libatlas-base-dev | |
sudo apt-get install python-dev | |
# install OpenCV | |
if [[ "$(which opencv_version)" == '' ]]; then | |
echo "Installing OpenCV ..." | |
sudo bash install-opencv.sh | |
fi | |
# install python deps | |
if [[ "$(which pip)" == '' ]]; then | |
curl https://bootstrap.pypa.io/get-pip.py | |
# alternative link for CN users | |
# curl http://zhaok-data.oss-cn-shanghai.aliyuncs.com/service/get-pip.py | sudo -H python | |
else | |
sudo -H pip install --upgrade pip | |
fi | |
sudo -H pip install numpy scipy Cython | |
if [ ! -d /usr/lib/python2.7/dist-packages/numpy ]; then | |
sudo ln -s /usr/local/lib/python2.7/dist-packages/numpy /usr/lib/python2.7/dist-packages/numpy | |
fi | |
echo '#numpy include path' >> ~/.bashrc | |
echo 'export CPATH=/usr/local/lib/python2.7/dist-packages/numpy/core/include:$CPP_INCLUDE_PATH' >> ~/.bashrc | |
echo 'export CPATH=/usr/local/lib/python2.7/dist-packages/numpy/core/include:$C_INCLUDE_PATH' >> ~/.bashrc | |
. ~/.bashrc | |
sudo apt-get install python-tk # tkinter cannot install with pip | |
sudo -H pip install scikit-image scikit-learn | |
sudo -H pip install matplotlib | |
sudo -H pip install ipython jupyter | |
sudo -H pip install protobuf | |
sudo -H pip install h5py leveldb lmdb | |
sudo -H pip install networkx nose | |
sudo -H pip install pandas | |
sudo -H pip install python-dateutil | |
sudo -H pip install python-gflags pyyaml Pillow six pyzmq singledispatch | |
sudo -H pip install backports_abc certifi jsonschema graphviz qtawesome pydot | |
# clone latest caffe source code | |
cd ~/ && git clone https://github.com/BVLC/caffe --depth 1 && cd caffe | |
mkdir build && cd build | |
cmake -DCPU_ONLY=ON .. && make -j$(nproc) | |
## some other cmake examples ## | |
# build with cuda, cudnn and nccl | |
# cmake -USE_NCCL=ON -DNCCL_INCLUDE_DIR=/pkg/nccl/include -DNCCL_LIBRARIES=/pkg/nccl/lib \ | |
# -DCUDNN_INCLUDE=/usr/local/cudnn/include -DCUDNN_LIBRARY=/usr/local/cudnn/lib64 .. | |
echo "Done! Built caffe source at '~/caffe'" | |
# try caffe MNIST example: | |
# cd ~/caffe | |
# bash data/mnist/get_mnist.sh | |
# bash examples/mnist/create_mnist.sh | |
# bash examples/mnist/train_lenet.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment