2023-05-03 00:26:26washington

網頁設計 openvino 若何run demo appli

 



參考文章
https://iam9527.pixnet.net/blog/ ... un-demo-application

 

OpenVino概念
1.png

圖改自https://www.learnopencv.com/using-openvino-with-opencv/#openvino-opencv
將已練習好的深度進修model顛末Model Optimizer優化後
(何謂優化請見下面Model Optimizer條目)
經過Inference Engine  跟 硬體(CPU/ GPU /VPU)
達到加快Inference 的目的

★ Model Optimizer
      ●摘錄自:【AI_Column】應用 Intel OpenVINO 土炮自駕車視覺系統
       協助去除已練習好的模子中的冗餘參數,並可將 32bits 浮點數的參數降階,
      以犧牲數個百分點正確率來換取推論速度提拔數十倍到百倍。

   ●把深度學習框架Train出來的model, 轉換成 Inference Engine 可以用的IR file
       今朝支援的深度學習框架有 Caffe*, TensorFlow*, MXNet*, and ONNX*.
     ●之前以為所有由Caffe*, TensorFlow*, MXNet*, and ONNX* 訓練出的model
     都可以由Model Optimizer轉換成IR file  ,但看了 的Supported Models章節
     彷佛不是這麼一回事,需找一個底下沒提到的model來嘗試看看
     有成果我再更新
      Supported Models
        For the list of supported models refer to the framework or format specific page:
•        Supported Caffe* models
•        Supported TensorFlow* models
•        Supported MXNet* models
•        Supported ONNX* models
•        Supported Kaldi* models
   ●有script可以 configure Model Optimizer  以導入
     所有OpenVino supported的深度學習框架或單一深度學習框架
       若要手動configure Model Optimizer也有文件可以參考 ->  Model Optimizer Developer Guide.

★ IR file
   包括train model的topology 跟weight,利用者只要知道如何將
   訓練好的model change to IR file,就能夠使用OpenVino加速Inference

★ Inference Engine
   用來run 最好化後的深度進修model
   C:\Program Files (x86)\Intel\openvino_2021.4.689\
   deployment_tools\inference_engine\samples底下有放一些IE的samples   
   各Samples申明  
   延伸浏覽 → 若何run Inference Engine Samples
★ VPU plugin
    這份文件彷佛在講如何的model能被vpu 支援
■OpenVino不供應Model Training
   OpenVino的model來源以我的理解就以下這幾種
   1.自己用OpenVino supported的深度進修框架去train  model
      或去Model Zoo下載所需model
1.        Caffe [ Model Zoo ]
2.        Tensorflow [ Model Zoo ]
3.        MxNet [ Model zoo ] 貫穿連接失效
4.        Open Neural Network Exchange (ONNX) [ Model zoo ]
   2.OpenVino裡面附的pre-trained model  
      不外不一定有合適你需求的
   3.OpenCV DNN sample model
■相關名詞
★ OpenVino用的是CNN( Convolutional Neural Networks )模型 ;
   還包含了Deep Learning Deployment Toolkit (Intel® DLDT).
    2.png
      Convolution:影象->filter->擷取出特徵,好比邊沿。
      此種進程叫做Convolution
★ OpenCV和OpenVX有什么联系和区别?
★ 機械進修
   機械進修理論首要是設計和分析一些讓電腦可以主動進修的演算法。
    機器進修演算法是一類從資估中主動剖析取得紀律,並利用紀律對未知資料進行猜測的演算法。
★ 深度進修
   是機械進修的分支。網頁設計 深度進修框架比力
■如何安裝OpenVino
照著 安裝步調做便可 (英文看不懂請自行降服)
-------------------------------------------------------------------------------------------------------------------------------
上述的工具都了解以後,接下來開始DEMO OpenVino附的兩個script
■Run the Image Classification Verification Script
   ★在C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\demo下
   可以找到demo_squeezenet_download_convert_run.bat。
   這個demo利用squeezenet model 判定照片中的Object屬於什麼種別
   可判定的類別有一千種,有哪一千種可以看底下這個檔案
   C:\Program Files (x86)\Intel\openvino_2021.4.689\
   deployment_tools\demo\squeezenet1.1.labels
   *路徑中的openvino_2019.1.148的2019.1.148這數字代表版本, 是以若安裝的OpenVino版本跟我分歧,那數字也會分歧
   *若安裝不只一個版本的OpenVino,分歧版本的OpenVino會有屬於本身的資料夾
   而openvino那個捷徑會指向最後安裝的阿誰版本
    3.png
