-
Notifications
You must be signed in to change notification settings - Fork 0
/
CDeep3M_V2_colab-installer.sh
161 lines (153 loc) · 5.26 KB
/
CDeep3M_V2_colab-installer.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/bin/bash
#@ Install dependencies
echo "Installing dependencies: Expected runtime 3-5 min."
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
wget \
ssh \
apt-utils \
python-dev \
python-numpy \
python-pip \
python3-pip \
python-setuptools \
python3-setuptools \
python-opencv \
libblas-dev \
liblapack-dev\
libatlas3-base\
libatlas-base-dev\
libprotobuf-dev \
libleveldb-dev \
libsnappy-dev \
libopencv-dev \
libboost-all-dev \
libhdf5-serial-dev \
libgflags-dev \
libgoogle-glog-dev \
liblmdb-dev \
protobuf-compiler \
libboost-all-dev \
build-essential \
cmake \
git \
pkg-config \
libjpeg8-dev \
libgtk2.0-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libv4l-dev \
gfortran \
libleveldb1v5 \
libleveldb-dev \
python3-leveldb \
time \
unzip \
zip \
nano \
mlocate \
graphicsmagick \
graphicsmagick-dbg \
parallel \
octave-pkg-dev && \
apt-get remove --yes --purge --autoremove equivs && \
rm -rf /var/lib/apt/lists/*
# BATS Install
echo "Installing Bats: Expected runtime 2 min."
mkdir -p /home/nd_sense/ /home/nd_sense/BATS
cd /home/nd_sense/BATS && \
git clone https://github.com/bats-core/bats-core.git && \
cd bats-core && \
./install.sh /usr/local
# Build CAFFE
echo "Updating python packages for CAFFE: Expected runtime 3 min."
pip install --upgrade pip
pip2 install wheel
pip2 install joblib requests Cython>=0.19.2 numpy>=1.16.5 scipy>=0.13.2 scikit-image>=0.9.3 matplotlib>=2.0.0 ipython>=5.5.0 h5py>=2.2.0 networkx==1.8.1 nose==1.3.7 pandas==0.24.0 python-dateutil==2.5 protobuf>=2.5.0 python-gflags==2.0 pyyaml>=4.2b1 Pillow==4.3.0 six==1.12
#!pip2 install -r /home/nd_sense/requirements.txt
pip3 install --upgrade pip
sed -i 's/from pip import main/from pip._internal import main/g' /usr/bin/pip3
pip3 install wheel
#!pip3 install -r /home/nd_sense/requirements3.txt
pip3 install h5py joblib requests Cython numpy scipy matplotlib scikit-image ipython leveldb networkx nose pandas python-dateutil protobuf python-gflags pyyaml Pillow six
find . -type f -exec sed -i -e 's^"hdf5.h"^"hdf5/serial/hdf5.h"^g' -e 's^"hdf5_hl.h"^"hdf5/serial/hdf5_hl.h"^g' '{}' \;
cd /usr/lib/x86_64-linux-gnu && \
ln -s libhdf5_serial.so.8.0.2 libhdf5.so && \
ln -s libhdf5_serial_hl.so.8.0.2 libhdf5_hl.so
cd /home/nd_sense/
echo "Downloading CAFFE: Expected runtime 1 min."
git clone https://github.com/haberlmatt/caffe_nd_sense_segmentation
echo "Building CAFFE: Expected runtime 10-15 min."
cd /home/nd_sense/caffe_nd_sense_segmentation/
cp Makefile.config.colab Makefile.config
#Overwrite Makefile to use one that includes OpenCV
rm Makefile
mv Makefile_ocv Makefile
make all -j $(($(nproc) + 1)) && \
make test -j $(($(nproc) + 1)) && \
make pycaffe -j $(($(nproc) + 1)) && \
make distribute -j $(($(nproc) + 1)) && \
cp -r distribute/bin/* /usr/bin/ && \
cp -r distribute/include/* /usr/include/ && \
cp -r distribute/lib/* /usr/lib/ && \
mkdir -p /content/caffe_nd_sense_segmentation/.build_release && \
ln -s /content/caffe_nd_sense_segmentation/distribute/bin /content/caffe_nd_sense_segmentation/.build_release/tools
echo "Building CAFFE completed"
###########################
# Install CDeep3M V1.6.3
###########################
"""
cd /home
rm -r /home/cdeep3m
#!git clone [email protected]:CRBS/cdeep3m.git /home/cdeep3m
git clone https://github.com/CRBS/cdeep3m.git /home/cdeep3m
cd /home/cdeep3m
ls /home/cdeep3m
"""
###########################
# Install CDeep3M2
###########################
#echo "Installing CDeep3M V2.1: Expected runtime 3 min."
#mkdir /home/temp
#cd /home/temp
#git clone https://github.com/CRBS/cdeep3m2.git
#wget https://www.dropbox.com/s/nievvzwu4sslaqg/cdeep3m_v210.zip?dl=0
#unzip /home/temp/cdeep3m_v210.zip?dl=0 -d /home/
#rm /home/temp/*
echo "Installing CDeep3M2: Expected runtime 3 min."
cd /home/
git clone https://github.com/CRBS/cdeep3m2.git
mv /home/cdeep3m2 /home/cdeep3m
#!ls /home/cdeep3m
#%cd /home/cdeep3m/
#!ls /home/cdeep3m/requirements
cd /home/cdeep3m/
pip2 install -r /home/cdeep3m/requirements/py2_cdeep3m_reqs.txt
pip3 install -r /home/cdeep3m/requirements/py3_cdeep3m_reqs.txt
chmod 777 /home/cdeep3m/*
#################
# Set Environment
#################
ENV PATH="/home/cdeep3m/:${PATH}"
ENV PATH="/home/nd_sense/caffe_nd_sense_segmentation/:${PATH}"
ENV CAFFE_PATH=/home/nd_sense/caffe_nd_sense_segmentation
ENV PYTHONPATH="/home/nd_sense/caffe_nd_sense_segmentation/distribute/python:${PYTHONPATH}"
######################################
# Basic tests if installation worked
######################################
if [[ ! -f '/home/nd_sense/caffe_nd_sense_segmentation/.build_release/tools/caffe.bin' ]] ; then
echo 'caffe.bin is missing, your build probably failed.'
exit
fi
if [[ ! -f '/home/nd_sense/caffe_nd_sense_segmentation/.build_release/tools/predict_seg_new.bin' ]] ; then
echo 'predict_seg_new.bin is missing, your caffe build probably failed.'
exit
fi
if [[ ! -f '/home/cdeep3m/runprediction.sh' ]] ; then
echo 'runprediction.sh is missing, your try reinstalling the CDeep3M repository from GitHub into /home/cdeep3m'
exit
fi
echo "Installation of CDeep3M complete"