【问题标题】:Exporting a pretrained model using Google Cloud Machine Learning Engine使用 Google Cloud Machine Learning Engine 导出预训练模型
【发布时间】:2019-04-23 16:20:50
【问题描述】:

我找到了很多用于训练对象检测模型并使用 Google Cloud Machine Learning Engine 部署它的示例,但如果我想从 Tensorflow 检测模型动物园部署现有模型怎么办?

我下载了 ssd_mobilenet_v2_coco 并使用 saved_model_cli 检查了模型。从这个输出中我了解到这个模型只有一个允许的输入,一个 image_tensor。

ML Engine 似乎需要 3 个输入:

  • 图像张量
  • encoded_image_string_tensor
  • tf_example_string_tensor

model zoo repo 还表明冻结图是使用 TensorFlow 的 v1.12.0 发行版生成的,如果您想使用更高版本,可以重新运行导出器。因此,在部署到 ML Engine 之前,您可能希望重新导出其中一个冻结模型。

所以我的问题是,我可以使用“gcloud ml-engine jobs submit training”来执行此操作吗?如果是这样,如果我只从从动物园下载的预训练模型开始,该命令的适当参数是什么?

【问题讨论】:

    标签: google-cloud-ml


    【解决方案1】:

    好的,我认为由于我自己的无知,我问错了问题。看来我需要 1)在本地安装对象检测 api,2)运行 export_inference_graph.py 并将 input_type 更改为 'encoded_image_string_tensor,最后 3)将此重新导出的模型版本部署到 ml-engine。

    出口:

    python object_detection/export_inference_graph.py --input_type encoded_image_string_tensor --pipeline_config_path TensorFlow/models/research/object_detection/samples/configs/ssd_mobilenet_v1_coco.config --trained_checkpoint_prefix ssd_mobilenet_v1_coco_2018_01_28/model.ckpt --output_directory for_mlengine

    部署:

    $ gsutil cp -r for_mlengine/saved_model/ gs://my_project/my_model

    $ gcloud ml-engine models create my_model --regions us-central1

    $ gcloud ml-engine versions create v1 --model my_model --origin=gs://my_project/my_model/saved_model --framework tensorflow --runtime-version=1.13

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-22
      • 1970-01-01
      • 1970-01-01
      • 2018-09-20
      • 2018-03-24
      • 1970-01-01
      • 1970-01-01
      • 2017-08-19
      相关资源
      最近更新 更多