★這個batch的內容以下
   Step1 :  下載SqueezeNet model (利用downloader.py)
   Step2: 用 Model Optimizer 把SqueezeNet轉成IR file。
                (利用mo.py)
   Step3: Build Inference Engine samples
                batch檔履行過程中, 會看到cmd 畫面卡在
                Build Inference Engine samples using MS Visual Studio (MSBuild.exe)一段時間
                請耐煩等候 。此步會產生 classification_sample.exe
   Step4: 把car.png & IR file看成iInference Engine的input 來闡發car.png
   ↓This is car.png
    
4.png
   ↓針對比片中的Object,分類前十名的了局依序從Prob.高到低擺列
   分類成效最高分數是sport car

   5.png
★重跑demo_squeezenet_download_convert_run.bat
   跑過一次batch以後,若再履行一次batch,
   因為某些檔案跑過一次batch以後就已存在了
   batch裡的寫法偵測到某些檔案存在以後就會疏忽掉某些Step
   若想要完全地再跑一次,需刪除以下檔案
   ●刪除model
   C:\Users\$(username)\Documents\Intel\OpenVINO\openvino_models
    \models\FP32\classification
   底下全部squeezenet 資料夾刪掉
   注意:FP32是針對CPU device的,若是VPU devide ,對應到的folder name是FP16

   ●刪除 IR       
   C:\Users\$(username)\Documents\Intel\OpenVINO\openvino_models\ir\FP32
    \classification\squeezenet\1.1\ 底下全部caffe 資料夾刪掉
   注意:FP32是針對CPU device的,若是VPU devide ,對應到的folder name是FP16
------------------------------------------------------------------------------------------------
■Run the Inference Pipeline Verification Script
★demo_security_barrier_camera.bat 這個batch的內容以下
Step1 : 下載 three pre-trained models IRs
Step2:build Security Barrier Camera Demo Inference Engine來闡明car1.bmp
Step3: 圖片裡的object會被第一個model判定成是車輛,
              這個判定了局被看成input 導入到下一個model,
              這個model可以指出車輛的一些屬性 ex:車牌
              最後 車牌被看成input導入到第三個model,這個model可以把車牌的字元辨認出
              會被稱做Pipeline 我想應該是辨認了局從第一個model傳到第三個model
             像水流在管線裡活動一樣吧...

        
★重跑全部bat
  跑過一次batch以後,有些step會被疏忽掉,因為某些檔案已存在了
  若要乾乾淨淨的再跑一次,需要刪除以下檔案
  ●刪除 IR      
  C:\Users\$(username)\Documents\Intel\OpenVINO\openvino_models\
  ir\FP32\classification\squeezenet\1.1\
  底下全部caffe 資料夾刪掉

----------------------------------------------------------------------------------------------------------
以上類型是使用openvino在 CPU
若用其他intel 硬體, 比如movidius gpu vpu  FPGA or MYRIAD
請參考安裝文件中 Optional Steps這部分
-----------------------------------------------------------------------------------------------------------
■OpenVino PreTrained Model
★OpenVINO提供好幾個pre-trained models
可以用Model Downloader 或到
https://download.01.org/opencv/2019/open_model_zoo/ 去下載
下載的model是被優化過的model,稱作IR file( xml 檔+ bin 檔)

★可在這邊 https://docs.openvinotoolkit.org/latest/_demos_README.html
Demos that Support Pre-Trained Models章節
看各個pre-trained model support哪些Device
Object Detection Models
裡面包括好幾個model可以用來偵測object
包括:人臉,人,車輛
Object Recognition Models
用來分類或特徵辨識,使用在其他detector以後。好比先做人臉偵測,再做年紀/性別辨識

