-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.noros
384 lines (335 loc) · 14.3 KB
/
Dockerfile.noros
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
FROM nvcr.io/nvidia/l4t-pytorch:r34.1.1-pth1.11-py3 AS pytorch_cuda
#FROM nvcr.io/nvidia/l4t-pytorch:r32.7.1-pth1.9-py3 AS pytorch_cuda
#FROM l4t-pytorch:r32.7.1-pth1.9-py3 AS pytorch_cuda
# Make apt-get and apt try more than one time
#RUN echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries
#RUN echo '\
#Acquire::Retries "100";\
#Acquire::https::Timeout "240";\
#Acquire::http::Timeout "240";\
#APT::Get::Assume-Yes "true";\
#APT::Install-Recommends "false";\
#APT::Install-Suggests "false";\
#Debug::Acquire::https "true";\
#' > /etc/apt/apt.conf.d/99custom
# updates and software from apt
RUN apt-get -y update && apt-get -y install wget libedit-dev autoconf bc build-essential g++-8 gcc-8 clang-8 lld-8 gettext-base gfortran-8 iputils-ping libbz2-dev libc++-dev libcgal-dev libffi-dev libfreetype6-dev libhdf5-dev libjpeg-dev liblzma-dev libncurses5-dev libncursesw5-dev libpng-dev libreadline-dev libssl-dev libsqlite3-dev libxml2-dev libxslt-dev locales moreutils openssl python-openssl rsync scons python3-pip libopenblas-dev libeigen3-dev curl nano xorg openbox;
# Now ROS
#RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
#RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
#RUN apt-get -y update && apt-get -y -o Dpkg::Options::="--force-overwrite" install ros-noetic-desktop-full ros-noetic-pcl-conversions ros-noetic-pcl-ros ros-noetic-perception ros-noetic-jsk-recognition-msgs ros-noetic-jsk-footstep-msgs ros-noetic-octomap-server
#RUN pip install mmcv-full==1.3.8 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html
#RUN pip install mmdet==2.14.0
#RUN pip install mmsegmentation==0.14.1
# whatever we can get from pip
#RUN pip install mmcv-full==1.7.1
#RUN pip install mmdet==3.0.0
#RUN pip install mmdet==2.28.0
#RUN pip install mmsegmentation==1.0.0
#RUN pip install mmsegmentation==0.30.0
## now download and, compile and install llvm and llvmlite. We can't use apt packages because wither llvm or llvmlite doesn't have aarch64
## architecture packages, but they need to be for Jetson and versions need to match too, so it's best to compile- no big deal, just takes
## a long time
#WORKDIR /llvm_src
#RUN wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/llvm-11.1.0.src.tar.xz
#RUN git clone https://github.com/archie1983/llvmlite
#WORKDIR /llvm_src/llvmlite
#RUN git checkout jetson_xavier_r34.1.1
#WORKDIR /llvm_src
#RUN tar -xvf llvm-11.1.0.src.tar.xz
#WORKDIR /llvm_src/llvm-11.1.0
#RUN patch -p1 -i ../llvmlite/conda-recipes/llvm-lto-static.patch
#RUN patch -p1 -i ../llvmlite/conda-recipes/partial-testing.patch
#RUN patch -p1 -i ../llvmlite/conda-recipes/intel-D47188-svml-VF.patch
#RUN patch -p1 -i ../llvmlite/conda-recipes/expect-fastmath-entrypoints-in-add-TLI-mappings.ll.patch
#RUN patch -p1 -i ../llvmlite/conda-recipes/0001-Revert-Limit-size-of-non-GlobalValue-name.patch
#RUN patch -p1 -i ../llvmlite/conda-recipes/llvm_11_consecutive_registers.patch
#RUN export PREFIX=/usr CPU_COUNT=4
#RUN ../llvmlite/conda-recipes/llvmdev/build.sh
# That should get us to the place where llvm and llvmlite is installed
# Instead of patching and building llvmlite here, we can just clone from my repository already patched llvm and llvmlite
# and build that.
WORKDIR /ae_src
# First clone and checkout all required source
RUN git clone https://github.com/archie1983/llvmlite
RUN git clone https://github.com/archie1983/llvm-project
RUN git clone https://github.com/archie1983/fcaf3d
RUN git clone https://github.com/archie1983/MinkowskiEngine
RUN git clone https://github.com/archie1983/mmcv
RUN git clone https://github.com/archie1983/cocoapi
# MultiMap3D has to go in a special directory where we will initiate a catkin workspace
WORKDIR /ae_src/ros/src
RUN git clone https://github.com/archie1983/MultiMap3D
WORKDIR /ae_src/fcaf3d
RUN git checkout for_jetson_xavier_r34_ptc1.11
WORKDIR /ae_src/llvmlite
RUN git checkout for_fcaf3d_on_jetson_xavier_r34
WORKDIR /ae_src/llvm-project
RUN git checkout for_fcaf3d_on_jetson_xavier_r34
WORKDIR /ae_src/MinkowskiEngine
RUN git checkout for_fcaf3d_on_jetson_xavier_r34
WORKDIR /ae_src/ros/src/MultiMap3D
RUN git checkout for_fcaf3d_on_jetson_xavier_r34
WORKDIR /ae_src/mmcv
RUN git checkout for_fcaf3d_on_jetson_xavier_r34
WORKDIR /ae_src/cocoapi
RUN git checkout for_fcaf3d_on_jetson_xavier_r34
# whatever we can get from pip
RUN pip3 install mmdet==2.28.2 mmsegmentation==0.30.0 numpy==1.19.5 pandas==1.4.4 opencv-python==4.5.1.48 matplotlib==3.5.2 shapely==1.8.5 scikit-learn==1.2.2
RUN pip3 install mmengine
# Now cocoapi
WORKDIR /ae_src/cocoapi/PythonAPI
# Just in case uninstall pycocotools if they've been pulled in from apt repos
RUN pip3 uninstall -y pycocotools
RUN python3 setup.py build_ext install
# Now mmcv
WORKDIR /ae_src/mmcv
#RUN export MMCV_WITH_OPS=1
#RUN export FORCE_CUDA=1
ENV MMCV_WITH_OPS=1
ENV FORCE_CUDA=1
RUN MMCV_WITH_OPS=1 pip3 install -e .
# Now build and install llvmlite
WORKDIR /ae_src/llvm-project/llvm
ENV PREFIX=/usr/local
ENV CPU_COUNT=4
RUN ../../llvmlite/conda-recipes/llvmdev/build.sh
WORKDIR /ae_src/llvmlite
#RUN export LLVM_CONFIG=/usr/local/bin/llvm-config
ENV LLVM_CONFIG=/usr/local/bin/llvm-config
#RUN python setup.py install
RUN pip3 install .
# Now MinkowskiEngine
WORKDIR /ae_src/MinkowskiEngine
#RUN export MAX_JOBS=4
ENV MAX_JOBS=4
RUN pip3 install -U --install-option="--blas=openblas" --install-option="--force_cuda" -v --no-deps .
# Now build and install fcaf3d
WORKDIR /ae_src/fcaf3d
ENV FORCE_CUDA="1"
RUN pip3 install -r requirements/build.txt
#RUN pip3 install --no-cache-dir -e .
RUN pip3 install -v -e .
# Now rotated_iou
WORKDIR /ae_src
RUN git clone https://github.com/archie1983/Rotated_IoU
WORKDIR /ae_src/Rotated_IoU
RUN git checkout for_fcaf3d_on_jetson_xavier_r34
RUN cp -r cuda_op ../fcaf3d/mmdet3d/ops/rotated_iou
WORKDIR /ae_src/fcaf3d/mmdet3d/ops/rotated_iou/cuda_op
RUN python3 setup.py install
#python3 setup.py install
#RUN pip install .
# Now Pangolin
WORKDIR /ae_src
RUN git clone --recursive https://github.com/archie1983/Pangolin
WORKDIR /ae_src/Pangolin
RUN git checkout for_fcaf3d_on_jetson_xavier_r34
RUN ./scripts/install_prerequisites.sh recommended
RUN ./scripts/install_prerequisites.sh -m apt all
RUN cmake -B build
RUN cmake --build build
## NOW OpenCV -- Maybe need to do it higher up???
ENV DEBIAN_FRONTEND=noninteractive
ENV CUDA_HOME="/usr/local/cuda"
ENV PATH="/usr/local/cuda/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
WORKDIR /opt
#
# OpenCV - https://github.com/mdegans/nano_build_opencv/blob/master/build_opencv.sh
#
ARG OPENCV_VERSION="4.5.1"
# install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
gfortran \
cmake \
git \
file \
tar \
libatlas-base-dev \
libavcodec-dev \
libavformat-dev \
libavresample-dev \
libcanberra-gtk3-module \
libdc1394-22-dev \
libeigen3-dev \
libglew-dev \
libgstreamer-plugins-base1.0-dev \
libgstreamer-plugins-good1.0-dev \
libgstreamer1.0-dev \
libgtk-3-dev \
libjpeg-dev \
libjpeg8-dev \
libjpeg-turbo8-dev \
liblapack-dev \
liblapacke-dev \
libopenblas-dev \
libpng-dev \
libpostproc-dev \
libswscale-dev \
libtbb-dev \
libtbb2 \
libtesseract-dev \
libtiff-dev \
libv4l-dev \
libxine2-dev \
libxvidcore-dev \
libx264-dev \
libgtkglext1 \
libgtkglext1-dev \
pkg-config \
qv4l2 \
v4l-utils \
zlib1g-dev \
python3-pip \
python3-dev \
python3-numpy \
python3-distutils \
python3-setuptools
# OpenCV looks for the cuDNN version in cudnn_version.h, but it's been renamed to cudnn_version_v8.h
RUN ln -s /usr/include/$(uname -i)-linux-gnu/cudnn_version_v8.h /usr/include/$(uname -i)-linux-gnu/cudnn_version.h
# architecture-specific build options
ARG CUDA_ARCH_BIN=""
ARG ENABLE_NEON="OFF"
# clone and configure OpenCV repo
RUN git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv.git && \
git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv_contrib.git && \
cd opencv && \
mkdir build && \
cd build && \
echo "configuring OpenCV ${OPENCV_VERSION}, CUDA_ARCH_BIN=${CUDA_ARCH_BIN}, ENABLE_NEON=${ENABLE_NEON}" && \
cmake \
-D CPACK_BINARY_DEB=ON \
-D BUILD_EXAMPLES=OFF \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D BUILD_opencv_java=OFF \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D CUDA_ARCH_BIN=${CUDA_ARCH_BIN} \
-D CUDA_ARCH_PTX= \
-D CUDA_FAST_MATH=ON \
-D CUDNN_INCLUDE_DIR=/usr/include/$(uname -i)-linux-gnu \
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \
-D WITH_EIGEN=ON \
-D ENABLE_NEON=${ENABLE_NEON} \
-D OPENCV_DNN_CUDA=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D WITH_CUBLAS=ON \
-D WITH_CUDA=ON \
-D WITH_CUDNN=ON \
-D WITH_GSTREAMER=ON \
-D WITH_LIBV4L=ON \
-D WITH_OPENGL=ON \
-D WITH_OPENCL=OFF \
-D WITH_IPP=OFF \
-D WITH_TBB=ON \
-D BUILD_TIFF=ON \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_TESTS=OFF \
../
WORKDIR /opt/opencv/build
RUN make -j4
RUN make install
RUN make package
RUN cd opencv/build && tar -czvf OpenCV-${OPENCV_VERSION}-$(uname -i).tar.gz *.deb
## Now ROS
#RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
#RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
#RUN apt-get -y update && apt-get -y install ros-noetic-desktop-full ros-noetic-pcl-conversions ros-noetic-pcl-ros ros-noetic-perception ros-noetic-jsk-recognition-msgs ros-noetic-jsk-footstep-msgs
ENV ROS_DISTRO=noetic
ENV ROS_ROOT=/opt/ros/${ROS_DISTRO}
ENV ROS_PYTHON_VERSION=3
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /ae_src/ros_build_workspace
#
# add the ROS deb repo to the apt sources list
#
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
cmake \
build-essential \
curl \
wget \
gnupg2 \
lsb-release \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
#
# install bootstrap dependencies
#
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libpython3-dev \
python3-rosdep \
python3-rosinstall-generator \
python3-vcstool \
build-essential \
libopencv-dev \
libopencv \
libpcl-dev && \
rosdep init && \
rosdep update && \
rm -rf /var/lib/apt/lists/*
#
# download/build the ROS source
#
RUN mkdir ros_catkin_ws && \
cd ros_catkin_ws && \
rosinstall_generator ros_base cv_bridge vision_msgs nav_msgs desktop_full pcl_conversions pcl_ros perception jsk_recognition_msgs jsk_footstep_msgs octomap_server tf --rosdistro ${ROS_DISTRO} --deps --tar > ${ROS_DISTRO}.rosinstall && \
mkdir src && \
vcs import --input ${ROS_DISTRO}.rosinstall ./src && \
apt-get update && \
rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro ${ROS_DISTRO} --skip-keys python3-pykdl -y && \
python3 ./src/catkin/bin/catkin_make_isolated --install --install-space ${ROS_ROOT} -DCMAKE_BUILD_TYPE=Release && \
rm -rf /var/lib/apt/lists/*
# Now cocoapi
WORKDIR /ae_src/cocoapi/PythonAPI
# Just in case uninstall pycocotools if they've been pulled in from apt repos
RUN pip3 uninstall -y pycocotools
RUN python3 setup.py build_ext install
# Now ORB-SLAM2 within MultiMap3D
WORKDIR /ae_src/ros/src/MultiMap3D/ORB-SLAM2_DENSE-master/Vocabulary
RUN gunzip ORBvoc.txt.tar.gz
RUN tar -xvf ORBvoc.txt.tar
RUN source /opt/ros/noetic/setup.bash
#RUN export LD_LIBRARY_PATH=/usr/include/eigen3:$LD_LIBRARY_PATH
ENV LD_LIBRARY_PATH=/usr/include/eigen3:$LD_LIBRARY_PATH
WORKDIR /ae_src/ros/src/MultiMap3D/ORB-SLAM2_DENSE-master
RUN ./build.sh
WORKDIR /ae_src/ros/src/MultiMap3D/ORB-SLAM2_DENSE-master/Examples/ROS/ORB_SLAM2_DENSE/build
RUN cmake ..
RUN make -j4
WORKDIR /ae_src/ros/src
RUN catkin_init_workspace
WORKDIR /ae_src/ros
RUN catkin_make
# Now download model and configuration for our sparse network
WORKDIR /ae_src/ros/src/MultiMap3D/configs/fcaf3d
RUN wget https://raw.githubusercontent.com/SamsungLabs/fcaf3d/master/configs/fcaf3d/fcaf3d_scannet-3d-18class.py
RUN wget https://raw.githubusercontent.com/archie1983/fcaf3d/master/configs/fcaf3d/fcaf3d_3scales_scannet-3d-18class.py
RUN wget https://raw.githubusercontent.com/archie1983/fcaf3d/master/configs/fcaf3d/fcaf3d_2scales_scannet-3d-18class.py
WORKDIR /ae_src/ros/src/MultiMap3D/checkpoints/
RUN wget https://github.com/samsunglabs/fcaf3d/releases/download/v1.0/20211007_144747.pth
RUN wget https://github.com/samsunglabs/fcaf3d/releases/download/v1.0/20211008_191702.pth
RUN wget https://github.com/samsunglabs/fcaf3d/releases/download/v1.0/20211008_151041.pth
RUN mv 20211008_151041.pth fcaf3d_2scales_scannet-3d-18class_20211008_151041.pth
RUN mv 20211008_191702.pth fcaf3d_3scales_scannet-3d-18class_20211008_191702.pth
RUN mv 20211007_144747.pth fcaf3d_scannet-3d-18class_20211007_144747.pth
# Now uhumans dataset
RUN pip3 install argcomplete gdown
WORKDIR /ae_src/
RUN git clone https://gist.github.com/ToniRV/7b4ff0f72e9895b9edf6b042664926de
RUN mv 7b4ff0f72e9895b9edf6b042664926de download_uHumans2_dataset
WORKDIR /ae_src/download_uHumans2_dataset
RUN python3 download_uHumans2.py --output_dir ./data
# Or we can even just try to install the pre-built wheels.
ENV LD_PRELOAD="/usr/local/lib/python3.8/dist-packages/scikit_learn.libs/libgomp-d22c30c5.so.1.0.0"
WORKDIR /ae_src/ros/src/MultiMap3D/ORB-SLAM2_DENSE-master/Examples/ROS/ORB_SLAM2_DENSE/scripts