手动把ssd模型转为openvino格式的模型

手动把用object detection api 自训练的ssd_mobilenet_v2 模型转成openvino环境下的模型
前提:
ubuntu 18.04
安装好openvino,tensorflow1.14.0
假设前奏都已经完成,直接到模型转换情景。
进入官方提供的模型转换脚本目录

cd /opt/intel/openvino/deployment_tools/model_optimizer

在参考了众多前人的博客后,最初的转换命令为:

python3 mo_tf.py --input_model /path/to/model/frozen_inference_graph.pb --output=detection_boxes,detection_scores,num_detections -o /path/to/output/ --tensorflow_use_custom_operations_config /opt/intel/openvino/deployment_tools/model_optimizer/extensions/front/tf/ssd_support_api_v1.14.json --tensorflow_object_detection_api_pipeline_config /path/to/model_config/pipeline.config

但是报错:

Exception occurred during running replacer “REPLACEMENT_ID” ():
Stopped shape/value propagation at “Postprocessor/Cast_1” node. For
more information please refer to Model Optimizer FAQ

google到了解决方法

翻了n多人的建议(经验)帖之后,终于找到一个靠谱的命令,再试一下(dbq原作者,我忘记了从哪里看的了,所以没法放链接。)

python3 mo_tf.py --input_model /path/to/model/frozen_inference_graph.pb --output=detection_boxes,detection_scores,num_detections -o /path/to/output/ --tensorflow_use_custom_operations_config /opt/intel/openvino/deployment_tools/model_optimizer/extensions/front/tf/ssd_support_api_v1.14.json --tensorflow_object_detection_api_pipeline_config /path/to/model_config/pipeline.config -b 1 --data_type FP16 --reverse_input_channels

但是仍然报错

想了一下,由于模型是几个月前训练好的,训练时候的pipeline.config已经找不到。拿的官方pipeline.config模板,但是识别类别很不一样,所以改回我训练的类别数就,欧克啦。nice。

上述都成功了之后,准备测试生成的模型文件,但是python一直报错。

ModuleNotFoundError: No module named ‘openvino’

是因为没有运行setupvars.sh,把它加到.bashrc里自启动就行了。

报错记录:
[ ERROR ] Exception occurred during running replacer “REPLACEMENT_ID” (<class ‘extensions.middle.PartialInfer.PartialInfer’>): Stopped sha/value propagation at “Postprocessor/ToFloat” node.

the proposed fix ( “Postprocessor/ToFloat” replacing with
“Postprocessor/Cast”)

ssd的json文件选错了,应该用ssd_v2*.json.
成功的运行命令如下:

python mo_tf.py --input_model /path/to/pb/frozen_inference_graph.pb \
--output detection_boxes,detection_scores,num_detections -o /path/to/output/ \
--tensorflow_use_custom_operations_config extensions/front/tf/ssd_v2_support.json \
--tensorflow_object_detection_api_pipeline_config /path/to/ssd_mobilenet_v2_coco.config -b 1 \
--data_type FP32 --reverse_input_channels
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值