diff --git a/.ci_local_test/ros2_openvino_toolkit_test/Dockerfile b/.ci_local_test/ros2_openvino_toolkit_test/Dockerfile new file mode 100644 index 00000000..70b44162 --- /dev/null +++ b/.ci_local_test/ros2_openvino_toolkit_test/Dockerfile @@ -0,0 +1,67 @@ +# ros2 openvino toolkit env master f1b1ca4d914186a1881b87f103be9c6e910c9d80 + +ARG ROS_VERSION +FROM osrf/ros:${ROS_VERSION} +ARG VERSION + + +LABEL maintainer="Jiawei Wu " + +SHELL ["/bin/bash", "-c"] + +# ignore the warning +ARG DEBIAN_FRONTEND=noninteractive +ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 +RUN apt-get update && apt-get install --assume-yes apt-utils + +# install openvino 2022.3 + +# https://docs.openvino.ai/2022.3/openvino_docs_install_guides_installing_openvino_apt.html +RUN apt update && apt install --assume-yes curl wget gnupg2 lsb-release +RUN wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \ +apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && echo "deb https://apt.repos.intel.com/openvino/2022 focal main" | tee /etc/apt/sources.list.d/intel-openvino-2022.list +RUN apt update && apt-cache search openvino && apt install -y openvino-2022.3.0 + + +# install librealsense2 +RUN apt-get install -y --no-install-recommends \ +software-properties-common +# https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md +# Make sure you set http-proxy in below commands if your environment needs. + +RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || apt-key adv --keyserver-options --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE +#RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE +RUN add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u \ +&& apt-get install -y --no-install-recommends \ +librealsense2-dkms \ +librealsense2-utils \ +librealsense2-dev \ +librealsense2-dbg \ +libgflags-dev \ +libboost-all-dev \ +&& rm -rf /var/lib/apt/lists/* + +# other dependencies +RUN apt-get update && apt-get install -y python3-pip && python3 -m pip install -U \ +numpy \ +networkx \ +pyyaml \ +requests \ +&& apt-get install -y --no-install-recommends libboost-all-dev +WORKDIR /usr/lib/x86_64-linux-gnu +RUN ln -sf libboost_python-py36.so libboost_python37.so +RUN pip install --upgrade pip +#RUN pip install openvino-dev[tensorflow2]==2022.3 + +# build ros2 openvino toolkit +WORKDIR /root +RUN mkdir -p catkin_ws/src +WORKDIR /root/catkin_ws/src +RUN git clone https://github.com/intel/ros2_object_msgs.git +##://github.com/intel/ros2_openvino_toolkit.git +RUN git clone -b ${VERSION} https://github.com/ros-perception/vision_opencv.git +RUN git clone -b ros2-development https://github.com/IntelRealSense/realsense-ros.git +RUN apt-get install ros-${VERSION}-diagnostic-updater +WORKDIR /root/catkin_ws +COPY jpg /root/jpg +#RUN source /opt/ros/${VERSION}/setup.bash && source /opt/intel/openvino_2022/setupvars.sh && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release diff --git a/.ci_local_test/ros2_openvino_toolkit_test/docker_run.sh b/.ci_local_test/ros2_openvino_toolkit_test/docker_run.sh new file mode 100755 index 00000000..3769bf79 --- /dev/null +++ b/.ci_local_test/ros2_openvino_toolkit_test/docker_run.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +export DISPLAY=:0 + +export work_dir=$PWD + + +function run_container() { + + docker images | grep ros2_openvino_docker + + if [ $? -eq 0 ] + then + echo "the image of ros2_openvino_docker:01 existence" + docker rmi -f ros2_openvino_docker:01 + fi + + docker ps -a | grep ros2_openvino_container + if [ $? -eq 0 ] + then + docker rm -f ros2_openvino_container + fi + # Using jenkins server ros2_openvino_toolkit code instead of git clone code. + cd $work_dir && sed -i 's/RUN git clone -b ros2 https/#/g' Dockerfile + cd $work_dir && docker build --build-arg ROS_VERSION=galactic-desktop --build-arg VERSION=galactic -t ros2_openvino_docker:01 . + docker run -i --privileged=true -v $work_dir/ros2_openvino_toolkit:/root/catkin_ws/src/ros2_openvino_toolkit -v $work_dir/test_cases:/root/test_cases --name ros2_openvino_container ros2_openvino_docker:01 bash -c "cd /root/test_cases && ./run.sh galactic" + +} + +run_container +if [ $? -ne 0 ] +then + echo "Test fail" + exit -1 +fi + + diff --git a/.ci_local_test/ros2_openvino_toolkit_test/jpg/car.jpg b/.ci_local_test/ros2_openvino_toolkit_test/jpg/car.jpg new file mode 100644 index 00000000..f53b0339 Binary files /dev/null and b/.ci_local_test/ros2_openvino_toolkit_test/jpg/car.jpg differ diff --git a/.ci_local_test/ros2_openvino_toolkit_test/jpg/cars.jpg b/.ci_local_test/ros2_openvino_toolkit_test/jpg/cars.jpg new file mode 100644 index 00000000..da985769 Binary files /dev/null and b/.ci_local_test/ros2_openvino_toolkit_test/jpg/cars.jpg differ diff --git a/.ci_local_test/ros2_openvino_toolkit_test/jpg/face_reid.jpg b/.ci_local_test/ros2_openvino_toolkit_test/jpg/face_reid.jpg new file mode 100644 index 00000000..8359b9ee Binary files /dev/null and b/.ci_local_test/ros2_openvino_toolkit_test/jpg/face_reid.jpg differ diff --git a/.ci_local_test/ros2_openvino_toolkit_test/jpg/object_detection.jpg b/.ci_local_test/ros2_openvino_toolkit_test/jpg/object_detection.jpg new file mode 100644 index 00000000..5b31668d Binary files /dev/null and b/.ci_local_test/ros2_openvino_toolkit_test/jpg/object_detection.jpg differ diff --git a/.ci_local_test/ros2_openvino_toolkit_test/jpg/people_detection.jpg b/.ci_local_test/ros2_openvino_toolkit_test/jpg/people_detection.jpg new file mode 100644 index 00000000..a9ba446e Binary files /dev/null and b/.ci_local_test/ros2_openvino_toolkit_test/jpg/people_detection.jpg differ diff --git a/.ci_local_test/ros2_openvino_toolkit_test/jpg/people_reid.jpg b/.ci_local_test/ros2_openvino_toolkit_test/jpg/people_reid.jpg new file mode 100644 index 00000000..20329ada Binary files /dev/null and b/.ci_local_test/ros2_openvino_toolkit_test/jpg/people_reid.jpg differ diff --git a/.ci_local_test/ros2_openvino_toolkit_test/jpg/segmentation.jpg b/.ci_local_test/ros2_openvino_toolkit_test/jpg/segmentation.jpg new file mode 100644 index 00000000..77599d4f Binary files /dev/null and b/.ci_local_test/ros2_openvino_toolkit_test/jpg/segmentation.jpg differ diff --git a/.ci_local_test/ros2_openvino_toolkit_test/jpg/vehicle_detection.jpg b/.ci_local_test/ros2_openvino_toolkit_test/jpg/vehicle_detection.jpg new file mode 100644 index 00000000..a8f015c9 Binary files /dev/null and b/.ci_local_test/ros2_openvino_toolkit_test/jpg/vehicle_detection.jpg differ diff --git a/.ci_local_test/ros2_openvino_toolkit_test/test_cases/config.sh b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/config.sh new file mode 100755 index 00000000..0efee6ce --- /dev/null +++ b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/config.sh @@ -0,0 +1,13 @@ +#/bin/bash + +if [[ $1 == '' ]] +then + export ros2_branch=galactic +else + export ros2_branch=$1 +fi + +export dynamic_vino_sample=/root/catkin_ws/install/openvino_node/share/openvino_node + + +source /opt/ros/$ros2_branch/setup.bash diff --git a/.ci_local_test/ros2_openvino_toolkit_test/test_cases/log/pipeline_image_test_ci.log b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/log/pipeline_image_test_ci.log new file mode 100644 index 00000000..e69de29b diff --git a/.ci_local_test/ros2_openvino_toolkit_test/test_cases/log/pipeline_people_test_ci.log b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/log/pipeline_people_test_ci.log new file mode 100644 index 00000000..e69de29b diff --git a/.ci_local_test/ros2_openvino_toolkit_test/test_cases/log/pipeline_person_attributes_test_ci.log b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/log/pipeline_person_attributes_test_ci.log new file mode 100644 index 00000000..e69de29b diff --git a/.ci_local_test/ros2_openvino_toolkit_test/test_cases/log/pipeline_reidentification_test_ci.log b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/log/pipeline_reidentification_test_ci.log new file mode 100644 index 00000000..e69de29b diff --git a/.ci_local_test/ros2_openvino_toolkit_test/test_cases/log/pipeline_vehicle_detection_test_ci.log b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/log/pipeline_vehicle_detection_test_ci.log new file mode 100644 index 00000000..e69de29b diff --git a/.ci_local_test/ros2_openvino_toolkit_test/test_cases/ros2_openvino_tool_model_download.sh b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/ros2_openvino_tool_model_download.sh new file mode 100755 index 00000000..d8824d38 --- /dev/null +++ b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/ros2_openvino_tool_model_download.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +mkdir -p /opt/openvino_toolkit/models +#apt install -y python-pip +apt install -y python3.8-venv +cd ~ && python3 -m venv openvino_env && source openvino_env/bin/activate +python -m pip install --upgrade pip +pip install openvino-dev[tensorflow2,mxnet,caffe] + + +#Download the optimized Intermediate Representation (IR) of model (execute once) +cd ~/catkin_ws/src/ros2_openvino_toolkit/data/model_list && omz_downloader --list download_model.lst -o /opt/openvino_toolkit/models/ +cd ~/catkin_ws/src/ros2_openvino_toolkit/data/model_list && sed -i 's/mask_rcnn_inception_resnet_v2_atrous_coco//' convert_model.lst +#cd ~/catkin_ws/src/ros2_openvino_toolkit/data/model_list && sed -i 's/deeplabv3//' convert_model.lst + +cd ~/catkin_ws/src/ros2_openvino_toolkit/data/model_list && omz_converter --list convert_model.lst -d /opt/openvino_toolkit/models/ -o /opt/openvino_toolkit/models/convert + +#Copy label files (execute once) +cp ~/catkin_ws/src/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/openvino_toolkit/models/intel/face-detection-adas-0001/FP32/ +cp ~/catkin_ws/src/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/openvino_toolkit/models/intel/face-detection-adas-0001/FP16/ +cp ~/catkin_ws/src/ros2_openvino_toolkit/data/labels/emotions-recognition/FP32/emotions-recognition-retail-0003.labels /opt/openvino_toolkit/models/intel/emotions-recognition-retail-0003/FP32/ +cp ~/catkin_ws/src/ros2_openvino_toolkit/data/labels/object_segmentation/frozen_inference_graph.labels /opt/openvino_toolkit/models/intel/semantic-segmentation-adas-0001/FP32/ +cp ~/catkin_ws/src/ros2_openvino_toolkit/data/labels/object_segmentation/frozen_inference_graph.labels /opt/openvino_toolkit/models/intel/semantic-segmentation-adas-0001/FP16/ +cp ~/catkin_ws/src/ros2_openvino_toolkit/data/labels/object_detection/vehicle-license-plate-detection-barrier-0106.labels /opt/openvino_toolkit/models/intel/vehicle-license-plate-detection-barrier-0106/FP32 + +mkdir -p /opt/openvino_toolkit/models/convert/ +#cp -r /root/public/ /opt/openvino_toolkit/models/convert/ diff --git a/.ci_local_test/ros2_openvino_toolkit_test/test_cases/run.sh b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/run.sh new file mode 100755 index 00000000..eb362cc5 --- /dev/null +++ b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/run.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +export ros2_branch=$1 +if [[ $1 == '' ]] +then + export ros2_branch=galactic +else + export ros2_branch=$1 +fi +source /root/test_cases/config.sh $ros2_branch + +cd /root/catkin_ws && colcon build --symlink-install +cd /root/catkin_ws && source ./install/local_setup.bash + +apt-get update +# apt-get install -y ros-$ros2_branch-diagnostic-updater +apt-get install python3-defusedxml +apt-get install -y python3-pip +pip3 install XTestRunner + +cd /root/test_cases && ./ros2_openvino_tool_model_download.sh +mkdir -p /root/test_cases/log +echo "===cat pipeline_people_ci.yaml" +cat /root/catkin_ws/install/openvino_node/share/openvino_node/param/pipeline_people_ci.yaml + + +cd /root/test_cases/unittest && python3 run_all.py +if [ $? -ne 0 ] +then + exit -1 +fi + diff --git a/.ci_local_test/ros2_openvino_toolkit_test/test_cases/unittest/run_all.py b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/unittest/run_all.py new file mode 100755 index 00000000..8abfd384 --- /dev/null +++ b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/unittest/run_all.py @@ -0,0 +1,39 @@ +#!/usr/opt/python3 +import unittest +from test_cases import Test_Cases +from XTestRunner import HTMLTestRunner + +def main(): + + suite = unittest.TestSuite() + suite.addTest(Test_Cases('test_1_pipeline_people_ci')) + suite.addTest(Test_Cases('test_2_pipeline_reidentification_ci')) + suite.addTest(Test_Cases('test_3_pipeline_image_ci')) + suite.addTest(Test_Cases('test_6_pipeline_vehicle_detection_ci')) + suite.addTest(Test_Cases('test_7_pipeline_person_attributes_ci')) + + with (open('./result.html', 'wb')) as fp: + runner = HTMLTestRunner( + stream=fp, + title='ROS2 Openvino Test Report', + description='Test ROS2-galactic openvino all cases', + language='en', + ) + result = runner.run( + testlist=suite, + rerun=0, + save_last_run=False + ) + + print(f"success count: {result.success_count}") + print(f"failure count: {result.failure_count}") + print(f"runtime:", result.case_end_time - result.case_start_time) + if result.failure_count == 0 and result.error_count == 0: + print(f"Test ALL PASS") + else: + print(f"Test FAIL") + exit(-1) + +if __name__=="__main__": + main() + diff --git a/.ci_local_test/ros2_openvino_toolkit_test/test_cases/unittest/test_cases.py b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/unittest/test_cases.py new file mode 100755 index 00000000..2343a4bb --- /dev/null +++ b/.ci_local_test/ros2_openvino_toolkit_test/test_cases/unittest/test_cases.py @@ -0,0 +1,102 @@ +#from asyncio import sleep +from time import sleep +import unittest +import subprocess +import pdb +import os + +class Test_Cases(unittest.TestCase): + def test_pipeline(self, launch_file, log_file, topic_list=['/rosout']): + print(f"{log_file} topic_list", topic_list) + log_file = f"/root/test_cases/log/" + log_file + kill_ros2_process() + subprocess.Popen([f"ros2 launch openvino_node {launch_file} > {log_file} &"],shell=True).communicate() + for topic in topic_list: + name=topic.split('/', -1)[-1] + sleep(2) + subprocess.Popen([f"ros2 topic echo {topic} > {name}.log &"], shell=True).communicate() + process_result = subprocess.Popen(["ps -ef | grep ros2 | grep -v 'grep' | awk '{print $2}'"],stdout=subprocess.PIPE, shell=True).communicate() + kill_ros2_process() + print(f"kill the test process done") + with open(f"{log_file}") as handle: + log = handle.read() + check_log = log.split("user interrupted with ctrl-c (SIGINT)")[0] + if f"pipeline_object_yolo" not in log_file: + self.assertIn('Analyzing Detection results', check_log) + self.assertNotIn('ERROR', check_log) + for topic in topic_list: + name = topic.split('/', -1)[-1] + with open(f"{name}.log") as topic_handle: + topic_info = topic_handle.read() + print("assertIn", self.assertIn("header", topic_info)) + print(f"check all done") + + + def test_1_pipeline_people_ci(self): + topic_ls = ["/ros2_openvino_toolkit/age_genders_Recognition", \ + "/ros2_openvino_toolkit/headposes_estimation", \ + "/ros2_openvino_toolkit/face_detection", \ + "/ros2_openvino_toolkit/emotions_recognition"] + launch_file = f"pipeline_people_ci_test.py" + log_file = f"pipeline_people_test_ci.log" + self.test_pipeline(launch_file, log_file, topic_list=topic_ls) + + def test_2_pipeline_reidentification_ci(self): + topic_ls = ["/ros2_openvino_toolkit/reidentified_persons",] + launch_file = f"pipeline_reidentification_ci_test.py" + log_file = f"pipeline_reidentification_test_ci.log" + self.test_pipeline(launch_file, log_file, topic_list=topic_ls) + + def test_3_pipeline_image_ci(self): + topic_ls = ["/ros2_openvino_toolkit/emotions_recognition", \ + "/ros2_openvino_toolkit/headposes_estimation", \ + "/ros2_openvino_toolkit/people/age_genders_Recognition"] + launch_file = f"pipeline_image_ci_test.py" + log_file = f"pipeline_image_test_ci.log" + self.test_pipeline(launch_file, log_file, topic_list=topic_ls) + + def test_4_pipeline_segmentation_ci(self): + topic_ls = ["/ros2_openvino_toolkit/segmented_obejcts"] + launch_file = f"pipeline_segmentation_ci_test.py" + log_file = f"pipeline_segmentation_test_ci.log" + self.test_pipeline(launch_file, log_file, topic_list=topic_ls) + + def test_5_pipeline_segmentation_image_ci(self): + topic_ls = ["/ros2_openvino_toolkit/segmented_obejcts"] + launch_file = f"pipeline_segmentation_image_ci_test.py" + log_file = f"pipeline_segmentation_image_test_ci.log" + self.test_pipeline(launch_file, log_file, topic_list=topic_ls) + + def test_6_pipeline_vehicle_detection_ci(self): + topic_ls = ["/ros2_openvino_toolkit/detected_license_plates", + "/ros2_openvino_toolkit/detected_vehicles_attribs"] + launch_file = f"pipeline_vehicle_detection_ci_test.py" + log_file = f"pipeline_vehicle_detection_test_ci.log" + self.test_pipeline(launch_file, log_file, topic_list=topic_ls) + + def test_7_pipeline_person_attributes_ci(self): + topic_ls = ["/ros2_openvino_toolkit/detected_objects", \ + "/ros2_openvino_toolkit/person_attributes"] + launch_file = f"pipeline_person_attributes_ci_test.py" + log_file = f"pipeline_person_attributes_test_ci.log" + self.test_pipeline(launch_file, log_file, topic_list=topic_ls) + + def test_8_pipeline_object_yolo_ci(self): + topic_ls = ["/ros2_openvino_toolkit/detected_objects"] + launch_file = f"pipeline_object_yolo_ci_test.py" + log_file = f"pipeline_object_yolo_test_ci.log" + self.test_pipeline(launch_file, log_file, topic_list=topic_ls) + + + + + +def kill_ros2_process(): + sleep(30) + process_result = subprocess.Popen(["ps -ef | grep ros2 | grep -v 'grep' | awk '{print $2}'"],stdout=subprocess.PIPE, shell=True).communicate() + print(process_result[0].decode('utf-8').replace('\n', ' ')) + kill_process = 'kill -9 ' + process_result[0].decode('utf-8').replace('\n', ' ') + subprocess.Popen([kill_process], shell=True).communicate() + + + diff --git a/.github/workflows/ros2_branch.yml b/.github/workflows/ros2_branch.yml new file mode 100644 index 00000000..0b9add50 --- /dev/null +++ b/.github/workflows/ros2_branch.yml @@ -0,0 +1,36 @@ +# This is a basic workflow to help you get started with Actions + +name: ros2_branch_CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "master" branch + push: + branches: [ "ros2" ] + pull_request: + branches: [ "ros2" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-20.04 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + + # Runs a set of commands using the runners shell + - name: ros2_openvino_toolkit_test + run: | + pwd + mkdir -p ../workspace_ci + cp -r ${GITHUB_WORKSPACE}/.ci_local_test/ros2_openvino_toolkit_test ../workspace_ci + cp -r ${GITHUB_WORKSPACE} ../workspace_ci/ros2_openvino_toolkit_test + cd ../workspace_ci/ros2_openvino_toolkit_test && ./docker_run.sh diff --git a/sample/launch/pipeline_image_ci_test.py b/sample/launch/pipeline_image_ci_test.py new file mode 100644 index 00000000..644ccb76 --- /dev/null +++ b/sample/launch/pipeline_image_ci_test.py @@ -0,0 +1,56 @@ +# Copyright 2018 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Launch face detection and rviz.""" + +import os + +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +import launch_ros.actions + +from launch.substitutions import LaunchConfiguration, PythonExpression +import launch + +def generate_launch_description(): + #default_yaml = os.path.join(get_package_share_directory('openvino_node'), 'param', + #'pipeline_image.yaml') + default_rviz = os.path.join(get_package_share_directory('openvino_node'), 'launch', + 'rviz/default.rviz') + return LaunchDescription([ + launch.actions.DeclareLaunchArgument(name='yaml_path', default_value = + os.path.join(get_package_share_directory('openvino_node'), 'param','pipeline_image_ci.yaml')), + # Openvino detection + launch_ros.actions.Node( + package='openvino_node', + executable='pipeline_with_params', + arguments=['-config', LaunchConfiguration('yaml_path')], + remappings=[ + ('/openvino_toolkit/people/faces', + '/ros2_openvino_toolkit/face_detection'), + ('/openvino_toolkit/people/emotions', + '/ros2_openvino_toolkit/emotions_recognition'), + ('/openvino_toolkit/people/headposes', + '/ros2_openvino_toolkit/headposes_estimation'), + ('/openvino_toolkit/people/age_genders', + '/ros2_openvino_toolkit/people/age_genders_Recognition'), + ('/openvino_toolkit/people/images', '/ros2_openvino_toolkit/image_rviz')], + output='screen'), + + # Rviz + #launch_ros.actions.Node( + #package='rviz2', + #executable='rviz2', output='screen', + #arguments=['--display-config', default_rviz]), + ]) diff --git a/sample/launch/pipeline_object_yolo_ci_test.py b/sample/launch/pipeline_object_yolo_ci_test.py new file mode 100644 index 00000000..083ed88d --- /dev/null +++ b/sample/launch/pipeline_object_yolo_ci_test.py @@ -0,0 +1,51 @@ +# Copyright 2018 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Launch face detection and rviz.""" + +import os + +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +import launch_ros.actions + +from launch.substitutions import LaunchConfiguration, PythonExpression +import launch + +def generate_launch_description(): + #default_yaml = os.path.join(get_package_share_directory('openvino_node'), 'param', + #'pipeline_object_yolo.yaml') + default_rviz = os.path.join(get_package_share_directory('openvino_node'), 'launch', + 'rviz/default.rviz') + return LaunchDescription([ + launch.actions.DeclareLaunchArgument(name='yaml_path', default_value = + os.path.join(get_package_share_directory('openvino_node'), 'param','pipeline_object_yolo_ci.yaml')), + # Openvino detection + launch_ros.actions.Node( + package='openvino_node', + executable='pipeline_with_params', + arguments=['-config', LaunchConfiguration('yaml_path')], + remappings=[ + ('/openvino_toolkit/object/detected_objects', + '/ros2_openvino_toolkit/detected_objects'), + ('/openvino_toolkit/object/images', + '/ros2_openvino_toolkit/image_rviz')], + output='screen'), + + # Rviz + #launch_ros.actions.Node( + #package='rviz2', + #executable='rviz2', output='screen', + #arguments=['--display-config', default_rviz]), + ]) diff --git a/sample/launch/pipeline_people_ci_test.py b/sample/launch/pipeline_people_ci_test.py new file mode 100644 index 00000000..e37d4e45 --- /dev/null +++ b/sample/launch/pipeline_people_ci_test.py @@ -0,0 +1,58 @@ +# Copyright 2018 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Launch face detection and rviz.""" + +import os + +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +import launch_ros.actions + +from launch.substitutions import LaunchConfiguration, PythonExpression +import launch + + +def generate_launch_description(): + #default_yaml = os.path.join(get_package_share_directory('openvino_node'), 'param', + #'pipeline_people.yaml') + + default_rviz = os.path.join(get_package_share_directory('openvino_node'), 'launch', + 'rviz/default.rviz') + return LaunchDescription([ + launch.actions.DeclareLaunchArgument(name='yaml_path', default_value = + os.path.join(get_package_share_directory('openvino_node'), 'param','pipeline_people_ci.yaml')), + # Openvino detection + launch_ros.actions.Node( + package='openvino_node', + executable='pipeline_with_params', + arguments=['-config', LaunchConfiguration('yaml_path')], + remappings=[ + ('/openvino_toolkit/people/detected_objects', + '/ros2_openvino_toolkit/face_detection'), + ('/openvino_toolkit/people/emotions', + '/ros2_openvino_toolkit/emotions_recognition'), + ('/openvino_toolkit/people/headposes', + '/ros2_openvino_toolkit/headposes_estimation'), + ('/openvino_toolkit/people/age_genders', + '/ros2_openvino_toolkit/age_genders_Recognition'), + ('/openvino_toolkit/people/images', '/ros2_openvino_toolkit/image_rviz')], + output='screen'), + + # Rviz + #launch_ros.actions.Node( + #package='rviz2', + #executable='rviz2', output='screen', + #arguments=['--display-config', default_rviz]), + ]) diff --git a/sample/launch/pipeline_person_attributes_ci_test.py b/sample/launch/pipeline_person_attributes_ci_test.py new file mode 100644 index 00000000..75db6d5c --- /dev/null +++ b/sample/launch/pipeline_person_attributes_ci_test.py @@ -0,0 +1,51 @@ +# Copyright 2018 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Launch face detection and rviz.""" + +import os + +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +import launch_ros.actions + +from launch.substitutions import LaunchConfiguration, PythonExpression +import launch + +def generate_launch_description(): + #default_yaml = os.path.join(get_package_share_directory('openvino_node'), 'param', + #'pipeline_person_attributes.yaml') + default_rviz = os.path.join(get_package_share_directory('openvino_node'), 'launch', + 'rviz/default.rviz') + return LaunchDescription([ + launch.actions.DeclareLaunchArgument(name='yaml_path', default_value = + os.path.join(get_package_share_directory('openvino_node'), 'param','pipeline_person_attributes_ci.yaml')), + # Openvino detection + launch_ros.actions.Node( + package='openvino_node', + executable='pipeline_with_params', + arguments=['-config', LaunchConfiguration('yaml_path')], + remappings=[ + ('/openvino_toolkit/object/detected_objects', + '/ros2_openvino_toolkit/detected_objects'), + ('/openvino_toolkit/object/person_attributes','/ros2_openvino_toolkit/person_attributes'), + ('/openvino_toolkit/object/images', '/ros2_openvino_toolkit/image_rviz')], + output='screen'), + + # Rviz + #launch_ros.actions.Node( + #package='rviz2', + #executable='rviz2', output='screen', + #arguments=['--display-config', default_rviz]), + ]) diff --git a/sample/launch/pipeline_reidentification_ci_test.py b/sample/launch/pipeline_reidentification_ci_test.py new file mode 100644 index 00000000..9461bcf1 --- /dev/null +++ b/sample/launch/pipeline_reidentification_ci_test.py @@ -0,0 +1,52 @@ +# Copyright 2018 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Launch face detection and rviz.""" + +import os + +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +import launch_ros.actions + +from launch.substitutions import LaunchConfiguration, PythonExpression +import launch + +def generate_launch_description(): + #default_yaml = os.path.join(get_package_share_directory('openvino_node'), 'param', + #'pipeline_reidentification.yaml') + default_rviz = os.path.join(get_package_share_directory('openvino_node'), 'launch', + 'rviz/default.rviz') + return LaunchDescription([ + launch.actions.DeclareLaunchArgument(name='yaml_path', default_value = + os.path.join(get_package_share_directory('openvino_node'), 'param','pipeline_reidentification_ci.yaml')), + # Openvino detection + launch_ros.actions.Node( + package='openvino_node', + executable='pipeline_with_params', + arguments=['-config', LaunchConfiguration('yaml_path')], + remappings=[ + ('/openvino_toolkit/object/detected_objects', + '/ros2_openvino_toolkit/detected_objects'), + ('/openvino_toolkit/object/reidentified_persons', + '/ros2_openvino_toolkit/reidentified_persons'), + ('/openvino_toolkit/object/images', '/ros2_openvino_toolkit/image_rviz')], + output='screen'), + + # Rviz + #launch_ros.actions.Node( + #package='rviz2', + #executable='rviz2', output='screen', + #arguments=['--display-config', default_rviz]), + ]) diff --git a/sample/launch/pipeline_vehicle_detection_ci_test.py b/sample/launch/pipeline_vehicle_detection_ci_test.py new file mode 100644 index 00000000..f4d72f15 --- /dev/null +++ b/sample/launch/pipeline_vehicle_detection_ci_test.py @@ -0,0 +1,52 @@ +# Copyright 2018 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Launch face detection and rviz.""" + +import os + +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +import launch_ros.actions + +from launch.substitutions import LaunchConfiguration, PythonExpression +import launch + +def generate_launch_description(): + #default_yaml = os.path.join(get_package_share_directory('openvino_node'), 'param', + #'pipeline_vehicle_detection.yaml') + default_rviz = os.path.join(get_package_share_directory('openvino_node'), 'launch', + 'rviz/default.rviz') + return LaunchDescription([ + launch.actions.DeclareLaunchArgument(name='yaml_path', default_value = + os.path.join(get_package_share_directory('openvino_node'), 'param','pipeline_vehicle_detection_ci.yaml')), + # Openvino detection + launch_ros.actions.Node( + package='openvino_node', + executable='pipeline_with_params', + arguments=['-config', LaunchConfiguration('yaml_path')], + remappings=[ + ('/openvino_toolkit/object/detected_license_plates', + '/ros2_openvino_toolkit/detected_license_plates'), + ('/openvino_toolkit/object/detected_vehicles_attribs', + '/ros2_openvino_toolkit/detected_vehicles_attribs'), + ('/openvino_toolkit/object/images', '/ros2_openvino_toolkit/image_rviz')], + output='screen'), + + # Rviz + #launch_ros.actions.Node( + #package='rviz2', + #executable='rviz2', output='screen', + #arguments=['--display-config', default_rviz]), + ]) diff --git a/sample/param/pipeline_image_ci.yaml b/sample/param/pipeline_image_ci.yaml new file mode 100644 index 00000000..37da03ba --- /dev/null +++ b/sample/param/pipeline_image_ci.yaml @@ -0,0 +1,41 @@ +Pipelines: +- name: people + inputs: [Image] + input_path: /root/catkin_ws/src/ros2_openvino_toolkit/data/images/sample_faces.jpg + infers: + - name: FaceDetection + model: /opt/openvino_toolkit/models/intel/face-detection-adas-0001/FP16/face-detection-adas-0001.xml + engine: CPU + label: /opt/openvino_toolkit/models/intel/face-detection-adas-0001/FP16/face-detection-adas-0001.labels + batch: 1 + confidence_threshold: 0.5 + enable_roi_constraint: true # set enable_roi_constraint to false if you don't want to make the inferred ROI (region of interest) constrained into the camera frame + - name: AgeGenderRecognition + model: /opt/openvino_toolkit/models/intel/age-gender-recognition-retail-0013/FP32/age-gender-recognition-retail-0013.xml + engine: CPU + label: to/be/set/xxx.labels + batch: 16 + - name: EmotionRecognition + model: /opt/openvino_toolkit/models/intel/emotions-recognition-retail-0003/FP32/emotions-recognition-retail-0003.xml + engine: CPU + label: /opt/openvino_toolkit/models/intel/emotions-recognition-retail-0003/FP32/emotions-recognition-retail-0003.labels + batch: 16 + - name: HeadPoseEstimation + model: /opt/openvino_toolkit/models/intel/head-pose-estimation-adas-0001/FP32/head-pose-estimation-adas-0001.xml + engine: CPU + label: to/be/set/xxx.labels + batch: 16 + outputs: [RosTopic] + connects: + - left: Image + right: [FaceDetection] + - left: FaceDetection + right: [AgeGenderRecognition, EmotionRecognition, HeadPoseEstimation, RosTopic] + - left: AgeGenderRecognition + right: [RosTopic] + - left: EmotionRecognition + right: [RosTopic] + - left: HeadPoseEstimation + right: [RosTopic] + +Common: diff --git a/sample/param/pipeline_object_yolo_ci.yaml b/sample/param/pipeline_object_yolo_ci.yaml new file mode 100644 index 00000000..7804ecb0 --- /dev/null +++ b/sample/param/pipeline_object_yolo_ci.yaml @@ -0,0 +1,21 @@ +Pipelines: +- name: object + inputs: [Image] + input_path: /root/catkin_ws/src/ros2_openvino_toolkit/data/images/sample_faces.jpg + infers: + - name: ObjectDetection + model: /opt/openvino_toolkit/models/convert/public/yolov5n/FP32/yolov5n.xml + model_type: yolov5 + engine: CPU #MYRIAD + label: to/be/set/xxx.labels + batch: 1 + confidence_threshold: 0.5 + enable_roi_constraint: true # set enable_roi_constraint to false if you don't want to make the inferred ROI (region of interest) constrained into the camera frame + outputs: [RosTopic] + connects: + - left: Image + right: [ObjectDetection] + - left: ObjectDetection + right: [RosTopic] + +OpenvinoCommon: diff --git a/sample/param/pipeline_people_ci.yaml b/sample/param/pipeline_people_ci.yaml new file mode 100644 index 00000000..ce0a1e90 --- /dev/null +++ b/sample/param/pipeline_people_ci.yaml @@ -0,0 +1,41 @@ +Pipelines: +- name: people + inputs: [Image] + input_path: /root/catkin_ws/src/ros2_openvino_toolkit/data/images/sample_faces.jpg + infers: + - name: FaceDetection + model: /opt/openvino_toolkit/models/intel/face-detection-adas-0001/FP16/face-detection-adas-0001.xml + engine: CPU + label: /opt/openvino_toolkit/models/intel/face-detection-adas-0001/FP16/face-detection-adas-0001.labels + batch: 1 + confidence_threshold: 0.5 + enable_roi_constraint: true # set enable_roi_constraint to false if you don't want to make the inferred ROI (region of interest) constrained into the camera frame + - name: AgeGenderRecognition + model: /opt/openvino_toolkit/models/intel/age-gender-recognition-retail-0013/FP32/age-gender-recognition-retail-0013.xml + engine: CPU + label: to/be/set/xxx.labels + batch: 16 + - name: EmotionRecognition + model: /opt/openvino_toolkit/models/intel/emotions-recognition-retail-0003/FP32/emotions-recognition-retail-0003.xml + engine: CPU + label: /opt/openvino_toolkit/models/intel/emotions-recognition-retail-0003/FP32/emotions-recognition-retail-0003.labels + batch: 16 + - name: HeadPoseEstimation + model: /opt/openvino_toolkit/models/intel/head-pose-estimation-adas-0001/FP32/head-pose-estimation-adas-0001.xml + engine: CPU + label: to/be/set/xxx.labels + batch: 16 + outputs: [RosTopic] + connects: + - left: Image + right: [FaceDetection] + - left: FaceDetection + right: [AgeGenderRecognition, EmotionRecognition, HeadPoseEstimation, RosTopic] + - left: AgeGenderRecognition + right: [RosTopic] + - left: EmotionRecognition + right: [RosTopic] + - left: HeadPoseEstimation + right: [RosTopic] + +Common: diff --git a/sample/param/pipeline_person_attributes_ci.yaml b/sample/param/pipeline_person_attributes_ci.yaml new file mode 100644 index 00000000..786c2461 --- /dev/null +++ b/sample/param/pipeline_person_attributes_ci.yaml @@ -0,0 +1,28 @@ +Pipelines: +- name: object + inputs: [Image] + input_path: /root/catkin_ws/src/ros2_openvino_toolkit/data/images/sample_faces.jpg + infers: + - name: ObjectDetection + model: /opt/openvino_toolkit/models/intel/person-detection-retail-0013/FP32/person-detection-retail-0013.xml + engine: CPU + label: to/be/set/xxx.labels + batch: 1 + confidence_threshold: 0.5 + enable_roi_constraint: true # set enable_roi_constraint to false if you don't want to make the inferred ROI (region of interest) constrained into the camera frame + - name: PersonAttribsDetection + model: /opt/openvino_toolkit/models/intel/person-attributes-recognition-crossroad-0230/FP32/person-attributes-recognition-crossroad-0230.xml + engine: CPU + label: to/be/set/xxx.labels + batch: 1 + confidence_threshold: 0.5 + outputs: [RosTopic] + connects: + - left: Image + right: [ObjectDetection] + - left: ObjectDetection + right: [PersonAttribsDetection, RosTopic] + - left: PersonAttribsDetection + right: [RosTopic] + +OpenvinoCommon: diff --git a/sample/param/pipeline_reidentification_ci.yaml b/sample/param/pipeline_reidentification_ci.yaml new file mode 100644 index 00000000..72b8f22a --- /dev/null +++ b/sample/param/pipeline_reidentification_ci.yaml @@ -0,0 +1,28 @@ +Pipelines: +- name: object + inputs: [Image] + input_path: /root/catkin_ws/src/ros2_openvino_toolkit/data/images/sample_faces.jpg + infers: + - name: ObjectDetection + model: /opt/openvino_toolkit/models/intel/person-detection-retail-0013/FP32/person-detection-retail-0013.xml + engine: CPU + label: to/be/set/xxx.labels + batch: 1 + confidence_threshold: 0.5 + enable_roi_constraint: true # set enable_roi_constraint to false if you don't want to make the inferred ROI (region of interest) constrained into the camera frame + - name: PersonReidentification + model: /opt/openvino_toolkit/models/intel/person-reidentification-retail-0277/FP32/person-reidentification-retail-0277.xml + engine: CPU + label: to/be/set/xxx.labels + batch: 1 + confidence_threshold: 0.7 + outputs: [RosTopic] + connects: + - left: Image + right: [ObjectDetection] + - left: ObjectDetection + right: [PersonReidentification] + - left: PersonReidentification + right: [RosTopic] + +OpenvinoCommon: diff --git a/sample/param/pipeline_vehicle_detection_ci.yaml b/sample/param/pipeline_vehicle_detection_ci.yaml new file mode 100644 index 00000000..760ff276 --- /dev/null +++ b/sample/param/pipeline_vehicle_detection_ci.yaml @@ -0,0 +1,35 @@ +Pipelines: +- name: object + inputs: [Image] + input_path: /root/jpg/car.jpg + infers: + - name: ObjectDetection + model: /opt/openvino_toolkit/models/intel/vehicle-license-plate-detection-barrier-0106/FP32/vehicle-license-plate-detection-barrier-0106.xml + engine: CPU + label: /opt/openvino_toolkit/models/intel/vehicle-license-plate-detection-barrier-0106/FP32/vehicle-license-plate-detection-barrier-0106.labels + batch: 1 + enable_roi_constraint: true # set enable_roi_constraint to false if you don't want to make the inferred ROI (region of interest) constrained into the camera frame + - name: VehicleAttribsDetection + model: /opt/openvino_toolkit/models/intel/vehicle-attributes-recognition-barrier-0039/FP32/vehicle-attributes-recognition-barrier-0039.xml + engine: CPU + label: to/be/set/xxx.labels + batch: 1 + - name: LicensePlateDetection + model: /opt/openvino_toolkit/models/intel/license-plate-recognition-barrier-0001/FP32/license-plate-recognition-barrier-0001.xml + engine: CPU + label: to/be/set/xxx.labels + batch: 1 + outputs: [RosTopic] + connects: + - left: Image + right: [ObjectDetection] + - left: ObjectDetection + right: [{VehicleAttribsDetection: label == vehicle && confidence >= 0.8}, {LicensePlateDetection: label == license && confidence >= 0.8}] + - left: ObjectDetection + right: [RosTopic] + - left: VehicleAttribsDetection + right: [RosTopic] + - left: LicensePlateDetection + right: [RosTopic] + +OpenvinoCommon: