|--背景:html
NCS1使用的NCSDK1和NCSDK2,速度通常,沒有想象中的速度,能有TX2一半的速度吧。跟大佬又申請了個NCS2來試一試。python
環境配置到跑通本身寫的MNIST分類網絡花了2天不到吧。git
|--總結:github
Openvino和以前的NCSDK比算是有很大的進步了。文檔都比較全,可是都有文檔跟不上版本的問題。網絡
|--環境:async
|----Ubuntu16.04 + Openvino R5 2018-5ui
Openvino的安裝,按照Intel官網上一步一步走的,沒什麼大問題。google
可能安裝和跑demo的過程當中可能出現的問題:spa
一、使用腳本安裝依賴包時可能會有錯誤,把對於錯誤的行註釋,手動安裝便可code
二、對於上述問題可能緣由是源的問題,能夠嘗試更換一下源,
三、如腳本執行sudo apt -E updata 報錯,能夠在肯定系統更新到最新後將改行註釋掉,
四、安裝python-ven 錯誤,手動安裝個虛擬環境便可
五、提示xxx.so不是連接文件,從新作一下連接便可(或者在google上找這個報錯,overstack中有解決方案,沒保存,挺好找的)
|----demo& 自定義網絡的使用
一、demo按照官網的步驟便可,主要是如何使用子定義的網絡。
二、使用自定義的網絡openvino中沒有講,可是應爲硬件就是這個了,和NCSDK的要求必然相差不遠的按照NCSDK中修改網絡便可:https://movidius.github.io/ncsdk/tf_compile_guidance.html
三、修改並訓練好後,如何編譯到Openvino的格式:xml & bin :在Openvino中有講如何載入bp文件或者meta文件。可能會遇到的錯誤 如 入口節點 的未徹底定義呀什麼,解決方法加入參數: --batch 1 或者 --input_size [x,x,x,x],參考連接:https://software.intel.com/en-us/forums/computer-vision/topic/801113
四、使用網絡參考其中的不徹底代碼和 Python 接口文檔:連接 https://software.intel.com/en-us/articles/transitioning-from-intel-movidius-neural-compute-sdk-to-openvino-toolkit
python接口demo:
1 import openvino.inference_engine as ie 2 import cv2 3 import numpy 4 import time 5 def main(): 6 ####################### Device Initialization ######################## 7 # Plugin initialization for specified device and load extensions library if specified 8 plugin = ie.IEPlugin(device="MYRIAD") 9 ######################################################################### 10 11 ######################### Load Neural Network ######################### 12 # Read in Graph file (IR) 13 net = ie.IENetwork(model="mnist_inference.xml", weights="mnist_inference.bin") 14 15 input_blob = next(iter(net.inputs)) 16 out_blob = next(iter(net.outputs)) 17 # Load network to the plugin 18 exec_net = plugin.load(network=net) 19 del net 20 ######################################################################## 21 22 ######################### Obtain Input Tensor ######################## 23 # Obtain and preprocess input tensor (image) 24 # Read and pre-process input image maybe we don't need to show these details 25 image_for_inference = cv2.imread("./1.JPG") 26 27 image_for_inference = cv2.cvtColor(image_for_inference, cv2.COLOR_BGR2GRAY) 28 image_for_inference=cv2.resize(image_for_inference, (28,28)) 29 30 image_for_inference = image_for_inference.astype(numpy.float32) 31 32 image_for_inference[:] =1-((image_for_inference[:] )*(1.0/255.0)) 33 34 image_for_inference=image_for_inference.reshape(-1,1,784) 35 # ######################################################################## 36 37 # ########################## Start Inference ########################## 38 # # Start synchronous inference and get inference result 39 ct=time.time() 40 req_handle = exec_net.start_async(0,inputs={input_blob:image_for_inference}) 41 # # ######################################################################## 42 # res = exec_net.infer({input_blob:image_for_inference}) 43 # # ######################## Get Inference Result ######################### 44 status = req_handle.wait() 45 res = req_handle.outputs[out_blob] 46 47 48 # Do something with the results... (like print top 5) 49 print(time.time()-ct) 50 print(res[0]) 51 print((1-res[0]).argsort()[:1]) 52 # ############################### Clean Up ############################ 53 del exec_net 54 del plugin 55 # ######################################################################## 56 57 import sys 58 if __name__ == '__main__': 59 sys.exit(main() or 0)
github 傳送門