intel / ros2_openvino_toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ros2_openvino_toolkit

Table of Contents

Overview

ROS2 Version Supported

Branch Name ROS2 Version Supported Openvino Version OS Version
ros2 Galactic, Foxy, Humble V2022.1, V2022.2, V2022.3 Ubuntu 20.04, Ubuntu 22.04
dashing Dashing V2022.1, V2022.2, V2022.3 Ubuntu 18.04
foxy-ov2021.4 Foxy V2021.4 Ubuntu 20.04
galactic-ov2021.4 Galactic V2021.4 Ubuntu 20.04

Inference Features Supported

  • Object Detection
  • Face Detection
  • Age Gender Recognition
  • Emotion Recognition
  • Head Pose Estimation
  • Object Segmentation
  • Person Re-Identification
  • Vehicle Attribute Detection
  • Vehicle License Plate Detection

Prerequisite

Prerequisite Mandatory? Description
Processor Mandatory A platform with Intel processors assembled. (Refer to here for the full list of Intel processors supported.)
OS Mandatory We only tested this project under Ubuntu distros. It is recommended to install the corresponding Ubuntu Distro according to the ROS distro that you select to use. For example: Ubuntu 18.04 for dashing, Ubuntu 20.04 for Foxy and Galactic, Ubuntu 22.04 for Humble.
ROS2 Mandatory We have already supported active ROS distros (Humble, Galactic, Foxy and Dashing (deprecated)). Choose the one matching your needs. You may find the corresponding branch from the table above in section ROS2 Version Supported.
OpenVINO Mandatory The version of OpenVINO toolkit is decided by the OS and ROS2 distros you use. See the table above in Section ROS2 Version Supported.
Realsense Camera Optional Realsense Camera is optional, you may choose these alternatives as the input: Standard Camera, ROS Image Topic, Video/Image File or RTSP camera.

Introduction

Design Architecture

From the view of hirarchical architecture design, the package is divided into different functional components, as shown in below picture.

OpenVINO_Architecture

Intel® OpenVINO™ toolkit
  • Intel® OpenVINO™ toolkit provides a ROS-adapted runtime framework of neural network which quickly deploys applications and solutions for vision inference. By leveraging Intel® OpenVINO™ toolkit and corresponding libraries, this ROS2 runtime framework extends workloads across Intel® hardware (including accelerators) and maximizes performance.
    • Increase deep learning workload performance up to 19x1 with computer vision accelerators from Intel.
    • Unleash convolutional neural network (CNN)-based deep learning inference using a common API.
    • Speed development using optimized OpenCV* and OpenVX* functions. See more from here for Intel OpenVINO™ introduction.

ROS OpenVINO Runtime Framework
  • ROS OpenVINO Runtime Framework is the main body of this repo. It provides key logic implementation for pipeline lifecycle management, resource management and ROS system adapter, which extends Intel OpenVINO toolkit and libraries. Furthermore, this runtime framework provides ways to simplify launching, configuration, data analysis and re-use.

ROS Input & Output
  • Diversal Input resources are data resources to be infered and analyzed with the OpenVINO framework.
  • ROS interfaces and outputs currently include Topic and service. Natively, RViz output and CV image window output are also supported by refactoring topic message and inferrence results.

Optimized Models
  • Optimized Models provided by Model Optimizer component of Intel® OpenVINO™ toolkit. Imports trained models from various frameworks (Caffe*, Tensorflow*, MxNet*, ONNX*, Kaldi*) and converts them to a unified intermediate representation file. It also optimizes topologies through node merging, horizontal fusion, eliminating batch normalization, and quantization. It also supports graph freeze and graph summarize along with dynamic input freezing.

Logic Flow

From the view of logic implementation, the package introduces the definitions of parameter manager, pipeline and pipeline manager. The following picture depicts how these entities co-work together when the corresponding program is launched.

Logic_Flow

Once a corresponding program is launched with a specified .yaml config file passed in the .launch file or via commandline, parameter manager analyzes the configurations about pipeline and the whole framework, then shares the parsed configuration information with pipeline procedure. A pipeline instance is created by following the configuration info and is added into pipeline manager for lifecycle control and inference action triggering.

The contents in .yaml config file should be well structured and follow the supported rules and entity names. Please see yaml configuration guidance for how to create or edit the config files.

Pipeline

Pipeline fulfills the whole data handling process: initiliazing Input Component for image data gathering and formating; building up the structured inference network and passing the formatted data through the inference network; transfering the inference results and handling output, etc.

Pipeline manager

