tongtybj / edgetpu_roscpp

Use Edge TPU (Coral) with ROS based on C++
12 stars 2 forks source link

edgetpu_roscpp

Use Edge TPU (Coral) with ROS based on C++

Install

Build source

$ cd <catkin_ws>
$ wstool init src
$ wstool set -u -t src edgetpu_roscpp http://github.com/tongtybj/edgetpu_roscpp --git
$ wstool merge -t src src/edgetpu_roscpp/edgetpu_roscpp_${ROS_DISTRO}.rosinstall
$ wstool update -t src
$ rosdep install -y -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO
$ catkin build

Install device driver for EdgeTPU Coral

$ source <catkin_ws>/devel/setup.bash
$ roscd edgetpu_roscpp
$ sudo ./scripts/edgetpu/runtime/install.sh

Usage:

classify test image:

$ roslaunch edgetpu_roscpp classify_image_test.launch

object detection test:

$ roslaunch edgetpu_roscpp object_detection_test.launch

single object detection from video stream:

$ roslaunch edgetpu_roscpp detection_from_stream.launch verbose:=false image_view:=true
$ roslaunch video_stream_opencv camera.launch video_stream_provider:=`rospack find edgetpu_roscpp`/test/data/DJI_0004.MP4 loop_videofile:=true
$ rqt_image_view /deep_object_detection/detection_result

single object tracking by detection:

status color:

main parameters:

from video stream:

$ roslaunch edgetpu_roscpp single_object_tracking_by_detection.launch  image_view:=true verbose:=false coarse_detection_score_threshold:=0.0 refined_detection_score_threshold:=0.7  tracking_score_threshold:=0.7 expanding_bounding_box_aspect_ratio:=1  keep_aspect_ratio_in_inference:=false quick_detection:=true 
$ roslaunch video_stream_opencv camera.launch video_stream_provider:=`rospack find edgetpu_roscpp`/test/data/DJI_0004.MP4
$ rqt_image_view /single_object_detection_and_tracking/detection_result_image

note1: you can also play other video, also add start_frame and stop_frame to set the start and end point of a video, and fps to set the frame rate:

note2: you can download more video data by following command:

$ rosrun edgetpu_roscpp install_additional_video_data.py