A set of python scripts implementing Yolor with TensorRT for object detection in ROS workspace.
- Clone this resipiratory to your catkin workspace
cd /catkin_ws/src
git clone https://github.com/petpetpeter/Yolor-ROS.git
- Build your workspace
cd /catkin_ws/
catkin build
source ~/.bashrc
- Install Python Dependencies
install pytorch according to your environment https://pytorch.org/
roscd yoloros/scripts/yolor
pip install -e .
- Download pretrain weight to /scripts/yolor
https://drive.google.com/file/d/1_vgbLEjV0TU5492MfNEkJduTdGtcdthN/view?usp=sharing
- Launch ROS Yolor example
roslaunch yoloros yolor_camera.launch
TensorRT 8.0.3.4: Follow installation guide here https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html
- Convert pytorch weight file to onnx file
roscd yoloros/scripts/yolor
python convert2Onnx.py --weight weights/yolor_p6.pt --out onnx/yolor_p6.onnx
- Convert onnx to tensorRT Engine
/usr/src/tensorrt/bin/trtexec --explicitBatch \
--onnx=transformer_encoder.onnx \
--saveEngine=transformer_encoder.trt \
--minShapes=input:1x3x32x128 \
--optShapes=input:32x3x32x512 \
--maxShapes=input:32x3x32x768 \
--verbose \
--fp16
- Launch ROS Yolor TensorRT example
roslaunch yoloros trt_camera.launch
- Yolor: https://github.com/WongKinYiu/yolor
- Yolor-TensorRT: https://github.com/NNDam/yolor