Pipeline manager manages all the created pipelines according to the inference requests or external demands (say, system exception, resource limitation, or end user's operation). Because of co-working with resource management and being aware of the whole framework, it covers the ability of performance optimization by sharing system resource between pipelines and reducing the burden of data copy.

Supported Features

Multiple Input Components

Currently, the package supports several input resources for acquiring image data. The following tables are listed:

Input Resource Table
Input Resource Description
StandardCamera Any RGB camera with USB port supporting. Currently only the first USB camera if many are connected.
RealSenseCamera Intel RealSense RGB-D Camera, directly calling RealSense Camera via librealsense plugin of openCV.
ImageTopic Any ROS topic which is structured in image message.
Image Any image file which can be parsed by openCV, such as .png, .jpeg.
Video Any video file which can be parsed by openCV.
IpCamera Any RTSP server which can push video stream.

Inference Implementations

Currently, the corresponding relation of supported inference features, models used and yaml configurations are listed as follows:

Inference Feature Correspondence Table
Inference Description YAML Configuration Model Used
Face Detection Object Detection task applied to face recognition using a sequence of neural networks. pipeline_image.yaml
pipeline_image_video.yaml
pipeline_people.yaml
pipeline_people_ip.yaml
face-detection-adas-0001
age-gender-recognition-retail-0013
emotions-recognition-retail-0003
head-pose-estimation-adas-0001
Emotion Recognition Emotion recognition based on detected face image. pipeline_image.yaml
pipeline_image_video.yaml
pipeline_people.yaml
pipeline_people_ip.yaml
emotions-recognition-retail-0003
Age & Gender Recognition Age and gender recognition based on detected face image. pipeline_image.yaml
pipeline_image_video.yaml
pipeline_people.yaml
pipeline_people_ip.yaml
age-gender-recognition-retail-0013
Head Pose Estimation Head pose estimation based on detected face image. pipeline_image.yaml
pipeline_image_video.yaml
pipeline_people.yaml
pipeline_people_ip.yaml
head-pose-estimation-adas-0001
Object Detection Object detection based on SSD-based trained models. pipeline_object.yaml
pipeline_object_topic.yaml
mobilenet-ssd
Vehicle and License Detection Vehicle and license detection based on Intel models. pipeline_vehicle_detection.yaml vehicle-license-plate-detection-barrier-0106
vehicle-attributes-recognition-barrier-0039
license-plate-recognition-barrier-0001
Object Segmentation Object segmentation. pipeline_segmentation.yaml
pipeline_segmentation_image.yaml
pipeline_video.yaml
semantic-segmentation-adas-0001
deeplabv3
Person Attributes Person attributes based on object detection. pipeline_person_attributes.yaml person-attributes-recognition-crossroad-0230
person-detection-retail-0013
Person Reidentification Person reidentification based on object detection. pipeline_person_reidentification.yaml person-detection-retail-0013
person-reidentification-retail-0277
Object Segmentation Maskrcnn Object segmentation and detection based on maskrcnn model. pipeline_segmentation_maskrcnn.yaml mask_rcnn_inception_v2_coco_2018_01_28

ROS interfaces and outputs

The inference results can be output in several types. One or more types can be enabled for any inference pipeline.

Topic

Specific topic(s) can be generated and published according to the given inference functionalities.

Published Topic Correspondence Table
Inference Published Topic
People Detection /ros2_openvino_toolkit/face_detection(object_msgs:msg:ObjectsInBoxes)
Emotion Recognition /ros2_openvino_toolkit/emotions_recognition(object_msgs:msg:EmotionsStamped)
Age and Gender Recognition /ros2_openvino_toolkit/age_genders_Recognition(object_msgs:msg:AgeGenderStamped)
Head Pose Estimation /ros2_openvino_toolkit/headposes_estimation(object_msgs:msg:HeadPoseStamped)
Object Detection /ros2_openvino_toolkit/detected_objects(object_msgs::msg::ObjectsInBoxes)
Object Segmentation /ros2_openvino_toolkit/segmented_obejcts(object_msgs::msg::ObjectsInMasks)
Object Segmentation Maskrcnn /ros2_openvino_toolkit/segmented_obejcts(object_msgs::msg::ObjectsInMasks)
Person Reidentification /ros2_openvino_toolkit/reidentified_persons(object_msgs::msg::ReidentificationStamped)
Vehicle Detection /ros2_openvino_toolkit/detected_vehicles_attribs(object_msgs::msg::VehicleAttribsStamped)
Vehicle License Detection /ros2_openvino_toolkit/detected_license_plates(object_msgs::msg::LicensePlateStamped)

Service

Several ROS2 Services are created, expecting to be used in client/server mode, especially when synchronously getting inference results for a given image frame or when managing inference pipeline's lifecycle.

Service Correspondence Table
Inference Service
Object Detection Service /detect_object(object_msgs::srv::DetectObject)
Face Detection Service /detect_face(object_msgs::srv::DetectObject)
Age Gender Detection Service /detect_age_gender(object_msgs::srv::AgeGender)
Headpose Detection Service /detect_head_pose(object_msgs::srv::HeadPose)
Emotion Detection Service /detect_emotion(object_msgs::srv::Emotion)

RViz

RViz display is also supported by the composited topic of original image frame with inference result. To show in RViz tool, add an image marker with the composited topic: /ros2_openvino_toolkit/image_rviz(sensor_msgs::Image)

Image Window

OpenCV based image window is natively supported by the package. To enable window, Image Window output should be added into the output choices in .yaml config file. Refer to the config file guidance for more information about checking/adding this feature in your launching.

Demo Result Snapshots

For the snapshot of demo results, refer to the following picture.

  • Face detection input from standard camera face_detection_demo_image

  • Object detection input from realsense camera object_detection_demo_realsense

  • Object segmentation input from video object_segmentation_demo_video

  • Person reidentification input from standard camera person_reidentification_demo_video

Installation and Launching

Deploy in Local Environment

Deploy in Docker

Reference

  • Open_model_zoo: Refer to the OpenVINO document for open_model_zoo for detailed model structure and demo samples.
  • OpenVINO api 2.0: Refer to the OpenVINO document for OpenVINO_api_2.0 for latest api 2.0 transition guide.

FAQ

Feedback

  • Report questions, issues and suggestions, using: issue.

More Information

Any security issue should be reported using process at https://01.org/security

About

License:Apache License 2.0


Languages

Language:C++ 83.9%Language:Python 5.2%Language:Shell 4.6%Language:CMake 3.9%Language:Dockerfile 2.4%