ROS yolo加速 ros_openvino_toolkit安装教程
下载地址:https://github.com/intel/ros_openvino_toolkit
平台:intel ncs 2
系统:ubuntu 16.04
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
cd ~/code
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git
cd opencv && git checkout 3.4.2 && cd ..
cd opencv_contrib && git checkout 3.4.2 && cd ..
cd opencv
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=$HOME/code/opencv_contrib/modules/ ..
make -j8
sudo make install
cd ~/Downloads
wget http://registrationcenter-
download.intel.com/akdlm/irc_nas/11396/SRB5.0_linux64.zip
unzip SRB5.0_linux64.zip -d SRB5.0_linux64
cd SRB5.0_linux64
sudo apt-get install xz-utils
mkdir intel-opencl
tar -C intel-opencl -Jxf intel-opencl-r5.0-63503.x86_64.tar.xz
tar -C intel-opencl -Jxf intel-opencl-devel-r5.0-63503.x86_64.tar.xz
tar -C intel-opencl -Jxf intel-opencl-cpu-r5.0-63503.x86_64.tar.xz
sudo cp -R intel-opencl/* /
sudo ldconfig
mkdir ~/code && cd ~/code
git clone https://github.com/opencv/dldt.git
cd dldt/inference-engine/
git checkout 2018_R4
./install_dependencies.sh
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j8
sudo mkdir -p /opt/openvino_toolkit
sudo ln -s ~/code/dldt /opt/openvino_toolkit/dldt
cd ~/code
git clone https://github.com/opencv/open_model_zoo.git
cd open_model_zoo/demos/
git checkout 2018_R4
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release /opt/openvino_toolkit/dldt/inference-engine
make -j8
sudo mkdir -p /opt/openvino_toolkit
sudo ln -s ~/code/open_model_zoo /opt/openvino_toolkit/open_model_zoo
注意:很可能遇到git下载不全的问题,另外CMAKE 版本需要升级到3.5以上。
参考地址:https://github.com/IntelRealSense/librealsense/blob/v2.17.1/doc/distribution_linux.md
Install from source code(Recommended)
具体步骤:
Ubuntu 16:sudo apt-get install libglfw3-dev
Ubuntu 18:sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/ sudo udevadm control --reload-rules && udevadm trigger
./scripts/patch-realsense-ubuntu-lts.sh
PS:更新内核失败时,可以参考这篇文章。https://blog.csdn.net/taiyangwangzi/article/details/89195714
echo 'hid_sensor_custom' | sudo tee -a /etc/modules
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
sudo update-alternatives --set gcc "/usr/bin/gcc-5"
mkdir build && cd build
cmake ../ -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=Release
make && sudo make install
sudo make uninstall && make clean && make && sudo make install
PS 可以制定运行内核数目:sudo make uninstall && make clean && make **-j8** && sudo make install
Remove all RealSense™ SDK-related packages with:
dpkg -l | grep "realsense" | cut -d " " -f 3 | xargs sudo dpkg --purge
# numpy and networkx
pip3 install numpy
pip3 install networkx
# libboost
sudo apt-get install -y --no-install-recommends libboost-all-dev
cd /usr/lib/x86_64-linux-gnu
sudo ln -s libboost_python-py35.so libboost_python3.so
设置ENV InferenceEngine_DIR,CPU_EXTENSION_LIB和GFLAGS_LIB
export InferenceEngine_DIR = / opt / openvino_toolkit / dldt / inference-engine / build /
export CPU_EXTENSION_LIB = / opt / openvino_toolkit / dldt / inference-engine / bin / intel64 / Release / lib / libcpu_extension.so
export GFLAGS_LIB = / opt / openvino_toolkit / dldt /inference-engine/bin/intel64/Release/lib/libgflags_nothreads.a
mkdir -p ~ / catkin_ws / src
cd ~ / catkin_ws / src
git clone https://github.com/intel/ros_openvino_toolkit
git clone https://github.com/intel/object_msgs
git clone https://github.com/ ros-perception / vision_opencv
git clone https://github.com/intel-ros/realsense cd realsense
git checkout 2.1.3
# Ubuntu 16.04
source /opt/ros/kinetic/setup.bash
# Ubuntu 18.04
source /opt/ros/melodic/setup.bash
cd ~/catkin_ws
catkin_make
source devel/setup.bash
sudo mkdir -p /opt/openvino_toolkit
sudo ln -s ~/catkin_ws/src/ros_openvino_toolkit /opt/openvino_toolkit/ros_openvino_toolkit
话题
订阅主题
发布主题
服务
RViz
具有推理结果的原始图像帧的合成主题也支持RViz显示。要在RViz工具中显示,请添加带有合成主题的图像标记:/ros_openvino_toolkit/image_rviz(sensor_msgs :: Image)
#object segmentation model
cd /opt/openvino_toolkit/dldt/model-optimizer/install_prerequisites
sudo ./install_prerequisites.sh
mkdir -p ~/Downloads/models
cd ~/Downloads/models
wget http://download.tensorflow.org/models/object_detection/mask_rcnn_inception_v2_coco_2018_01_28.tar.gz
tar -zxvf mask_rcnn_inception_v2_coco_2018_01_28.tar.gz
cd mask_rcnn_inception_v2_coco_2018_01_28
python3 /opt/openvino_toolkit/dldt/model-optimizer/mo_tf.py --input_model frozen_inference_graph.pb --tensorflow_use_custom_operations_config /opt/openvino_toolkit/dldt/model-optimizer/extensions/front/tf/mask_rcnn_support.json --tensorflow_object_detection_api_pipeline_config pipeline.config --reverse_input_channels --output_dir ./output/
sudo mkdir -p /opt/models
sudo ln -s ~/Downloads/models/mask_rcnn_inception_v2_coco_2018_01_28 /opt/models/
#object detection model
cd /opt/openvino_toolkit/open_model_zoo/model_downloader
python3 ./downloader.py --name mobilenet-ssd
#FP32 precision model
sudo python3 /opt/openvino_toolkit/dldt/model-optimizer/mo.py --input_model /opt/openvino_toolkit/open_model_zoo/model_downloader/object_detection/common/mobilenet-ssd/caffe/mobilenet-ssd.caffemodel --output_dir /opt/openvino_toolkit/open_model_zoo/model_downloader/object_detection/common/mobilenet-ssd/caffe/output/FP32 --mean_values [127.5,127.5,127.5] --scale_values [127.5]
#FP16 precision model
sudo python3 /opt/openvino_toolkit/dldt/model-optimizer/mo.py --input_model /opt/openvino_toolkit/open_model_zoo/model_downloader/object_detection/common/mobilenet-ssd/caffe/mobilenet-ssd.caffemodel --output_dir /opt/openvino_toolkit/open_model_zoo/model_downloader/object_detection/common/mobilenet-ssd/caffe/output/FP16 --data_type=FP16 --mean_values [127.5,127.5,127.5] --scale_values [127.5]
cd /opt/openvino_toolkit/open_model_zoo/model_downloader
python3 downloader.py --name face-detection-adas-0001
python3 downloader.py --name age-gender-recognition-retail-0013
python3 downloader.py --name emotions-recognition-retail-0003
python3 downloader.py --name head-pose-estimation-adas-0001
python3 downloader.py --name person-detection-retail-0013
python3 downloader.py --name person-reidentification-retail-0076
sudo cp /opt/openvino_toolkit/ros_openvino_toolkit/data/labels/emotions-recognition/FP32/emotions-recognition-retail-0003.labels /opt/openvino_toolkit/open_model_zoo/model_downloader/Retail/object_attributes/emotions_recognition/0003/dldt
sudo cp /opt/openvino_toolkit/ros_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/openvino_toolkit/open_model_zoo/model_downloader/Transportation/object_detection/face/pruned_mobilenet_reduced_ssd_shared_weights/dldt
sudo cp /opt/openvino_toolkit/ros_openvino_toolkit/data/labels/object_segmentation/frozen_inference_graph.labels /opt/models/mask_rcnn_inception_v2_coco_2018_01_28/output
sudo cp /opt/openvino_toolkit/ros_openvino_toolkit/data/labels/object_detection/mobilenet-ssd.labels /opt/openvino_toolkit/open_model_zoo/model_downloader/object_detection/common/mobilenet-ssd/caffe/output/FP32
sudo cp /opt/openvino_toolkit/ros_openvino_toolkit/data/labels/object_detection/mobilenet-ssd.labels /opt/openvino_toolkit/open_model_zoo/model_downloader/object_detection/common/mobilenet-ssd/caffe/output/FP16
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/openvino_toolkit/dldt/inference-engine/bin/intel64/Release/lib
roslaunch vino_launch pipeline_people_oss.launch
roslaunch vino_launch pipeline_image_oss.launch
roslaunch vino_launch pipeline_object_oss.launch
roslaunch vino_launch pipeline_object_oss_topic.launch
roslaunch vino_launch pipeline_segmentation.launch
roslaunch vino_launch pipeline_video.launch
roslaunch vino_launch pipeline_reidentification_oss.launch
Run图像处理服务输入运行对象检测服务示例代码:
roslaunch vino_launch image_object_server_oss.launch
在另一个控制台上运行带有图像绝对路径的示例应用程序:
rosrun dynamic_vino_sample image_object_client ~ /catkin_ws/src/ros_openvino_toolkit/data/images/car.png
Run图像处理服务运行面部检测服务示例代码输入:
roslaunch vino_launch image_people_server_oss.launch
在另一个控制台上运行带有图像绝对路径的示例应用程序:
rosrun dynamic_vino_sample image_people_client ~ /catkin_ws/src/ros_openvino_toolkit/data/images/team.jpg