< >
Home » ROS2与深度学习教程 » ros2与深度学习教程-整合ros2_openvino_toolkit

ros2与深度学习教程-整合ros2_openvino_toolkit

ros2与深度学习教程-整合ros2_openvino_toolkit

说明:

步骤:

  • 安装依赖
sudo apt-get install ros-galactic-diagnostic-updater
  • 编译ros2_openvino_toolkit
mkdir -p ~/openvino2_ws/src
cd ~/openvino2_ws/src
git clone https://github.com/intel/ros2_openvino_toolkit -b galactic
git clone https://github.com/intel/ros2_object_msgs
git clone https://github.com/IntelRealSense/realsense-ros.git -b ros2
git clone https://github.com/ros-perception/vision_opencv.git -b ros2
cd ~/openvino2_ws
source /opt/intel/openvino_2021/bin/setupvars.sh
colcon build --symlink-install
source ./install/local_setup.bash

 - 新建模型目录

sudo mkdir -p /opt/openvino_toolkit
sudo ln -s /opt/intel/openvino_2021/deployment_tools/open_model_zoo/tools/downloader /opt/openvino_toolkit/models
sudo chmod 777 -R /opt/openvino_toolkit/models

 - 下载模型文件, 并指定目录

cd /opt/intel/openvino_2021/deployment_tools/open_model_zoo/tools/downloader
sudo python3 downloader.py --name face-detection-adas-0001 --output_dir /opt/openvino_toolkit/models/face_detection/output
sudo python3 downloader.py --name age-gender-recognition-retail-0013 --output_dir /opt/openvino_toolkit/models/age-gender-recognition/output
sudo python3 downloader.py --name emotions-recognition-retail-0003 --output_dir /opt/openvino_toolkit/models/emotions-recognition/output
sudo python3 downloader.py --name head-pose-estimation-adas-0001 --output_dir /opt/openvino_toolkit/models/head-pose-estimation/output
sudo python3 downloader.py --name person-detection-retail-0013 --output_dir /opt/openvino_toolkit/models/person-detection/output
sudo python3 downloader.py --name person-reidentification-retail-0277 --output_dir /opt/openvino_toolkit/models/person-reidentification/output
sudo python3 downloader.py --name landmarks-regression-retail-0009 --output_dir /opt/openvino_toolkit/models/landmarks-regression/output
sudo python3 downloader.py --name semantic-segmentation-adas-0001 --output_dir /opt/openvino_toolkit/models/semantic-segmentation/output
sudo python3 downloader.py --name vehicle-license-plate-detection-barrier-0106 --output_dir /opt/openvino_toolkit/models/vehicle-license-plate-detection/output
sudo python3 downloader.py --name vehicle-attributes-recognition-barrier-0039 --output_dir /opt/openvino_toolkit/models/vehicle-attributes-recognition/output
sudo python3 downloader.py --name license-plate-recognition-barrier-0001 --output_dir /opt/openvino_toolkit/models/license-plate-recognition/output
sudo python3 downloader.py --name person-attributes-recognition-crossroad-0230 --output_dir /opt/openvino_toolkit/models/person-attributes/output

 - 从ros2_openvino_toolkit包复制label文件

 sudo cp ~/openvino2_ws/src/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/openvino_toolkit/models/face_detection/output/intel/face-detection-adas-0001/FP32/
 sudo cp ~/openvino2_ws/src/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/openvino_toolkit/models/face_detection/output/intel/face-detection-adas-0001/FP16/
 sudo cp ~/openvino2_ws/src/ros2_openvino_toolkit/data/labels/emotions-recognition/FP32/emotions-recognition-retail-0003.labels /opt/openvino_toolkit/models/emotions-recognition/output/intel/emotions-recognition-retail-0003/FP32/
 sudo cp ~/openvino2_ws/src/ros2_openvino_toolkit/data/labels/object_segmentation/frozen_inference_graph.labels /opt/openvino_toolkit/models/semantic-segmentation/output/intel/semantic-segmentation-adas-0001/FP32/
 sudo cp ~/openvino2_ws/src/ros2_openvino_toolkit/data/labels/object_segmentation/frozen_inference_graph.labels /opt/openvino_toolkit/models/semantic-segmentation/output/intel/semantic-segmentation-adas-0001/FP16/
 sudo cp ~/openvino2_ws/src/ros2_openvino_toolkit/data/labels/object_detection/vehicle-license-plate-detection-barrier-0106.labels /opt/openvino_toolkit/models/vehicle-license-plate-detection/output/intel/vehicle-license-plate-detection-barrier-0106/FP32

可以运行的例子:

#run face detection sample code input from StandardCamera.
ros2 launch dynamic_vino_sample pipeline_people.launch.py
#run person reidentification sample code input from StandardCamera.
ros2 launch dynamic_vino_sample pipeline_reidentification.launch.py
#run person face reidentification sample code input from RealSenseCamera.
ros2 launch dynamic_vino_sample pipeline_face_reidentification.launch.py
#run face detection sample code input from Image.
ros2 launch dynamic_vino_sample pipeline_image.launch.py
#run object segmentation sample code input from RealSenseCamera.
ros2 launch dynamic_vino_sample pipeline_segmentation.launch.py
#run object segmentation sample code input from Image.
ros2 launch dynamic_vino_sample pipeline_segmentation_image.launch.py
#run vehicle detection sample code input from StandardCamera.
ros2 launch dynamic_vino_sample pipeline_vehicle_detection.launch.py
#run person attributes sample code input from StandardCamera.
ros2 launch dynamic_vino_sample pipeline_person_attributes.launch.py

参考:

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros2与深度学习教程