Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch Inferencing with TensorRT #167

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c054c5f
Completed batching and creating tensrt engine
Arfan12630 Nov 5, 2024
f1f9cee
Mounted file and directory
Arfan12630 Nov 5, 2024
359626b
Requirment txt changes
Arfan12630 Nov 6, 2024
5cb072e
Reafactored engine build to a function
Arfan12630 Nov 6, 2024
387e491
Fixed file error
Arfan12630 Nov 6, 2024
61f48d8
Changed docker compose file
Arfan12630 Nov 6, 2024
bea933d
Refactored docker changes
Arfan12630 Nov 6, 2024
4d4513d
initialized engine
Arfan12630 Nov 6, 2024
8074ca4
Built and initliazed tensorRT engine
Arfan12630 Nov 8, 2024
9b4637e
Allocated memory for inferencing
Arfan12630 Nov 11, 2024
72a58a2
fixed tensor function
Arfan12630 Nov 11, 2024
46a0d38
Appended output tensor
Arfan12630 Nov 11, 2024
2fffe0d
Set up tensors, focusing on gpu allocation
Arfan12630 Nov 12, 2024
87f0785
Allocated memory
Arfan12630 Nov 12, 2024
592a877
fixed small bug
Arfan12630 Nov 12, 2024
ae4153c
Binded inp. & out., alloc. memory, setting up inf.
Arfan12630 Nov 14, 2024
2252b0e
Finished Inference function and allocated gpu
Arfan12630 Nov 18, 2024
b27effb
Got Bounding boxes, socres, and predicted classes
Arfan12630 Nov 21, 2024
485d592
Stored results, working on visualization
Arfan12630 Nov 26, 2024
4343435
Refactored code
Arfan12630 Nov 26, 2024
c3551fc
Refactored publishers
Arfan12630 Nov 26, 2024
e1c2e47
Added eve configuration
Arfan12630 Nov 27, 2024
976ffb1
Eve configuiration completed for batch inf
Arfan12630 Nov 27, 2024
9624d8d
Created publishers and msgs
Arfan12630 Nov 28, 2024
d24695a
Added msg file configs
Arfan12630 Nov 29, 2024
b2cd80c
Refactored publishing
Arfan12630 Dec 3, 2024
6de6530
Publishing detections on foxglove
Arfan12630 Dec 4, 2024
a85d45f
Showing every image in foxglove topic
Arfan12630 Dec 5, 2024
c77e53f
Getting better accuracy for detections
Arfan12630 Dec 6, 2024
e06c1aa
Refactored detection parsing
Arfan12630 Dec 7, 2024
a982238
parsing multiple tensors
Arfan12630 Dec 8, 2024
4a5cdd6
Refactored Mounts
Arfan12630 Dec 8, 2024
5cea90f
Getting all detections
Arfan12630 Dec 8, 2024
23bde0d
Getting all detections from all angles nuscenes
Arfan12630 Dec 10, 2024
bdf39a4
Batching complete, eve test remaining
Arfan12630 Dec 12, 2024
a81ccba
Refactored Changes
Arfan12630 Dec 17, 2024
8a0a184
Cleaned up code
Arfan12630 Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ WORKDIR ${AMENT_WS}/src

# Copy in source code
COPY src/perception/camera_object_detection camera_object_detection
COPY src/wato_msgs/perception_msgs/camera_object_detection_msgs camera_object_detection_msgs

# Scan for rosdeps
RUN apt-get -qq update && rosdep update && \
Expand All @@ -32,7 +33,7 @@ RUN rm requirements.txt
# Install Rosdep requirements
COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list
RUN apt-get update && apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list)

RUN apt install ros-$ROS_DISTRO-tf-transformations -y
# Copy in source code from source stage
WORKDIR ${AMENT_WS}
COPY --from=source ${AMENT_WS}/src src
Expand Down
5 changes: 4 additions & 1 deletion modules/docker-compose.perception.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ services:
- /mnt/wato-drive2/perception_models/yolov8m.pt:/perception_models/yolov8m.pt
- /mnt/wato-drive2/perception_models/traffic_light.pt:/perception_models/traffic_light.pt
- /mnt/wato-drive2/perception_models/traffic_signs_v0.pt:/perception_models/traffic_signs_v1.pt

- /mnt/wato-drive2/perception_models/tensorRT.onnx:/perception_models/tensorRT.onnx
- /mnt/wato-drive2/perception_models/tensorRT.engine:/perception_models/tensorRT.engine
- /mnt/wato-drive2/perception_models/eve.onnx:/perception_models/eve.onnx

lidar_object_detection:
build:
context: ..
Expand Down

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/perception/camera_object_detection/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
<license>TODO: License declaration</license>

<depend>cv_bridge</depend>
<depend>rclpy</depend>
<depend>sensor_msgs</depend>
<depend>vision_msgs</depend>
<depend>std_msgs</depend>

<depend>camera_object_detection_msgs</depend>
<exec_depend>python3-pytest</exec_depend>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
Expand Down
9 changes: 8 additions & 1 deletion src/perception/camera_object_detection/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@ setuptools==65.5.1
easydict
huggingface
huggingface_hub
numpy==1.24.2
numpy==1.24.2
onnx
onnxsim
onnxruntime-gpu
tensorrt==10.6.0
tensorrt_lean
tensorrt_dispatch
cuda-python
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.8)
project(camera_object_detection_msgs)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()


find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(vision_msgs REQUIRED)



rosidl_generate_interfaces(${PROJECT_NAME}
"msg/BatchDetection.msg"
"msg/EveBatchDetection.msg"
DEPENDENCIES std_msgs sensor_msgs vision_msgs
)

ament_export_dependencies(rosidl_default_runtime)
ament_package()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
std_msgs/Header header
sensor_msgs/CompressedImage[] images # Array of compressed images in the batch
vision_msgs/Detection2DArray[] detections # Array of detections for each image
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
std_msgs/Header header
sensor_msgs/Image[] images # Array of compressed images in the batch
vision_msgs/Detection2DArray[] detections # Array of detections for each image
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>camera_object_detection_msgs</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="[email protected]">Arfan12630</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>

<depend>std_msgs</depend>
<depend>vision_msgs</depend>
<depend>geometry_msgs</depend>

<buildtool_depend>rosidl_default_generators</buildtool_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
2 changes: 1 addition & 1 deletion watod-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
## - simulation : starts simulation
## - samples : starts sample ROS2 pubsub nodes

# ACTIVE_MODULES=""
ACTIVE_MODULES="perception infrastructure"

################################# MODE OF OPERATION #################################
## Possible modes of operation when running watod.
Expand Down
Loading