Skip to content

Commit eba453d

Browse files
committed
support jetson orin
1 parent bca1167 commit eba453d

File tree

4 files changed

+40
-77
lines changed

4 files changed

+40
-77
lines changed

yolox_ros_cpp/docker/jetson/docker-compose.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 21 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,27 @@
1-
FROM dustynv/ros:foxy-ros-base-l4t-r32.6.1
1+
FROM dustynv/ros:humble-ros-base-deepstream-l4t-r35.1.0
22

33
ENV DEBIAN_FRONTEND=noninteractive
44

5-
RUN apt update && \
6-
apt install -y libeigen3-dev python3-pip && \
7-
apt -y clean && \
8-
rm -rf /var/lib/apt/lists/*
9-
10-
RUN python3 -m pip install -U pip && \
11-
python3 -m pip install cmake
12-
135
# add PATH
146
ENV PATH=$PATH:/usr/src/tensorrt/bin
157

16-
# torch 1.9.0
17-
WORKDIR /workspace
18-
RUN apt update && \
19-
apt install -y libopenblas-base libopenmpi-dev && \
20-
apt -y clean && \
21-
rm -rf /var/lib/apt/lists/*
22-
RUN wget https://nvidia.box.com/shared/static/h1z9sw4bb1ybi0rm3tu8qdj8hs05ljbm.whl -O torch-1.9.0-cp36-cp36m-linux_aarch64.whl && \
23-
python3 -m pip install Cython && \
24-
python3 -m pip install numpy torch-1.9.0-cp36-cp36m-linux_aarch64.whl &&\
25-
rm torch-1.9.0-cp36-cp36m-linux_aarch64.whl
26-
27-
# torch2trt
28-
WORKDIR /workspace
29-
RUN git clone https://github.com/NVIDIA-AI-IOT/torch2trt && \
30-
cd torch2trt && \
31-
python3 setup.py install
32-
33-
# torchvision
34-
ENV TORCHVISION_VERSION=0.10.0
35-
WORKDIR /workspace
36-
RUN apt update && \
37-
apt install -y libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev && \
38-
apt -y clean && \
39-
rm -rf /var/lib/apt/lists/*
40-
RUN git clone --branch v${TORCHVISION_VERSION} https://github.com/pytorch/vision torchvision && \
41-
cd torchvision && \
42-
BUILD_VERSION=$TORCHVISION_VERSION && \
43-
python3 setup.py install
44-
45-
# YOLOX
46-
WORKDIR /workspace
47-
ENV YOLOX_VERSION=0.2.0
48-
# matplotlib, onnx-optimizer cannot install by pip
49-
RUN apt update && \
50-
apt install -y python3-matplotlib && \
51-
apt -y clean && \
52-
rm -rf /var/lib/apt/lists/*
53-
RUN python3 -m pip install onnx==1.8.1 onnxruntime==1.8.0
54-
RUN git clone --recursive https://github.com/onnx/optimizer onnxoptimizer && \
55-
cd onnxoptimizer && \
56-
python3 -m pip install -e .
57-
58-
# bugfix for numpy==1.19.5
59-
# set OPENBLAS_CORETYPE environment variable to ARMV8
60-
ENV OPENBLAS_CORETYPE=ARMV8
61-
62-
RUN git clone -b $YOLOX_VERSION https://github.com/Megvii-BaseDetection/YOLOX YOLOX && \
63-
cd YOLOX && \
64-
python3 -m pip install -e .
65-
8+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 42D5A192B819C5DA && \
9+
apt-get update && \
10+
apt-get install -y \
11+
doxygen \
12+
libfmt-dev \
13+
librange-v3-dev \
14+
python3-pip \
15+
python3-jinja2 \
16+
python3-typeguard
17+
RUN mkdir -p /dependencies/src && \
18+
cd /dependencies/src && \
19+
git clone https://github.com/PickNikRobotics/RSL.git && \
20+
git clone https://github.com/PickNikRobotics/cpp_polyfills.git && \
21+
git clone https://github.com/ros-perception/vision_opencv.git -b humble && \
22+
git clone https://github.com/PickNikRobotics/generate_parameter_library.git && \
23+
cd /dependencies/ && \
24+
. /opt/ros/humble/install/setup.sh && \
25+
colcon build
26+
27+
COPY /usr/include/aarch64-linux-gnu/ /usr/include/aarch64-linux-gnu/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
SCRIPT_DIR=$(cd $(dirname $0); pwd)
2+
cd ${SCRIPT_DIR}
3+
mkdir ./tensorrt_dir
4+
cp -r /usr/include/aarch64-linux-gnu/* ./tensorrt_dir/
5+
6+
docker build -t yolox_ros_jetson:latest -f ./dockerfile .
7+
docker run -it --rm --network host --volume $HOME/ros2_ws:/root/ros2_ws --device /dev/video0:/dev/video0 --workdir /root/ros2_ws --runtime nvidia yolox_ros_jetson /bin/bash
8+
9+
10+
# source /dependencies/install/setup.bash
11+
# colcon build --cmake-args -DJETSON=ON
12+
# bash src/YOLOX-ROS/weights/onnx/download.bash yolox_tiny
13+
# bash src/YOLOX-ROS/weights/tensorrt/convert.bash yolox_tiny

yolox_ros_cpp/yolox_cpp/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ option(YOLOX_USE_OPENVINO "Use OpenVINO" OFF)
1818
option(YOLOX_USE_TENSORRT "Use TensorRT" OFF)
1919
option(YOLOX_USE_ONNXRUNTIME "Use ONNXRuntime" OFF)
2020
option(YOLOX_USE_TFLITE "Use tflite" OFF)
21+
option(JETSON "Use Jetson" OFF)
22+
23+
if(JETSON)
24+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/include/aarch64-linux-gnu/ -L/usr/lib/aarch64-linux-gnu/")
25+
set(YOLOX_USE_TENSORRT ON)
26+
endif()
2127

2228
if(NOT YOLOX_USE_OPENVINO AND NOT YOLOX_USE_TENSORRT AND NOT YOLOX_USE_ONNXRUNTIME AND NOT YOLOX_USE_TFLITE)
2329
message(FATAL_ERROR "YOLOX_USE_OPENVINO, YOLOX_USE_TENSORRT, YOLOX_USE_ONNXRUNTIME, YOLOX_USE_TFLITE must be ON at least one")

0 commit comments

Comments
 (0)