Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6403 Discussions

How to use OpenVINO on tensorflow's object_detection model?

liu__shuai
Beginner
798 Views

Hi,everyone,I just try to use OpenVINO generate IR file for tensorflow object_detection model,but I can't know how to use it.can anyone help me?

My conputer:

i7-6820HK

GTX 980m

Ubuntu16.0.4 `Linux lAlienware-17-R3 4.15.0-43-generic #46~16.04.1-Ubuntu SMP Fri Dec 7 13:31:08 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux`

I don't know OpenVINO's Version ,but the software show 'Model Optimizer version:     1.4.292.6ef7232d'

I had installed OpenVINO and run bin/setupvars.sh and download ssdv1model from ssd_mobilenet_v1_coco_2018_01_28.tar.gz

sudo tar ssd_mobilenet_v1_coco_2018_01_28.tar.gz -C  /opt/intel/computer_vision_sdk/deployment_tools/model_optimizer

bash install_prerequisites_tf.sh

output like this:

获取:1 file:/var/nccl-repo-2.1.15-ga-cuda9.0 InRelease 忽略:1 file:/var/nccl-repo-2.1.15-ga-cuda9.0 InRelease 获取:2 file:/var/nccl-repo-2.1.15-ga-cuda9.1 InRelease 忽略:2 file:/var/nccl-repo-2.1.15-ga-cuda9.1 InRelease 获取:3 file:/var/nv-tensorrt-repo-cuda10.0-trt5.0.0.10-rc-20180906 InRelease 忽略:3 file:/var/nv-tensorrt-repo-cuda10.0-trt5.0.0.10-rc-20180906 InRelease 获取:4 file:/var/nv-tensorrt-repo-ga-cuda9.0-trt3.0.4-20180208 InRelease 忽略:4 file:/var/nv-tensorrt-repo-ga-cuda9.0-trt3.0.4-20180208 InRelease 获取:5 file:/var/nccl-repo-2.1.15-ga-cuda9.0 Release [574 B] 获取:6 file:/var/nccl-repo-2.1.15-ga-cuda9.1 Release [574 B] 获取:7 file:/var/nv-tensorrt-repo-cuda10.0-trt5.0.0.10-rc-20180906 Release [574 B] 获取:8 file:/var/nv-tensorrt-repo-ga-cuda9.0-trt3.0.4-20180208 Release [574 B] 获取:5 file:/var/nccl-repo-2.1.15-ga-cuda9.0 Release [574 B] 获取:6 file:/var/nccl-repo-2.1.15-ga-cuda9.1 Release [574 B] 获取:7 file:/var/nv-tensorrt-repo-cuda10.0-trt5.0.0.10-rc-20180906 Release [574 B] 获取:8 file:/var/nv-tensorrt-repo-ga-cuda9.0-trt3.0.4-20180208 Release [574 B] 命中:13 https://packages.microsoft.com/repos/vscode stable InRelease 忽略:14 http://dl.google.com/linux/chrome/deb stable InRelease 命中:15 http://ppa.launchpad.net/alexlarsson/flatpak/ubuntu xenial InRelease 命中:16 http://dl.google.com/linux/chrome/deb stable Release 命中:18 http://ppa.launchpad.net/caffeine-developers/ppa/ubuntu xenial InRelease 命中:19 http://ppa.launchpad.net/christian-boxdoerfer/fsearch-daily/ubuntu xenial InRelease 命中:20 http://linux.teamviewer.com/deb stable InRelease 命中:21 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease 获取:22 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease [109 kB] 获取:23 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease [107 kB] 忽略:24 http://linux.dropbox.com/ubuntu xenial InRelease 命中:25 http://ppa.launchpad.net/hzwhuang/ss-qt5/ubuntu xenial InRelease 获取:26 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease [107 kB] 命中:27 http://storage.googleapis.com/bazel-apt stable InRelease 命中:28 http://linux.dropbox.com/ubuntu xenial Release 命中:30 http://ppa.launchpad.net/lyx-devel/release/ubuntu xenial InRelease 忽略:31 http://ppa.launchpad.net/mc3man/trusty-media/ubuntu xenial InRelease 命中:32 http://ppa.launchpad.net/me-davidsansome/clementine/ubuntu xenial InRelease 命中:33 http://ppa.launchpad.net/noobslab/icons/ubuntu xenial InRelease 获取:34 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB] 命中:35 http://cn.archive.ubuntu.com/ubuntu xenial InRelease 命中:36 http://ppa.launchpad.net/noobslab/themes/ubuntu xenial InRelease 命中:37 https://packagecloud.io/AtomEditor/atom/any any InRelease 获取:38 http://cn.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB] 命中:39 http://ppa.launchpad.net/numix/ppa/ubuntu xenial InRelease 获取:40 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [67.7 kB] 命中:41 http://ppa.launchpad.net/ojo/daily/ubuntu xenial InRelease 获取:42 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [68.0 kB] 命中:43 http://ppa.launchpad.net/snwh/pulp/ubuntu xenial InRelease 获取:44 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [109 kB] 获取:45 http://cn.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB] 命中:46 http://ppa.launchpad.net/team-xbmc/ppa/ubuntu xenial InRelease 获取:47 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [158 kB] 错误:48 http://ppa.launchpad.net/mc3man/trusty-media/ubuntu xenial Release 404 Not Found 获取:49 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [320 kB] 获取:50 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [232 kB] 获取:51 http://cn.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [249 kB] 获取:52 http://cn.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [348 kB] 获取:53 http://cn.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [5,964 B] 获取:54 http://cn.archive.ubuntu.com/ubuntu xenial-updates/multiverse DEP-11 64x64 Icons [14.3 kB] 获取:55 http://cn.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata [3,328 B] 获取:56 http://cn.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 DEP-11 Metadata [5,100 B] 正在读取软件包列表... 完成 E: 仓库 “http://ppa.launchpad.net/mc3man/trusty-media/ubuntu xenial Release” 没有 Release 文件。 N: 无法安全地用该源进行更新,所以默认禁用该源。 N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。 Error on or near line 72; exiting with status 1

 