Semantic Segmentation Models
原文網址:https://kknews.cc/zh-tw/tech/mgqvl9.html
語義分割(Semantic Segmentation)的方針是給定一張圖片,對於圖片中的每個像素做分類。
例如圖1(a)中給出的原始輸入圖片,語義朋分算法對圖片中的每一個像素分類,
得到如圖1(b)的後果。在圖1(b)中,不同顏色代表不同種別:
如紅色代表行人,藍色代表汽車,綠色代表樹,灰色代表建築物等。
語義朋分問題在很多運用場景中都有著十分主要的作用(例如圖片理解,主動駕駛等)

6.png

Instance Segmentation Models
INSTANCE SEGMENTATION可以知道同類object的數量(分歧色彩透露表現)
https://arxiv.org/pdf/1405.0312.pdf
網頁設計 8.png
9.png
Human Pose Estimation Models
Image Processing
提高影象品質
10.png

Text Detection
Action Recognition Models
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
■Trouble Shooting
● 安裝時碰到CMake*/ Python* version  xxx or higher is not detected.
       11.png

      ->Fixed by 安裝如提示的CMake & Python版本後
      再重安裝一次OpenVino
● 電腦已有安裝Python3.6.5了
      還是會呈現Python* version  xxx or higher is not detected.
      ->Fixed by 再安裝一次Python >選Modify  >勾選Add Python.....
      ->再安裝一次OpenVino就能夠了

      12.png

● 履行demo_squeezenet_download_convert_run.bat前
      若沒有安裝cmake 會出現以下Error
       'cmake' is not recognized as an internal or external command,
       operable program or batch file.
       ->Fixed by 安裝cmake
       請參考 Install CMake* 3.4 or higher章節
  ● 執行demo_squeezenet_download_convert_run.bat産生以下Err
      target_precision = FP32
      Python 3.6.6
      ECHO is off.
      PYTHONPATH=C:\Program Files (x86)\IntelSWTools\openvino\python\python3.6;
      [setupvars.bat] OpenVINO environment initialized
      INTEL_OPENVINO_DIR is set to C:\Program Files (x86)\IntelSWTools\openvino
      Python 3.6.6
      ECHO is off.
      Collecting pyyaml
      Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by       'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required (         Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )',))':                 /simple/pyyaml/
       ...
      Could not find a version that satisfies the requirement pyyaml (from versions: )
      No matching distribution found for pyyaml
      ->Fixed by 更改proxy設定
      憑據Cannot connect to proxy這個訊息判定應該是proxy問題
      原本我是使用公司內網run script
      後來將proxy調劑成以下設定&連手機熱點就可以履行了  
       13.png
  ● 呈現以下Error
     ###############|| Generate VS solution for Inference Engine samples using cmake ||###############

     Waiting for 2 seconds, press a key to continue ...
     Creating Visual Studio 15 2017 x64 files in      
     C:\Users\$(userName)\Documents\Intel\OpenVINO\inference_engine_samples_build...
     CMake Error at CMakeLists.txt:7 (project):
     Generator
     Visual Studio 15 2017
     could not find any instance of Visual Studio.
     -- Configuring incomplete, errors occurred!
     ->fixed by reboot
    因為在安裝openvino之前我有開visual studio installer去 modify設定
    設定完後沒有依照唆使重開機
    因此出現以上issue
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
●其它參考貫穿連接
  - OPENvINO with openCV
  - 既跨平台又開源 英特爾開啟智慧視覺立異
    跨越20個預先練習的模子,以及針對OpenCV和OpenVx的最好化電腦視覺庫。
    OpenVINO東西套件可透過CPU、GPU、FPGA、Movidius VPU(AI晶片 )等硬體進行佈置,
    加強視覺系統功能和機能
-   SqueezeNet
     SqueezeNet 是圖片分類模子,最合適參數較少及較小的模型利用,相較於現代圖片分類模子 (AlexNet),
     不會犧牲品質。
-   C:\Program Files (x86)\Intel\openvino_2021.4.689\documentation

 

網頁設計

 

網頁設計

文章出自: