====== Pose Estimation avec Intel NCS2 et OpenVINO ======
{{ ::media_15:realsense_ncs2.jpg?400 |}}
**{{tagpage>skeleton camera3D|Les pages sur les caméras 3D et la détection de squelette}}** **[[http://translate.google.com/translate?hl=&sl=auto&tl=en&u=https%3A%2F%2Fressources.labomedia.org%2Fpose_estimation_avec_intel_ncs2_et_openvino|English Version]]**
**Le Intel Neural Compute Stick 2, NCS2 fonctionne ave OpenVINO, un fork de OpenCV adapté à ce stick.**
{{ :media_15:img_0005.jpg?600 |}}
=====OpenVINO=====
**Intel Neural Compute Stick 2** est un calculateur, adapté aux produits Intel, dixit Intel.\\
Il a été concu pour être un calculateur sur un PC sans GPU, genre Raspberry Pi.
**OpenVINO** est un **fork de OpenCV**, optmisé pour les produits Intel:
* Intel Neural Compute Stick 2
* Le GPU intégré aux CPU Intel: genre HD 530
* **[[https://en.wikipedia.org/wiki/OpenVINO|OpenVINO sur en.wikipedia.org]]**
=====Installation de OpenVINO=====
====Operating Systems====
* Ubuntu 18.04.x long-term support (LTS), 64-bit
* Ubuntu 20.04.0 long-term support (LTS), 64-bit
* CentOS 7.6, 64-bit (for target only)
* Yocto Project v3.0, 64-bit (for target only and requires modifications)
Le tuto a été réalisé sur Xubuntu 18.04
====Installation====
Suivre à la lettre ce tuto Intel:
* **[[https://docs.openvinotoolkit.org/2021.3/openvino_docs_install_guides_installing_openvino_linux.html|Install Intel® Distribution of OpenVINO™ toolkit for Linux*]]**
Faire l'installation avec:
sudo ./install_GUI.sh
et installer tout.
===Extrait du bash_history===
cd /media/data/exclude/l_openvino_toolkit_p_2021.3.394/
sudo ./install_GUI.sh
cd /opt/intel/openvino_2021/install_dependencies
sudo -E ./install_openvino_dependencies.sh
source /opt/intel/openvino_2021/bin/setupvars.sh
nano .bashrc
cd /opt/intel/openvino_2021/deployment_tools/model_optimizer/install_prerequisites
sudo ./install_prerequisites.sh
sudo ./install_prerequisites_caffe.sh
cd /opt/intel/openvino_2021/install_dependencies/
===Steps for Intel® Processor Graphics (GPU)===
cd /opt/intel/openvino_2021/install_dependencies/
sudo -E ./install_NEO_OCL_driver.sh
===Steps for Intel® Neural Compute Stick 2===
sudo usermod -a -G users "$(whoami)"
sudo cp /opt/intel/openvino_2021/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo ldconfig
=== Vérification de l'export du .bashrc ===
python3
>>> import cv2
>>> print(cv2.__version__)
4.5.2-openvino
Les scripts python doivent être lancés depuis un terminal, pas depuis le Run D'un EDI.\\
A l'ouverture d'un terminal, vous devez avoir:
[setupvars.sh] OpenVINO environment initialized
=====Création des fichiers bin et xml à partir du caffemodel=====
Convert a Caffe* Model to produce an optimized Intermediate Representation (IR) of the model based on the trained network topology, weights, and biases values [[https://docs.openvinotoolkit.org/latest/openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_Caffe.html|Convert Model From Caffe]].
Dans le dossier du caffemodel:
python3 /opt/intel/openvino_2021/deployment_tools/model_optimizer/mo.py --input_model pose.caffemodel --input_proto pose.prototxt
Les fichiers .caffemodel et .prototxt doivent avoir les mêmes noms.\\
Les Input Layers ne sont pas définis dans le .prototxt. J'ai improvisé avec [1, 3, 270, 270] !
=====Utilisation de OpenVino avec Realsense D455=====
Fichier à: **[[https://github.com/sergeLabo/skeleton-rs/tree/main/opencv_skeleton|opencv_skeleton]]** de * **[[pose_estimation_avec_opencv|Détection d'un squelette dans une image avec OpenCV]]**
CPU avec OpenCV fps = 1.1 MSI fps = 1.7
CPU avec OpenCV et model light fps = 1.4
CPU avec OpenCV et body_25 fps = 0.4
CPU avec OpenVINO fps = 1.6
CPU avec OpenVINO Light fps = 2.2
GPU GTX1060 fps = 2.5
GPU et model light GTX1060 fps = 3.7 MSI fps = 2.0
Intel NCS2 Stick Intel® Neural Compute Stick 2 (Intel® NCS2) fps = 1.6
Intel NCS2 Stick Intel® Neural Compute Stick 2 (Intel® NCS2) et model light fps = 2.0
{{tag>opencv python sb skeleton camera3D ia}}