ros2_object_analytics安装过程全记录

  • ros2_object_analytics安装过程全记录
    • 问题总结
      • (1)OpenCV3.3依赖问题
      • (2)devel版本中librealsense版本过低问题
      • (3)NCS版本不好用的问题
    • 安装过程记录
      • (1)Install ROS2 desktop packages ros-crystal-desktop
      • (2)Install ROS2 dependences
      • (3)Install librealsense SDK2
      • (4)Install NCS
      • (5)Install OpenCV3 with opencv-contrib
      • (6)Install Intel Distribution of OpenVINO toolkit
      • (7)Install OpenCL Driver for GPU
      • (8)(OpenCV)Additional steps are required on ubuntu 18.04
      • (9)(librealsense SDK2.0)Other Dependencies
      • (10)Building and Installation
      • (10)Running the Demo
      • (11)Build ros2_object_analytics
      • (12)Object Analytics with OpenVINO

ros2_object_analytics安装过程全记录

问题总结

安装ros2_object_analytics(下文简称OA)一共用了我个三个工作日时间,主要是自己对系统构架不够熟悉并且调试能力也不够,所以将自己遇到的问题和安装流程记录下来,方便后来参考,另外这些问题是我在安装时按照当前版本的readme遇到的问题,因为版本还会不不断更新,更新之后可能问题就不存在了。

(1)OpenCV3.3依赖问题

按照readme安装完OpenCV3.3编译OA的时候会遇到

/usr/bin/ld: cannot find -llz4

这应该OpenCV3.3的依赖问题,解决办法如下:

sudo apt-get install liblz4-dev

(2)devel版本中librealsense版本过低问题

devel版本中的readme安装realsense的驱动的方法是

sudo apt-get install ros-crystal-librealsense2 ros-crystal-realsense-ros2-camera

而在后面运行的OA的时候,master分支没有问题,但是devel分支的话会发现没有点云信息,后来发现ros-crystal-librealsense2中的librealsense的SDK版本没有更新是2.16.5版本的,这个版本中发布的点云节点是’/camera/depth/color/points’,而不是’/camera/aligned_depth_to_color/color/points’,而OA中master版本订阅(映射)的点云节点是’/camera/depth/color/points’,devel中变成了’/camera/aligned_depth_to_color/color/points’,因此按照上述命令安装realsense驱动的话只有master版本是好用的,而devel版本就没法用了。

我的解决办法是,先卸载上面的两个包

sudo apt-get remove ros-crystal-librealsense2 ros-crystal-realsense-ros2-camera

按照Linux Distribution中安装distribution版本的librealsense SDK2.0,安装2.17.1的或者最新的都可以,然后将ros-crystal-realsense-ros2-camera放到工作空间中和OA一起编译,之后就能解决上述没有点云的问题

(3)NCS版本不好用的问题

目前maste版本的OA通过NCS是可以成功运行的,但是devel版本,如果按照readme的方式一步一步安装的话,插入的硬件是NCS2的话会报错

[ERROR] [movidius_ncs_stream]: Error: there is no device at the given index or name

如果插入硬件NCS1的话会报错

[ERROR] [movidius_ncs_stream]: Error: an unexpected error was encontered during the function call

后来了解到OA之后可能不再支持NCS版本,因此我就没再话时间在调试NCS的问题上,转战OpenVINO.

安装过程记录

下面我记录一的是一台新电脑的OA从无到有的一个可行的安装步骤,主要是参照ros2_object_analytics
和ros2_openvino_toolkit的readme,中间会指出一些容易出问题的地方

(1)Install ROS2 desktop packages ros-crystal-desktop

参看ros-crystal-desktop,应该不会有什么问题

(2)Install ROS2 dependences

sudo apt-get install ros-crystal-cv-bridge ros-crystal-object-msgs ros-crystal-image-transport ros-crystal-realsense-camera-msgs

(3)Install librealsense SDK2

参考Linux Distribution,应该没什么问题

(4)Install NCS

因为我没有试没有不安转NCS会怎样,因此我还是按照我原来的步骤安装

