Skip to content

Commit 381e1f5

Browse files
Pavlos-Tosidisad-danielpassalistsampazk
authored
Tx2 install dev (opendr-eu#384)
* Installation script for TX2. Updated installation.md and changed import statements in object_detection_2d gem and detr. * Update installation.md * Updated tx2 installation script Tested it twice on two different TX2 boards successfully. * Update install_tx2.sh * Update installation.md * Update installation.md * Update installation.md * Update docs/reference/installation.md Co-authored-by: ad-daniel <[email protected]> * Update bin/install_tx2.sh Co-authored-by: ad-daniel <[email protected]> * Update bin/install_tx2.sh Co-authored-by: ad-daniel <[email protected]> * Update bin/install_tx2.sh Co-authored-by: ad-daniel <[email protected]> * Update install_tx2.sh * Update install_tx2.sh * Update install_tx2.sh * Update install_tx2.sh * Update install_tx2.sh * Update edgespeechnets_learner.py * Update install_tx2.sh * This PR includes the docker file for tx-2. Tools that were tested under opendr/projects/perception and work: - [x] Activity recognition - [x] Face recognition - [x] Lightweight Open Pose - [x] Multimodal human centric - [x] Object Detection 2D - [x] CenterNet - [x] Detr - [x] Gem - [x] RetinaFace - [x] SSD - [x] YOLOv3 - [x] Object tracking 2d - [x] Semantic segmentation - Bisenet - [x] Speech command recognition The rest of the demos are not complete, i.e. missing an inference demo and/or data to run it. * This PR includes the docker file for tx-2. Tools that were tested under opendr/projects/perception and work: - [x] Activity recognition - [x] Face recognition - [x] Lightweight Open Pose - [x] Multimodal human centric - [x] Object Detection 2D - [x] CenterNet - [x] Detr - [x] Gem - [x] RetinaFace - [x] SSD - [x] YOLOv3 - [x] Object tracking 2d - [x] Semantic segmentation - Bisenet - [x] Speech command recognition The rest of the demos are not complete, i.e. missing an inference demo and/or data to run it. * This PR includes the docker file for tx-2. Tools that were tested under opendr/projects/perception and work: - [x] Activity recognition - [x] Face recognition - [x] Lightweight Open Pose - [x] Multimodal human centric - [x] Object Detection 2D - [x] CenterNet - [x] Detr - [x] Gem - [x] RetinaFace - [x] SSD - [x] YOLOv3 - [x] Object tracking 2d - [x] Semantic segmentation - Bisenet - [x] Speech command recognition The rest of the demos are not complete, i.e. missing an inference demo and/or data to run it. * Added argument for tx2, agx and nx support. Added instructions on installation.md * Added argument for tx2, agx and nx support. Added instructions on installation.md * Added argument for tx2, agx and nx support. Added instructions on installation.md * Update installation.md * Update activate_nvidia.sh Corrected python to point to python3 on Nvidia * Working ROS and correct export of Python version * Working ROS and correct export of Python version * Working ROS and correct export of Python version * Update Dockerfile-embedded * Update Dockerfile-embedded * Update Dockerfile-embedded * Working ROS and correct export of Python version * Fixed catkin_make, added it to dockerfile. * Added missing HINT from installation.md * Updates on default values for FairMOT ros node class ctor * Fixed duplicate shortcut on deepsort ros node argparse * Fixed missing shortcut on rgbd hand gesture reco ros node argparse * Added "opendr_" to data gen package and "_node" to the node file name * Renamed package to "opendr_perception" and added "_node" to scripts * Applied fixes to yolov5 * Added "opendr_" to planning package * Added "opendr_" to bridge package * Added "opendr_" to simulation package * Fixed old version of torch in pip_requirements.txt * Renamed ros bridge package doc * Renamed dirs, etc. from opendr_ros_bridge to opendr_bridge to match the actual package name * Fixed ros readme link from customize.md * Fixed index.md link for opendr-ros-bridge.md * Minor typo fix in issues.md * Fixed bridge package name in its doc * Fixed bridge imports * Updated for dev_branch Fixed some missing dependencies * Fixed some missing dependencies * add detectron2 (test with new p3.8 Dockerfile) * Detectron2 issues * Update install_nvidia.sh * python3.8 test * Rolling back to Python3.6.9 * Update install_nvidia.sh * Updated Dockerfile and dependencies for embedded devices Changed python to python3 on all ROS nodes Fixed a couple of issues Added some exports in activate_nvidia.sh * Various Fixes * Removed torch import on data.py and the corresponding reference in Video class. Added some docker run instructions * Remove unused import * Remove Typehint for pyhton compatibilty * Apply suggestions from code review Dockerfile-embedded suggested changes Co-authored-by: Nikolaos Passalis <[email protected]> * Fixed suggested changes * Format Co-authored-by: ad-daniel <[email protected]> Co-authored-by: ad-daniel <[email protected]> Co-authored-by: Nikolaos Passalis <[email protected]> Co-authored-by: tsampazk <[email protected]> Co-authored-by: Kostas Tsampazis <[email protected]>
1 parent 07840d3 commit 381e1f5

38 files changed

+651
-47
lines changed

Dockerfile-embedded

+201
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
#
2+
# This dockerfile roughly follows the 'Installing from source' ROS instructions from:
3+
# http://wiki.ros.org/noetic/Installation/Source
4+
#
5+
ARG BASE_IMAGE=nvcr.io/nvidia/l4t-base:r32.6.1
6+
FROM ${BASE_IMAGE}
7+
ARG device=nx
8+
9+
ARG ROS_PKG=ros_base
10+
ENV ROS_DISTRO=noetic
11+
ENV ROS_ROOT=/opt/ros/${ROS_DISTRO}
12+
ENV ROS_PYTHON_VERSION=3
13+
14+
ENV DEBIAN_FRONTEND=noninteractive
15+
16+
ENV CUDA_HOME="/usr/local/cuda"
17+
ENV PATH="/usr/local/cuda/bin:${PATH}"
18+
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
19+
20+
WORKDIR /workspace
21+
22+
#
23+
# OpenCV - https://github.com/mdegans/nano_build_opencv/blob/master/build_opencv.sh
24+
#
25+
ARG OPENCV_VERSION="4.4.0"
26+
27+
# install build dependencies
28+
RUN apt-get update && \
29+
apt-get install -y --no-install-recommends \
30+
build-essential \
31+
gfortran \
32+
cmake \
33+
git \
34+
file \
35+
tar \
36+
libatlas-base-dev \
37+
libavcodec-dev \
38+
libavformat-dev \
39+
libavresample-dev \
40+
libcanberra-gtk3-module \
41+
libdc1394-22-dev \
42+
libeigen3-dev \
43+
libglew-dev \
44+
libgstreamer-plugins-base1.0-dev \
45+
libgstreamer-plugins-good1.0-dev \
46+
libgstreamer1.0-dev \
47+
libgtk-3-dev \
48+
libjpeg-dev \
49+
libjpeg8-dev \
50+
libjpeg-turbo8-dev \
51+
liblapack-dev \
52+
liblapacke-dev \
53+
libopenblas-dev \
54+
libpng-dev \
55+
libpostproc-dev \
56+
libswscale-dev \
57+
libtbb-dev \
58+
libtbb2 \
59+
libtesseract-dev \
60+
libtiff-dev \
61+
libv4l-dev \
62+
libxine2-dev \
63+
libxvidcore-dev \
64+
libx264-dev \
65+
libgtkglext1 \
66+
libgtkglext1-dev \
67+
pkg-config \
68+
qv4l2 \
69+
v4l-utils \
70+
zlib1g-dev
71+
72+
RUN apt-get install ca-certificates -y
73+
74+
# OpenCV looks for the cuDNN version in cudnn_version.h, but it's been renamed to cudnn_version_v8.h
75+
RUN ln -s /usr/include/$(uname -i)-linux-gnu/cudnn_version_v8.h /usr/include/$(uname -i)-linux-gnu/cudnn_version.h
76+
77+
# Architecture-specific build options
78+
ARG CUDA_ARCH_BIN=""
79+
ARG ENABLE_NEON="OFF"
80+
81+
# Clone and configure OpenCV repo
82+
RUN git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv.git && \
83+
git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv_contrib.git && \
84+
cd opencv && \
85+
mkdir build && \
86+
cd build && \
87+
echo "configuring OpenCV ${OPENCV_VERSION}, CUDA_ARCH_BIN=${CUDA_ARCH_BIN}, ENABLE_NEON=${ENABLE_NEON}" && \
88+
cmake \
89+
-D CPACK_BINARY_DEB=ON \
90+
-D BUILD_EXAMPLES=OFF \
91+
-D BUILD_opencv_python2=OFF \
92+
-D BUILD_opencv_python3=ON \
93+
-D BUILD_opencv_java=OFF \
94+
-D CMAKE_BUILD_TYPE=RELEASE \
95+
-D CMAKE_INSTALL_PREFIX=/usr/local \
96+
-D CUDA_ARCH_BIN=${CUDA_ARCH_BIN} \
97+
-D CUDA_ARCH_PTX= \
98+
-D CUDA_FAST_MATH=ON \
99+
-D CUDNN_INCLUDE_DIR=/usr/include/$(uname -i)-linux-gnu \
100+
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \
101+
-D WITH_EIGEN=ON \
102+
-D ENABLE_NEON=${ENABLE_NEON} \
103+
-D OPENCV_DNN_CUDA=ON \
104+
-D OPENCV_ENABLE_NONFREE=ON \
105+
-D OPENCV_EXTRA_MODULES_PATH=/workspace/opencv_contrib/modules \
106+
-D OPENCV_GENERATE_PKGCONFIG=ON \
107+
-D WITH_CUBLAS=ON \
108+
-D WITH_CUDA=ON \
109+
-D WITH_CUDNN=ON \
110+
-D WITH_GSTREAMER=ON \
111+
-D WITH_LIBV4L=ON \
112+
-D WITH_OPENGL=ON \
113+
-D WITH_OPENCL=OFF \
114+
-D WITH_IPP=OFF \
115+
-D WITH_TBB=ON \
116+
-D BUILD_TIFF=ON \
117+
-D BUILD_PERF_TESTS=OFF \
118+
-D BUILD_TESTS=OFF \
119+
../
120+
121+
RUN cd opencv/build && make -j$(nproc)
122+
RUN cd opencv/build && make install
123+
RUN cd opencv/build && make package
124+
125+
RUN cd opencv/build && tar -czvf OpenCV-${OPENCV_VERSION}-$(uname -i).tar.gz *.deb
126+
127+
RUN apt-get update -y
128+
RUN apt-get install software-properties-common -y && \
129+
apt-get update
130+
131+
# Add the ROS deb repo to the apt sources list
132+
133+
RUN apt-get update && \
134+
apt-get install -y --no-install-recommends \
135+
git \
136+
cmake \
137+
build-essential \
138+
curl \
139+
wget \
140+
gnupg2 \
141+
lsb-release \
142+
ca-certificates \
143+
&& rm -rf /var/lib/apt/lists/*
144+
145+
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
146+
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
147+
148+
#
149+
# Install bootstrap dependencies
150+
#
151+
RUN apt-get update && \
152+
apt-get install -y --no-install-recommends \
153+
libpython3-dev \
154+
python3-rosdep \
155+
python3-rosinstall-generator \
156+
python3-vcstool \
157+
libyaml-cpp-dev \
158+
build-essential && \
159+
rosdep init && \
160+
rosdep update && \
161+
rm -rf /var/lib/apt/lists/*
162+
163+
#
164+
# Download/build the ROS source
165+
#
166+
RUN mkdir ros_catkin_ws && \
167+
cd ros_catkin_ws && \
168+
# try below for ros-noetic-vision-msgs ros-noetic-geometry-msgs ros-noetic-sensor-msgs ros-noetic-audio-common-msgs \
169+
rosinstall_generator ${ROS_PKG} audio_common_msgs --rosdistro ${ROS_DISTRO} --deps --tar > ${ROS_DISTRO}-${ROS_PKG}.rosinstall && \
170+
rosinstall_generator ${ROS_PKG} sensor_msgs --rosdistro ${ROS_DISTRO} --deps --tar > ${ROS_DISTRO}-${ROS_PKG}.rosinstall && \
171+
rosinstall_generator ${ROS_PKG} geometry_msgs --rosdistro ${ROS_DISTRO} --deps --tar > ${ROS_DISTRO}-${ROS_PKG}.rosinstall && \
172+
rosinstall_generator ${ROS_PKG} vision_msgs --rosdistro ${ROS_DISTRO} --deps --tar > ${ROS_DISTRO}-${ROS_PKG}.rosinstall && \
173+
mkdir src && \
174+
cd src && \
175+
git clone https://github.com/ros/resource_retriever && \
176+
cd ../ && \
177+
vcs import --input ${ROS_DISTRO}-${ROS_PKG}.rosinstall ./src && \
178+
apt-get update && \
179+
apt-get install -y gir1.2-gstreamer-1.0 && \
180+
rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro ${ROS_DISTRO} --skip-keys python3-pykdl -y && \
181+
python3 ./src/catkin/bin/catkin_make_isolated --install --install-space ${ROS_ROOT} -DCMAKE_BUILD_TYPE=Release && \
182+
rm -rf /var/lib/apt/lists/*
183+
184+
185+
RUN echo 'source /opt/ros/${ROS_DISTRO}/setup.bash' >> /root/.bashrc
186+
CMD ["bash"]
187+
WORKDIR /
188+
189+
RUN git clone --depth 1 --recurse-submodules -j8 --branch tx2_install_dev https://github.com/opendr-eu/opendr
190+
RUN apt-get update
191+
RUN cd ./opendr && ./bin/install_nvidia.sh $device
192+
RUN cd ./opendr/projects/opendr_ws/src && \
193+
git clone --branch noetic https://github.com/ros-perception/vision_opencv && \
194+
git clone --branch develop https://github.com/bosch-ros-pkg/usb_cam.git && \
195+
cd ./usb_cam && git reset --hard 3ce8ee1 && cd ../ && \
196+
git clone https://github.com/ros-perception/image_common.git && \
197+
git clone https://github.com/ros-drivers/audio_common && \
198+
sed -i 's/(Boost REQUIRED python37)/(Boost REQUIRED python3)/' ./vision_opencv/cv_bridge/CMakeLists.txt && \
199+
cd ../
200+
201+
RUN /bin/bash -c '. /opt/ros/noetic/setup.bash; cd /opendr/projects/opendr_ws; catkin_make'

bin/activate_nvidia.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
export OPENDR_HOME=$PWD
3+
export PYTHONPATH=$OPENDR_HOME/src:$PYTHONPATH
4+
alias python=python3
5+
export LD_LIBRARY_PATH=$OPENDR_HOME/lib:$LD_LIBRARY_PATH
6+
7+
export PATH=/usr/local/cuda/bin:$PATH
8+
export MXNET_HOME=$OPENDR_HOME/mxnet/
9+
export PYTHONPATH=$MXNET_HOME/python:$PYTHONPATH
10+
export MXNET_CUDNN_AUTOTUNE_DEFAULT=0
11+
export LC_ALL="C.UTF-8"
12+
export MPLBACKEND=TkAgg

0 commit comments

Comments
 (0)