YOLOX + ROS2 Foxy demo
🔼 Unity + YOLOX-ROS Demo
Base | ROS2 C++ | ROS2 Python |
---|---|---|
PyTorch | ✅ | |
PyTorch(CUDA) | ✅ | |
PyTorch(CUDA-FP16) | ✅ | |
TensorRT (CUDA) | ✅ | |
OpenVINO | ✅ | ✅ |
ONNX Runtime | ✅ | |
TFLite | ✅ |
Python (PyTorch)
- ROS2 Foxy
- OpenCV 4
- Python 3.8 (Ubuntu 20.04 Default)
- PyTorch >= v1.7
- YOLOX v0.3.0
- bbox_ex_msgs
Install the dependent packages based on all tutorials.
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/Ar-Ray-code/yolox_ros.git --recursive
pip3 install yolox
source /opt/ros/foxy/setup.bash
sudo apt install ros-foxy-v4l2-camera
# source /opt/intel/openvino_2021/bin/setupvars.sh # <- Using OpenVINO
colcon build --symlink-install # weights (YOLOX-Nano) files will be installed automatically.
Automatic download weights
- yolox_nano.onnx by Megvii-BaseDetection/YOLOX
- yolox_nano.pth by Megvii-BaseDetection/YOLOX
- model.onnx by Kazuhito00
- model.tflite by Kazuhito00
If you have NVIDIA Graphics, you can run YOLOX-ROS on GPU.
Additional installing lists
- NVIDIA Graphics Driver
- CUDA toolkit (11.0)
- torch+cuda
source /opt/ros/foxy/setup.bash
sudo apt install ros-foxy-v4l2-camera
colcon build --symlink-install # weights (YOLOX-Nano) files will be installed automatically.
Connect your web camera.
source /opt/ros/foxy/setup.bash
source ~/ros2_ws/install/local_setup.bash
ros2 launch yolox_ros_py yolox_nano_cpu.launch.py # <- CPU (PyTorch)
# ros2 launch yolox_ros_py yolox_nano.launch.py # <- GPU (PyTorch)
# ros2 launch yolox_ros_py yolox_nano_onnx.launch.py # <- ONNXRuntime
# OpenVINO -------------------------------------
# source /opt/intel/openvino_2021/bin/setupvars.sh
# ros2 launch yolox_ros_py yolox_nano_openvino.launch.py
C++
Check this URL.
- image_raw (
sensor_msgs/Image
)
-
bounding_boxes: Output BoundingBoxes like darknet_ros_msgs (
bboxes_ex_msgs/BoundingBoxes
)※ If you want to use
darknet_ros_msgs
, replacebboxes_ex_msgs
withdarknet_ros_msgs
.
- Check launch files.
- Supports C++ only.
Examples
ros2 launch yolox_ros_py yolox_nano_onnx.launch.py video_device:=/dev/video0
ros2 launch yolox_ros_py yolox_nano_onnx_gazebo.launch.py
# git clone https://github.com/Ar-Ray-code/YOLOX-ROS.git --recursive
vcs import . < YOLOX-ROS/youtube-publisher.repos
pip3 install -r YOLOX-ROS/requirements.txt
pip3 install -r YouTube-publisher-ROS2/requirements.txt
cd ..
colcon build --symlink-install --pacakges-select yolox_ros_py bboxes_ex_msgs youtube_publisher
source install/setup.bash
# run launch.py
ros2 launch yolox_ros_py yolox_nano_onnx_youtube.launch.py
@article{yolox2021,
title={YOLOX: Exceeding YOLO Series in 2021},
author={Ge, Zheng and Liu, Songtao and Wang, Feng and Li, Zeming and Sun, Jian},
journal={arXiv preprint arXiv:2107.08430},
year={2021}
}
- Ar-Ray : Japanese student.
- Blog (Japanese) : https://ar-ray.hatenablog.com/
- Twitter : https://twitter.com/Ray255Ar