-
Notifications
You must be signed in to change notification settings - Fork 9
/
build_all.sh
78 lines (65 loc) · 2.65 KB
/
build_all.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
#!/usr/bin/env bash
# adapted from build.sh from AIQ
NUMPROCS=`cat /proc/cpuinfo | grep "processor" | wc -l`
# update the submodules: Caffe and Dense Flow
git submodule update --remote
# install Caffe dependencies
sudo apt-get -qq install libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libatlas-base-dev
sudo apt-get -qq install --no-install-recommends libboost-all-dev
sudo apt-get -qq install libgflags-dev libgoogle-glog-dev liblmdb-dev
# adapt from Yjxiong's code
# install common dependencies: OpenCV
# adpated from OpenCV.sh
version="2.4.13"
echo "Building OpenCV" $version
[[ -d 3rd-party ]] || mkdir 3rd-party/
cd 3rd-party/
if [ ! -d "opencv-$version" ]; then
echo "Installing OpenCV Dependenices"
sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils
echo "Downloading OpenCV" $version
wget -O OpenCV-$version.zip https://github.com/Itseez/opencv/archive/$version.zip
echo "Extracting OpenCV" $version
unzip OpenCV-$version.zip
fi
echo "Building OpenCV" $version
cd opencv-$version
[[ -d build ]] || mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_TBB=ON -D WITH_V4L=ON ..
if make -j $NUMPROCS ; then
#cp lib/cv2.so ../../../
echo "OpenCV" $version "built."
else
echo "Failed to build OpenCV. Please check the logs above."
exit 1
fi
cd ../../../
# install compensated dense flow toolbox,
# alternative, you can install it from Wang Limin's toolbox: https://github.com/yjxiong/dense_flow
# build dense_flow
echo "Building dense_flow"
cd lib/dense_flow
[[ -d src-build ]] || mkdir src-build
cd src-build
OpenCV_DIR=../../../3rd-party/opencv-$version/build/ cmake ../src -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF
if make -j $NUMPROCS ; then
echo "Dense Flow built."
else
echo "Failed to build Dense Flow. Please check the logs above."
exit 1
fi
cd ../../../
# install my-very-deep-caffe, adapt from TSN's script
cd lib/my-very-deep-caffe
[[ -d cmake-build ]] || mkdir cmake-build
cd cmake-build
OpenCV_DIR=../../../3rd-party/opencv-$version/build/ cmake .. -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF
if make -j $NUMPROCS install ; then
echo "Caffe built."
echo "All tools built. Happy experimenting!"
cd ../../../
else
echo "Failed to build Caffe. Please check the logs above."
exit 1
fi