diff --git a/data/model_list/convert_model.lst b/data/model_list/convert_model.lst new file mode 100644 index 00000000..0cfc7f5b --- /dev/null +++ b/data/model_list/convert_model.lst @@ -0,0 +1,5 @@ +# This file can be used with the --list option of the model converter. +mobilenet-ssd +deeplabv3 +mask_rcnn_inception_resnet_v2_atrous_coco + diff --git a/data/model_list/download_model.lst b/data/model_list/download_model.lst new file mode 100644 index 00000000..965a7a66 --- /dev/null +++ b/data/model_list/download_model.lst @@ -0,0 +1,17 @@ +# This file can be used with the --list option of the model downloader. +face-detection-adas-0001 +age-gender-recognition-retail-0013 +emotions-recognition-retail-0003 +landmarks-regression-retail-0009 +license-plate-recognition-barrier-0001 +person-detection-retail-0013 +person-attributes-recognition-crossroad-0230 +person-reidentification-retail-0277 +vehicle-attributes-recognition-barrier-0039 +vehicle-license-plate-detection-barrier-0106 +head-pose-estimation-adas-0001 +human-pose-estimation-0001 +semantic-segmentation-adas-0001 +mobilenet-ssd +deeplabv3 + diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..6f04c23d --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,70 @@ +# ros2 openvino toolkit env master f1b1ca4d914186a1881b87f103be9c6e910c9d80 + +ARG ROS_VERSION +FROM osrf/ros:${ROS_VERSION} +ARG VERSION + +# setting proxy env --option +# If needed, enable the below ENV setting by correct proxies. +# ENV HTTP_PROXY="your_proxy" +# ENV HTTPS_PROXY="your_proxy" +# ENV FTP_PROXY="your_proxy" + +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.1 +# https://docs.openvino.ai/2022.1/openvino_docs_install_guides_installing_openvino_apt.html +RUN apt update && apt install --assume-yes curl gnupg2 lsb-release +RUN curl -s https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB |apt-key add - +RUN echo "deb https://apt.repos.intel.com/openvino/2022 $(lsb_release -cs) main" |tee /etc/apt/sources.list.d/intel-openvino-2022.list +RUN apt update && apt-cache search openvino-2022.1.0 +RUN apt install --assume-yes openvino-2022.1.0 +RUN ls -lh /opt/intel/openvino_2022 +RUN source /opt/intel/openvino_2022/setupvars.sh + +# 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-options http-proxy=your_proxy --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || apt-key adv --keyserver-options http-proxy=your_proxy --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 + +# 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 +RUN git clone -b ros2 https://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 +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/docker/docker_instructions_ov2.0.md b/docker/docker_instructions_ov2.0.md new file mode 100644 index 00000000..0fa45a92 --- /dev/null +++ b/docker/docker_instructions_ov2.0.md @@ -0,0 +1,133 @@ +# Run Docker Images For ROS2_OpenVINO_Toolkit + +**NOTE:** +Below steps have been tested on **Ubuntu 20.04**. +Supported ROS2 versions include foxy and galactic. + +## 1. Environment Setup +* Install docker ([guide](https://docs.docker.com/engine/install/ubuntu/)) + +## 2. Build docker image by dockerfile +``` +cd ~/ros2_openvino_toolkit/docker/Dockerfile +vi ~/ros2_openvino_toolkit/docker/Dockerfile +docker build --build-arg ROS_VERSION= --build-arg VERSION= --build-arg "HTTP_PROXY=set_your_proxy" -t ros2_openvino_202201 . +``` +For example: +* Build image for ros_galactic +``` +cd ~/ros2_openvino_toolkit/docker/Dockerfile +vi ~/ros2_openvino_toolkit/docker/Dockerfile +docker build --build-arg ROS_VERSION=galactic-desktop --build-arg VERSION=galactic --build-arg "HTTP_PROXY=set_your_proxy" -t ros2_galactic_openvino_202201 . +``` +* Build image for ros_foxy +``` +cd ~/ros2_openvino_toolkit/docker/Dockerfile +vi ~/ros2_openvino_toolkit/docker/Dockerfile +docker build --build-arg ROS_VERSION=foxy-desktop --build-arg VERSION=foxy --build-arg "HTTP_PROXY=set_your_proxy" -t ros2_foxy_openvino_202201 . +``` + +## 3. Download and load docker image +* Download docker image +``` + # ros2_openvino_202201 for demo + cd ~/Downloads/ + wget +``` +* Load docker image +``` +cd ~/Downloads/ +docker load -i +docker images +// (show in the list) +``` + +## 4. Running the Demos +* Install dependency +``` + sudo apt install x11-xserver-utils + xhost + +``` +* Run docker image +``` + docker images + docker run -itd  -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev:/dev  --privileged=true --name +``` +* In Docker Container + +* Preparation +``` +source /opt/intel/openvino_2022/setupvars.sh +source /opt/ros//setup.bash +cd ~/catkin_ws +source ./install/local_setup.bash +``` + +* See all available models +OMZ tools are provided for downloading and converting OMZ models in ov2022.([guide](https://pypi.org/project/openvino-dev/)) + +``` +omz_downloader --print_all +``` + +* Download the optimized Intermediate Representation (IR) of model (execute once), for example: +``` +cd ~/catkin_ws/src/ros2_openvino_toolkit/data/model_list +omz_downloader --list download_model.lst -o /opt/openvino_toolkit/models/ +``` + +* If the model (tensorflow, caffe, MXNet, ONNX, Kaldi) need to be converted to intermediate representation (such as the model for object detection): +``` +cd ~/catkin_ws/src/ros2_openvino_toolkit/data/model_list +omz_converter --list convert_model.lst -o /opt/openvino_toolkit/models/convert +``` +* Copy label files (execute once) +**Note**:Need to make label_dirs if skip steps for set output_dirs above. +``` +sudo 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/ +sudo 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/ +sudo 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/ +sudo 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/ +sudo 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/ +sudo 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 +``` + +* Before launch, check the parameter configuration in ros2_openvino_toolkit/sample/param/xxxx.yaml, make sure the paramter like model path, label path, inputs are right. + * 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 RealSenseCameraTopic. + ``` + 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 + ``` + +# More Information +* ROS2 OpenVINO discription writen in Chinese: https://mp.weixin.qq.com/s/BgG3RGauv5pmHzV_hkVAdw + +###### *Any security issue should be reported using process at https://01.org/security* +