# build ncsdk
mkdir ~/code
cd ~/code
git clone https://github.com/movidius/ncsdk
git clone https://github.com/movidius/ncappzoo
cd ~/code/ncsdk
make install
ln -sf ~/code/ncappzoo /opt/movidius/ncappzoo# build ros2_intel_movidius_ncs
mkdir ~/ros2_ws/src -p
cd ~/ros2_ws/src
git clone https://github.com/intel/ros2_intel_movidius_ncs.git
cd ~/ros2_ws
source /opt/ros/crystal/setup.bash
colcon build --symlink-install (Install python3-colcon-common-extensions by apt-get if colcon command not exist)# build CNN model (Please plugin NCS device on the host while compiling)
cd /opt/movidius/ncappzoo/caffe/SSD_MobileNet
make# Copy object label file to NCSDK installation location.
cp ~/ros2_ws/src/ros2_intel_movidius_ncs/data/labels/* /opt/movidius/ncappzoo/data/ilsvrc12/

(5)Install OpenCV3 with opencv-contrib

mkdir ${HOME}/opencv
cd ${HOME}/opencv
git clone https://github.com/opencv/opencv.git -b 3.3.0
git clone https://github.com/opencv/opencv_contrib.git -b 3.3.0
mkdir opencv/build -p
cd opencv/build
cmake -DOPENCV_EXTRA_MODULES_PATH=${HOME}/opencv/opencv_contrib/modules \ -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_opencv_cnn_3dobj=OFF ..
make -j8
sudo make install
sudo ldconfig

这里补上依赖

sudo apt-get install liblz4-dev

下面就属于安装OpenVINO的

(6)Install Intel Distribution of OpenVINO toolkit

Download OpenVINO toolkit by following the guide

cd ~/Downloads
wget -c http://registrationcenter-download.intel.com/akdlm/irc_nas/15078/l_openvino_toolkit_p_2018.5.455.tgz

Install OpenVINO toolkit by following the guide

cd ~/Downloads
tar -xvf l_openvino_toolkit_p_2018.5.455.tgz
cd l_openvino_toolkit_p_2018.5.455
# root is required instead of sudo
sudo -E ./install_cv_sdk_dependencies.sh
sudo ./install_GUI.sh
# build sample code under OpenVINO toolkit
source /opt/intel/computer_vision_sdk/bin/setupvars.sh
cd /opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/
mkdir build
cd build
cmake ..
make

Configure the Neural Compute Stick USB Driver

cd ~/Downloads
cat <<EOF > 97-usbboot.rules
SUBSYSTEM=="usb", ATTRS{idProduct}=="2150", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idProduct}=="2485", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idProduct}=="f63b", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
EOF
sudo cp 97-usbboot.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo ldconfig
rm 97-usbboot.rules

(7)Install OpenCL Driver for GPU

 cd /opt/intel/computer_vision_sdk/install_dependenciessudo ./install_NEO_OCL_driver.sh

(8)(OpenCV)Additional steps are required on ubuntu 18.04

 sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"sudo apt updatesudo apt install libjasper1 libjasper-dev

(9)(librealsense SDK2.0)Other Dependencies

 #librealsense dependencysudo apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-devsudo apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev# numpy and networkxpip3 install numpypip3 install networkx# libboostsudo apt-get install -y --no-install-recommends libboost-all-devcd /usr/lib/x86_64-linux-gnusudo ln -sf libboost_python-py35.so libboost_python3.so

(10)Building and Installation

Build sample code under openvino toolkit

 # root is required instead of sudosource /opt/intel/computer_vision_sdk/bin/setupvars.shcd /opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/mkdir buildcd buildcmake ..make

set ENV CPU_EXTENSION_LIB and GFLAGS_LIB

 export CPU_EXTENSION_LIB=/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release/lib/libcpu_extension.soexport GFLAGS_LIB=/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release/lib/libgflags_nothreads.a

Install ROS2_OpenVINO packages

 mkdir -p ~/ros2_overlay_ws/srccd ~/ros2_overlay_ws/srcgit clone https://github.com/intel/ros2_openvino_toolkitgit clone https://github.com/intel/ros2_object_msgsgit clone https://github.com/ros-perception/vision_opencv -b ros2git clone https://github.com/ros2/message_filters.gitgit clone https://github.com/ros-perception/image_common.git -b ros2git clone https://github.com/intel/ros2_intel_realsense.git

Build package

 source ~/ros2_ws/install/local_setup.bashsource /opt/intel/computer_vision_sdk/bin/setupvars.shexport OpenCV_DIR=$HOME/code/opencv/buildcd ~/ros2_overlay_wscolcon build --symlink-installsource ./install/local_setup.bashsudo mkdir -p /opt/openvino_toolkitsudo ln -sf ~/ros2_overlay_ws/src/ros2_openvino_toolkit /opt/openvino_toolkit/ros2_openvino_toolkit

(10)Running the Demo

这里虽然是Running the Demo,但是不Running一下,OA就跑不起来,原因是这里会需要下一个model,而这些model也是OA需要的
download and convert a trained model to produce an optimized Intermediate Representation (IR) of the model

#object segmentation model
cd /opt/intel/computer_vision_sdk/deployment_tools/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/intel/computer_vision_sdk/deployment_tools/model_optimizer/mo_tf.py --input_model frozen_inference_graph.pb --tensorflow_use_custom_operations_config /opt/intel/computer_vision_sdk/deployment_tools/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 -sf ~/Downloads/models/mask_rcnn_inception_v2_coco_2018_01_28 /opt/models/
#object detection model
cd /opt/intel/computer_vision_sdk/deployment_tools/model_downloader
sudo python3 ./downloader.py --name mobilenet-ssd
#FP32 precision model
sudo python3 /opt/intel/computer_vision_sdk/deployment_tools/model_optimizer/mo.py --input_model /opt/intel/computer_vision_sdk/deployment_tools/model_downloader/object_detection/common/mobilenet-ssd/caffe/mobilenet-ssd.caffemodel --output_dir /opt/intel/computer_vision_sdk/deployment_tools/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/intel/computer_vision_sdk/deployment_tools/model_optimizer/mo.py --input_model /opt/intel/computer_vision_sdk/deployment_tools/model_downloader/object_detection/common/mobilenet-ssd/caffe/mobilenet-ssd.caffemodel --output_dir /opt/intel/computer_vision_sdk/deployment_tools/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]

copy label files (excute once)

 sudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/emotions-recognition/FP32/emotions-recognition-retail-0003.labels /opt/intel/computer_vision_sdk/deployment_tools/intel_models/emotions-recognition-retail-0003/FP32sudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/intel/computer_vision_sdk/deployment_tools/intel_models/face-detection-adas-0001/FP32sudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/intel/computer_vision_sdk/deployment_tools/intel_models/face-detection-adas-0001/FP16sudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/object_segmentation/frozen_inference_graph.labels ~/Downloads/models/mask_rcnn_inception_v2_coco_2018_01_28/outputsudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/object_detection/mobilenet-ssd.labels /opt/intel/computer_vision_sdk/deployment_tools/model_downloader/object_detection/common/mobilenet-ssd/caffe/output/FP32sudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/object_detection/mobilenet-ssd.labels /opt/intel/computer_vision_sdk/deployment_tools/model_downloader/object_detection/common/mobilenet-ssd/caffe/output/FP16

set ENV LD_LIBRARY_PATH and environment

 source /opt/intel/computer_vision_sdk/bin/setupvars.shexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release/lib

(11)Build ros2_object_analytics

# get code
mkdir ~/ros2_ws/src -p
cd ~/ros2_ws/src
git clone https://github.com/intel/ros2_object_analytics.git -b devel (devel branch is the latest code with 2D tracking features, while master branch is stable for ros2 bloom release)# Build
cd ~/ros2_ws
source /opt/ros/crystal/setup.bash
colcon build --symlink-install

(12)Object Analytics with OpenVINO

# Start OA demo with OpenVINO
source /opt/ros/crystal/setup.bash
source ~/ros2_ws/install/local_setup.bash
source /opt/intel/computer_vision_sdk/bin/setupvars.sh
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release/libOption1: if ros2_openvino_toolkit built from source code
ros2 launch object_analytics_node object_analytics_with_openvino_oss.launch.pyOption2: if ros2_openvino_toolkit got from Robotics_SDK
ros2 launch object_analytics_node object_analytics_with_openvino_sdk.launch.py

注意lanch之前前面四个必不可少的source和export,后两个是和OpenVINO有关的。

然后

就成功啦!!!哈哈哈…
整个效果看上去还是非常牛逼的,到这一步算是装好了,主要还是自己太菜,接下来终于可以开心地看源码了~

ros2_object_analytics安装过程全记录相关推荐

  1. Ubuntu16.04LTS+CUDA8.0+cuDNN5.1+Anaconda3(python3.6)+tensorflow_gpu-1.2.1安装过程全记录

    Ubuntu16.04LTS+CUDA8.0+cuDNN5.1+Anaconda3(python3.6)+tensorflow_gpu-1.2.1安装过程全记录 最近搭建了一台用于深度学习的服务器,其 ...

  2. 在CentOS7上通过RPM安装实现LAMP+phpMyAdmin安装过程全记录

    在CentOS7上通过RPM安装实现LAMP+phpMyAdmin安装过程全记录 时间:2017年9月20日 一.软件环境: IP:192.168.1.71 Hostname:centos73-2.s ...

  3. SAP S4HANA1610/Fiori安装过程全记录

    经历各种坑,从硬件到文件,终于安装成功. 有需要安装或使用S4HANA(含Fiori)的同学可以参考. 安装文件分享给大家 链接:http://pan.baidu.com/s/1mi7LfIS 密码: ...

  4. Trimmomatic、bowtie2、samtools和bedtools安装过程全记录(已全部安装成功)

    目录 安装ubuntu 安装trimmomatic 安装bowtie 安装GCC 安装samtools 安装zlib2 继续安装samtools 安装liblzma-dev 继续安装samtools ...

  5. 在CentOS6上编译安装实现LAMP(php-modules)+phpMyAdmin安装过程全记录

    php与apache协作有三种模式:CGI.modules.FastCGI. 在CGI模式下,用户请求php文件时,apache会启动响应进程,调用php处理器处理请求,然后将结果返回给客户端.用户响 ...

  6. MySql安装过程全记录

    系统环境:centos 7 版本 :  mysql 5.7 参考mysql官网安装指南,使用yum存储库安装方式,步骤分为: 添加mysql yum存储库 选择安装版本 安装mysql 启动mysql ...

  7. 在CentOS7上安装配置Corosync高可用集群过程全记录

    在CentOS7上安装配置Corosync高可用集群过程全记录 一.环境.拓朴及其他准备工作: 1-1:准备网络YUM源环境: All Nodes OS CentOS 7.3 x86_64: # wg ...

  8. 64位Ubuntu 12.04下搭建嵌入式Qt(4.8.6)、QtCreator、qvfb过程全记录

    最新公司搞一个新项目,需要在Linux下进行UI界面设计.选来选去,最后选择采用Qt平台来做,于是要开始研究一下Qt. Qt作为业内最著名的UI开发工具之一,是一套完整的跨平台C++图形用户界面应用程 ...

  9. opensuse安装face_recognition全记录

    opensuse安装face_recognition全记录 vikeyfox@20210821@opensuse安装face_recognition全记录 安装所需的python-devel 首先确保 ...

最新文章

  1. 英伟达TensorRT 8-bit Inference推理
  2. 26 进程优先级队列Queue
  3. Javascript模块化编程require.js的用法
  4. 使用powermock 测试static 方法,jacoco统计覆盖率问题
  5. 2021牛客暑期多校训练营6
  6. django-redis中redis.conf配置详细说明
  7. Leetcode--329. 矩阵中的最长递增路径
  8. Win10系统如何设置开机启动密码
  9. 第四课--AMP架构双核应用程序开发和软中断处理(二)
  10. angularjs自动加载和手动加载
  11. SAP UI5 应用开发教程之六十一 - 在 SAP UI5 应用里绘制甘特图 Gantt Chart 试读版
  12. C#读写ISO15693协议ICODE2标签源码
  13. 用 Python 计算综合测评中的专业成绩加权平均分
  14. 帝国cms生成动态php栏目,帝国cms怎么实现页面自动生成html
  15. 新生儿小名大全:农历三月出生的女孩小名
  16. 2021年中国资产管理业务总体存量及促进资产管理行业健康发展的对策分析[图]
  17. 苹果App Store最新应用审核标准
  18. VBA-API:通过BEEP函数(扬声器)播放音乐
  19. icare3.0医用his软件部署基本流程
  20. 《可解释机器学习公开课》来了!

热门文章

  1. 怎样查看电脑系统版本_微信7.0.0自动更新后怎样去还原以前的旧版本?
  2. 为什么HTTPS是安全的
  3. 坚持,这两个字非常重要!
  4. tomcat基本使用,就是这么简单
  5. git无法pull仓库refusing to merge unrelated histories
  6. jerseycom.sun.jersey.api.client.UniformInterfaceException
  7. Andoid自定义View的OnMeasure详解和自定义属性
  8. Java设计模式——工厂模式
  9. 网络爬虫:采用“负载均衡”策略来优化网络爬虫
  10. 远程连接CentOS的MySQL报错:Can't connect to MySQL server on 'XXX' (13)