-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
133 lines (101 loc) · 5.42 KB
/
Dockerfile
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
# WACV18 Monocular 3D hand pose estimation Docker
# This docker file builds a working environment for
# WACV18.
# NOTE: This is also part of a docker 101 tutorial
# so the comments are very verbose.
# For this build we will use ubuntu18.04
# We will start from the nvidia provided image that also
# comes with cuda and cudnn and drivers preinstalled.
# Note: There are many containers available.
# Before starting your own Dockerfile make sure you find the
# closest image to your needs to avoid re-creating the wheel.
FROM nvcr.io/nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04
# COPY from host to docker image.
# NOTE: Make sure you first download the models using the
# getModels.sh script inside the models folder
# COPY models openpose/models/
# Install basic dependencies for our project
# Some packages need user input during configuration.
# Since docker build is supposed to be unattended we pass the
# appropriate ENV variables to configure everything
# without dialogs (in this case tzdata package)
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A4B469963BF863CC
RUN apt-get update
RUN DEBIAN_FRONTEND="noninteractive" TZ="Europe/Athens" apt-get install -y tzdata
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y libboost-all-dev libpython-dev python-pip \
git cmake vim libgoogle-glog-dev libprotobuf-dev protobuf-compiler \
libhdf5-dev libatlas-base-dev liblmdb-dev libleveldb-dev \
libsnappy-dev wget unzip apt-utils libpython-dev python-numpy \
libtbb-dev libglew-dev libopenni-dev libglm-dev freeglut3-dev libeigen3-dev \
ffmpeg x264 libx264-dev \
libgtk2.0-dev pkg-config
# needed by MonoHand3D
RUN pip install scipy
# define a working directory for our application or shell
WORKDIR /wacv18
# NOTE: Each of the following RUN commands is executed on a new shell
# starting at WORKDIR
# NOTE: Openpose needs opencv with CUDA support. Because of that we have to build it from source
# since the prepackaged binaries provided by Ubuntu do not have GPU support.
# Otherwise we could just do: RUN apt-get install -y libopencv-dev
# Build opencv
RUN mkdir opencv && cd opencv && wget https://github.com/opencv/opencv/archive/3.4.11.zip && unzip 3.4.11.zip && rm 3.4.11.zip && \
mkdir build && cd build && \
cmake -DWITH_CUDA=ON -DBUILD_EXAMPLES=OFF -DOPENCV_GENERATE_PKGCONFIG=ON ../opencv-3.4.11 && \
make -j`nproc` && make install
# WACV18 is an old project. The current version Openpose is not compatible any more.
# We clone and checkout the last compatible version (see PyOpenpose README).
RUN git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git && \
cd openpose && git checkout e38269862f05beca9497960eef3d35f9eecc0808 && \
git submodule update --init --recursive
# NOTE: Openpose comes with a CMake build system.
# Unfortunatelly the commit we are using here has a bug that breaks the caffe build system for
# GPUs newer than Pascal. So we are using the old Makefiles for this Dockerfile.
# Build caffee
COPY config/Makefile.config.caffe openpose/3rdparty/caffe/Makefile.config
RUN cd openpose/3rdparty/caffe/ && \
make all -j`nproc` && make distribute -j`nproc`
# Build Openpose
COPY config/Makefile.config.openpose openpose/Makefile.config
RUN cd openpose && cp ubuntu_deprecated/Makefile.example Makefile && \
make all -j`nproc` && make distribute -j`nproc`
# This would be normally done by cmake but since we used the Makefiles for openpose build:
RUN cp -r openpose/3rdparty/caffe/distribute/* openpose/distribute && \
ln -s /workspace/models openpose/distribute/models
# NOTE: Each command creates a new image LAYER.
# Group commands together to minimize the number of layers and speed-up build/startup times.
# Setup environment variables needed by PyOpenpose
# Environment variables are set in the image and inherited by the container.
# applications running in the container have access to these environment vars.
ENV OPENPOSE_ROOT=/wacv18/openpose/distribute
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${OPENPOSE_ROOT}/lib"
# Build PyOpenPose
RUN git clone https://github.com/FORTH-ModelBasedTracker/PyOpenPose.git && \
mkdir PyOpenPose/build && cd PyOpenPose/build && cmake .. && \
make -j`nproc` && make install
# Build MBV
# Note: For Ubuntu 16.04 install these extra debs: RUN apt-get install -y libxmu-dev libxi-dev
COPY projects/mbv mbv
RUN mkdir mbv/build && cd mbv/build && \
cmake -DWITH_Physics=OFF -DWITH_Examples=OFF .. && \
make -j`nproc` && make install
# PyCvUtils
COPY projects/PyCvUtils PyCvUtils
ENV MBV_SDK=/usr/local
ENV MBV_APPS=/usr/local
ENV PYTHONPATH="${PYTHONPATH}:/wacv18/PyCvUtils/src:${MBV_SDK}/lib"
# Build Ceres
RUN mkdir ceres && cd ceres && wget http://ceres-solver.org/ceres-solver-1.13.0.tar.gz && \
tar -zxvf ceres-solver-1.13.0.tar.gz && mkdir build && cd build && \
cmake ../ceres-solver-1.13.0 && make -j`nproc` && make install
# Build LevmarIK
COPY projects/LevmarIK LevmarIK
RUN mkdir LevmarIK/build && cd LevmarIK/build && \
cmake .. && make -j`nproc`&& make install
# Enable OpenGL support
RUN apt-get install -y -qq --no-install-recommends libglvnd0 libgl1 libglx0 libegl1 libxext6 libx11-6
# Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
# Set the workspace location (where new code will go)
WORKDIR /workspace