--- tags: handoverOK, Movidius --- # AI_Movidius stick 1 # [Movidius神經運算棒] 認識與操作Neural Compute SDK ``` https://blog.cavedu.com/2018/07/16/%EF%BC%BB%E7%BF%BB%E8%AD%AF%EF%BC%BD%E8%AA%8D%E8%AD%98%E8%88%87%E6%93%8D%E4%BD%9Cneural-compute-sdk%EF%BC%9Amvnccheck/ ``` # Stick 1 's intel SDK and demo code ``` https://github.com/movidius/ncsdk https://github.com/movidius/ncappzoo ``` ### 5204 Enviorment > 目前相關資源都放在 5204上~這台配有1T 的資料碟與256G ssd系統碟 > 你可存取5204 ~透過ssh scp SAMBA > SAMBA 和 SSH 帳密皆為aewin/aewin ! > 目前5204 IP為 192.168.99.90 ``` ssh aewin@192.168.99.90 or scp aewin@192.168.99.90:/home/aewin/test_file ./your_pc ``` # Cyril 's Movidius Code and Bin file ``` aewin@192.168.99.90:/home/aewin/work/work/work/Movidius code : Movidius-OK.ipynb bin : graph ``` # Install Movidius SDK and Compile NN to Movidius model to do AI inference ``` https://github.com/movidius/ncsdk why don't use docker?? using Docker comes with a lot of problem.!!! ``` ### how to check graph is compatable and it's preformace ``` mvNCProfile ./frozen_model_inception_resnet_v2.pb -in=Placeholder_only -on=InceptionResnetV2/Logits/Predictions mvNCCheck ./frozen_model_inception_resnet_v2.pb -i ./stest299.jpg -in=Placeholder_only -on=InceptionResnetV2/Logits/Predictions ``` ### how to compile graph? ``` mvNCCompile -s 12 ./imagenet_resnet_v2_152_cyril_frzen.pb -in=input -on=InceptionResnetV2/AuxLogits/Logits/BiasAdd > debug history https://github.com/hsiaojung/tflearn_smo/blob/master/hhh ``` ### How to dump input and output mode name https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/graph_transforms ``` @@@location /home/cyril/work/work/AI/tensorflow 0 export PATH="$HOME/bin:$PATH" 1. bazel-bin/tensorflow/python/tools/freeze_graph 2. bazel build tensorflow/tools/graph_transforms:summarize_graph 3. bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=tensorflow_inception_graph.pb 4. bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=../keras_to_tensorflow/vgg16_94834.pb 5. bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=../keras_to_tensorflow/cyril/saved_model.pb 6. bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=/home/cyril/work/work/AI/ncappzoo/tensorflow/inception_resnet_v2/inception_resnet_v2.pb ``` ### How to freeze graph ``` python3 ../../../tensorflow/tensorflow/python/tools/freeze_graph.py --input_graph=inception_v3.pb --input_binary=true --input_checkpoint=inception_v3.ckpt --output_graph=inception_v3_frozen.pb --output_node_name=softmax 2278 python3 ../../../tensorflow/tensorflow/python/tools/freeze_graph.py --input_graph=inception_v3.pb --input_binary=true --input_checkpoint=inception_v3.ckpt --output_graph=inception_v3_frozen.pb --output_node_name=InceptionV3/Predictions/Reshape_1 2283 python3 ../../../tensorflow/tensorflow/python/tools/freeze_graph.py --input_graph=inception_v3.pb --input_binary=true --input_checkpoint=inception_v3.ckpt --output_graph=inception_v3_frozen.pb --output_node_name=InceptionV3/Predictions/cyril 2284 vim ../../../tensorflow/tensorflow/python/tools/freeze_graph.py 2285 python3 ../../../tensorflow/tensorflow/python/tools/freeze_graph.py --input_graph=inception_v3.pb --input_binary=true --input_checkpoint=inception_v3.ckpt --output_graph=inception_v3_frozen.pb --output_node_name=softmax 2286 vim ../../../tensorflow/tensorflow/python/tools/freeze_graph.py 2287 python3 ../../../tensorflow/tensorflow/python/tools/freeze_graph.py --input_graph=inception_v3.pb --input_binary=true --input_checkpoint=inception_v3.ckpt --output_graph=inception_v3_frozen.pb --output_node_name=softmax ### How to output graph(pb) sudo python3 ../tensorflow/tensorflow/python/tools/freeze_graph.py --input_graph=inception_v3.pb --input_binary=true --input_checkpoint=inception_v3.ckpt --output_graph=inception_v3_frozen.pb --output_node_name=InceptionV3/Predictions/Reshape_1 sudo python3 ../models/research/slim/export_inference_graph.py --alsologtostderr --model_name=inception_resnet_v2 --batch_size=1 --dataset_name=imagenet --image_size=299 --output_file=./imagenet_resnet_v2_152_cyril.pb ``` ### Run Demo Code to do AI ``` https://github.com/hsiaojung/tflearn_smo/blob/master/Movidius.ipynb ```