-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
233 lines (162 loc) · 6.47 KB
/
Dockerfile
File metadata and controls
233 lines (162 loc) · 6.47 KB
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
MAINTAINER Atabak Dehban <adehban@isr.tecnico.ulisboa.pt>
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
curl \
git \
libcurl3-dev \
libfreetype6-dev \
libhdf5-serial-dev \
libpng12-dev \
libzmq3-dev \
pkg-config \
python-dev \
rsync \
tmux \
software-properties-common \
unzip \
zip \
zlib1g-dev \
wget \
python-tk \
g++-4.8 \
gcc-4.8 \
python-numpy \
vim \
&& \
rm -rf /var/lib/apt/lists/*
RUN rm /usr/bin/g++ && \
rm /usr/bin/gcc && \
ln -s /usr/bin/g++-4.8 /usr/bin/g++ && \
ln -s /usr/bin/gcc-4.8 /usr/bin/gcc
# Eigen
RUN git clone --branch=3.3.0 https://github.com/eigenteam/eigen-git-mirror.git && \
cd eigen-git-mirror && \
mkdir build && \
cd build && \
cmake .. && \
make && \
make install
WORKDIR /
RUN curl -fSsL -O https://bootstrap.pypa.io/pip/2.7/get-pip.py && \
python get-pip.py && \
rm get-pip.py
RUN pip --no-cache-dir install \
Pillow \
matplotlib \
numpy \
cython \
easydict \
scipy \
enum34 \
transforms3d \
pyyaml \
pillow
# opencv
RUN git clone --branch=3.4.1 https://github.com/opencv/opencv.git && \
cd opencv && \
mkdir build && \
cd build && \
cmake -DBUILD_TIFF=ON -DBUILD_opencv_java=OFF -DWITH_CUDA=ON -DENABLE_AVX=ON -DWITH_OPENGL=OFF \
-DWITH_OPENCL=ON -DWITH_TBB=ON -DWITH_EIGEN=ON -DWITH_V4L=ON -DWITH_VTK=OFF -DWITH_FFMPEG=OFF \
-DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DINSTALL_PYTHON_EXAMPLES=ON \
-DWITH_IPP=OFF -DWITH_ITT=OFF -DCUDA_ARCH_BIN=6.1 .. && \
make -j && \
make install && \
ldconfig
WORKDIR /
# Set up Bazel.
# Running bazel inside a `docker build` command causes trouble, cf:
# https://github.com/bazelbuild/bazel/issues/134
# The easiest solution is to set up a bazelrc file forcing --batch.
RUN echo "startup --batch" >>/etc/bazel.bazelrc
# Similarly, we need to workaround sandboxing issues:
# https://github.com/bazelbuild/bazel/issues/418
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
>>/etc/bazel.bazelrc
# Install the most recent bazel release.
ENV BAZEL_VERSION 0.10.0
WORKDIR /
RUN mkdir /bazel && \
cd /bazel && \
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \
chmod +x bazel-*.sh && \
./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
cd / && \
rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh
# Download and build TensorFlow.
WORKDIR /tensorflow
RUN git clone --branch=r1.8 --depth=1 https://github.com/tensorflow/tensorflow.git .
# Configure the build for our CUDA configuration.
ENV CI_BUILD_PYTHON python
ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
ENV TF_NEED_CUDA 1
ENV TF_CUDA_COMPUTE_CAPABILITIES=6.1
ENV TF_CUDA_VERSION=9.0
ENV TF_CUDNN_VERSION=7
RUN pip --no-cache-dir install \
h5py \
ipykernel \
keras_applications \
keras_preprocessing \
mock \
scipy \
sklearn \
pandas \
&& \
python -m ipykernel.kernelspec
RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 && \
LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:${LD_LIBRARY_PATH} \
tensorflow/tools/ci_build/builds/configured GPU \
bazel build -c opt --config=cuda \
tensorflow/tools/pip_package:build_pip_package && \
rm /usr/local/cuda/lib64/stubs/libcuda.so.1 && \
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/pip && \
pip --no-cache-dir install --upgrade /tmp/pip/tensorflow-*.whl && \
rm -rf /tmp/pip && \
rm -rf /.cache
# Clean up pip wheel and Bazel cache when done.
WORKDIR /
# Install nlopt
RUN git clone https://github.com/stevengj/nlopt.git && \
cd nlopt && \
git checkout 74e647b667f7c4500cdb4f37653e59c29deb9ee2 && \
mkdir build && \
cd build && \
cmake .. && \
make install
WORKDIR /
RUN echo hello
# Install PoseCNN
RUN git clone https://github.com/atabakd/PoseCNN.git
# download VGG-16.npy
RUN curl -c /tmp/cookie.txt -s -L "https://drive.google.com/uc?export=download&id=1UdmOKrr9t4IetMubX-y-Pcn7AVaWJ2bL" |grep confirm | sed -e\
"s/^.*confirm=\(.*\)&id=.*$/\1/" | xargs -I{} curl -b /tmp/cookie.txt -L -o vgg16.npy "https://drive.google.com/uc?confirm={}&export=d\
ownload&id=1UdmOKrr9t4IetMubX-y-Pcn7AVaWJ2bL"
RUN mv vgg16.npy /PoseCNN/data/imagenet_models/
# dwonload model
RUN curl -c /tmp/cookie.txt -s -L "https://drive.google.com/uc?export=download&id=1UNJ56Za6--bHGgD3lbteZtXLC2E-liWz" |grep confirm | sed -e\
"s/^.*confirm=\(.*\)&id=.*$/\1/" | xargs -I{} curl -b /tmp/cookie.txt -L -o demo_models.zip "https://drive.google.com/uc?confirm={}&ex\
port=download&id=1UNJ56Za6--bHGgD3lbteZtXLC2E-liWz"
RUN mv demo_models.zip /PoseCNN/data/demo_models && \
unzip /PoseCNN/data/demo_models/demo_models.zip -d /PoseCNN/data/demo_models/ && \
rm /PoseCNN/data/demo_models/demo_models.zip
RUN mkdir /PoseCNN/data/LOV/data
WORKDIR /PoseCNN/lib
RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 && \
LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:${LD_LIBRARY_PATH} && \
sh make.sh
# from https://github.com/Kaju-Bubanja/PoseCNN
RUN rm /usr/bin/g++ && \
ln -s /usr/bin/g++-5* /usr/bin/g++ && \
sed -i '64s/^/\/\//' /usr/local/cuda/include/crt/common_functions.h && \
python setup.py build_ext --inplace && \
sed -i '64s/^\/\///' /usr/local/cuda/include/crt/common_functions.h && \
rm /usr/bin/g++ && \
ln -s /usr/bin/g++-4.8 /usr/bin/g++
ENV PYTHONPATH /PoseCNN/lib:$PYTHONPATH
WORKDIR /PoseCNN
#RUN LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:${LD_LIBRARY_PATH} && \
CMD ./tools/demo.py --gpu 0 --network vgg16_convs --model data/demo_models/vgg16_fcn_color_single_frame_2d_pose_add_lov_iter_160000.ckpt --imdb lov_keyframe --cfg experiments/cfgs/lov_color_2d.yml --rig data/#LOV/camera.json --cad data/LOV/models.txt --pose data/LOV/poses.txt --background data/cache/backgrounds.pkl