This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
install_caffe.sh
executable file
·90 lines (76 loc) · 1.99 KB
/
install_caffe.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# create caffe snap folder
mkdir "../dataset/MNIST/result"
cd ..
mkdir "3rd"
sudo chmod 777 ./3rd
cd "3rd" || exit
# openBLS
#sudo apt-get install -y libopenblas-dev
# atlas
sudo apt-get install -y libatlas-base-dev liblapack-dev libblas-dev
# protobuf
#! /bin/bash
if type protoc >/dev/null 2>&1; then
echo 'protobuf already installed'
else
echo 'installing protobuf'
sudo apt-get install autoconf automake libtool curl make g++ unzip -y
git clone https://github.com/google/protobuf.git
cd protobuf || exit
git checkout 3.3.x
git submodule update --init --recursive
./autogen.sh
./configure
make -j12
make check
sudo make install
sudo ldconfig
cd ..
fi
# OpenCV
if [ ! -d "./opencv" ]; then
git clone https://github.com/opencv/opencv
fi
cd opencv ||exit
git checkout 3.4
mkdir build
cd build ||exit
cmake ..
sudo make install -j"$(nproc)"
cd ../..
# levelDB
sudo apt install -y libleveldb-dev libsnappy-dev
# lmdb
sudo apt install -y liblmdb-dev
# other dependencies
sudo apt install -y libgoogle-glog-dev libgflags-dev libgflags-dev libhdf5-dev libturbojpeg0-dev libopenblas-dev
# caffe
if type nvcc >/dev/null 2>&1; then
echo 'cuda detected, use nvidia caffe'
if [ ! -d "./caffe" ]; then
git clone https://github.com/twoentartian/caffe.git
fi
cd caffe ||exit
cp ../../shell/caffe_config/Makefile.config .
cp ../../shell/caffe_config/CMakeLists.txt .
make all -j"$(nproc)"
protoc src/caffe/proto/caffe.proto --cpp_out=.
mkdir include/caffe/proto
mv src/caffe/proto/caffe.pb.h include/caffe/proto
else
echo 'cuda not detected, use BLVC caffe'
if [ ! -d "./caffe" ]; then
git clone https://github.com/BVLC/caffe.git
fi
cd caffe ||exit
cp ../../shell/caffe_config/Makefile.config .
cp ../../shell/caffe_config/CMakeLists.txt .
make all -j"$(nproc)"
protoc src/caffe/proto/caffe.proto --cpp_out=.
mkdir include/caffe/proto
mv src/caffe/proto/caffe.pb.h include/caffe/proto
fi
# patch caffe
cd ../../shell || exit
sh ./patch_caffe.sh