transform command like this:

SSD's command come from opencv/sample/dnn,

Model                                      ScaleSize               WxH                        Mean subtraction                           Channels  order

SSDs from TensorFlow           0.00784 (2/255)       300x300                         127.5 127.5 127.5                      RGB

python mo_tf.py --input_model frozen_inference_graph.pb --input_shape [1,300,300,3] --input image_tensor --output detection_boxes,detection_scores,detection_classes,num_detections

output like this:

[ ERROR ] Cannot infer shapes or values for node "Preprocessor/map/TensorArrayStack_1/TensorArrayGatherV3". [ ERROR ] [ ERROR ] [ ERROR ] It can happen due to bug in custom shape infer function <function TensorArrayGather.array_infer at 0x7fcce8fcdbf8>. [ ERROR ] Or because the node inputs have incorrect values/shapes. [ ERROR ] Or because input shapes are incorrect (embedded to the model or passed via --input_shape). [ ERROR ] Run Model Optimizer with --log_level=DEBUG for more information. [ ERROR ] Stopped shape/value propagation at "Preprocessor/map/TensorArrayStack_1/TensorArrayGatherV3" node. For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #38.

 

I have try(I don't know this scale,i had used 127.5(2/255=1/127.5)):

python3 mo_tf.py --input_model frozen_inference_graph.pb --reverse_input_channels --input_shape [1,300,300,3] --mean_values [127.5,127.5,127.5] --data_type FP16 python3 mo_tf.py --input_model frozen_inference_graph.pb --reverse_input_channels --input_shape [1,300,300,3] --mean_values [127.5,127.5,127.5] --data_type FP16 python3 mo_tf.py --input_model frozen_inference_graph.pb --reverse_input_channels --input_shape [-1,300,300,3] --mean_values [127.5,127.5,127.5] --data_type FP16

 

output like this:

ERROR ] Shape [ -1 300 300 3] is not fully defined for output 0 of "image_tensor". Use --input_shape with positive integers to override model input shapes. [ ERROR ] Cannot infer shapes or values for node "image_tensor". [ ERROR ] Not all output shapes were inferred or fully defined for node "image_tensor". For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #40. [ ERROR ] [ ERROR ] It can happen due to bug in custom shape infer function <function tf_placeholder_ext.<locals>.<lambda> at 0x7f3704d6eea0>. [ ERROR ] Or because the node inputs have incorrect values/shapes. [ ERROR ] Or because input shapes are incorrect (embedded to the model or passed via --input_shape). [ ERROR ] Run Model Optimizer with --log_level=DEBUG for more information. [ ERROR ] Stopped shape/value propagation at "image_tensor" node. For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #38.

I guess error had happend in input_shape,Could someone tell my how to use it.thanks very much,You can get  some infomation from attatch,if any onther file you need,please replay me,thanks again

0 Kudos
1 Reply
Apl__Kevin
Beginner
798 Views

Same problem here. Have you figured out a solution? Thanks

0 Kudos
Reply