Google的AutoML可以导出经过训练的模型以进行离线推理吗?

时间:2018-08-15 22:17:39

标签: google-cloud-platform automl google-cloud-automl

AutoML看起来很棒。一个大问题是-我们可以导出经过训练的模型以进行离线推断吗?例如使用tensorflow或tensoflow lite?

5 个答案:

答案 0 :(得分:2)

从2019年3月开始不支持此功能。如果您对此功能感兴趣,请为以下请求加注星标: https://issuetracker.google.com/issues/113122585

还请检查该链接,以防Google自该答案以来实施了该功能。

答案 1 :(得分:1)

AutoML Vision的当前状态(2019年8月)是您可以导出AutoML图像分类模型,但不能导出对象检测。此功能处于beta版本(AutoML Vision本身也处于Beta版)。我找不到其他AutoML产品的详细信息,也没有亲自尝试过,因此我不确定它们的状态。

来自https://cloud.google.com/vision/automl/docs/

  

现在,AutoML Vision Edge允许您导出经过培训的自定义   模型。

     
      
  • AutoML Vision Edge允许您训练和部署针对边缘设备优化的低延迟,高精度模型。
  •   
  • 通过Tensorflow Lite,Core ML和容器导出格式,AutoML Vision Edge支持多种设备。
  •   
  • 支持的硬件体系结构:Edge TPU,ARM和NVIDIA。
  •   
  • 要在iOS或Android设备上构建应用程序,可以使用ML Kit中的AutoML Vision Edge。该解决方案可通过Firebase获得   并提供用于创建和部署的端到端开发流程   使用ML Kit客户端库为移动设备定制模型。
  •   

文档https://cloud.google.com/vision/automl/docs/edge-quickstart

我训练了一个分类模型,导出了tflite模型(将其导出到Cloud存储),并能够使用Python API轻松下载模型文件并将其加载到tensorflow中。这是用于加载模型和运行推理的相关代码:

基于https://www.tensorflow.org/lite/guide/inference#load_and_run_a_model_in_python

# Load TFLite model and allocate tensors.
interpreter = tf.lite.Interpreter(model_path=MODEL_PATH)
interpreter.allocate_tensors()

# Get input and output tensors.
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()

def predict(frame):
    interpreter.set_tensor(input_details[0]['index'], frame)
    interpreter.invoke()

    # The function `get_tensor()` returns a copy of the tensor data.
    # Use `tensor()` in order to get a pointer to the tensor.
    output_data = interpreter.get_tensor(output_details[0]['index'])

答案 2 :(得分:0)

尚无法从AutoML导出模型。 @Infinite Loops,automl和ml引擎是不同的产品。

答案 3 :(得分:0)

应该是这样:

https://cloud.google.com/vision/automl/docs/deploy

请注意,导出选项(至少当前)不会出现在您已经训练好的模型上。您必须选择一种模型,进行训练,然后可以选择将模型保留在云中或生成边缘版本。

  

您可以导出任一通用图像分类模型   Tensorflow Lite格式,Edge TPU编译的TensorFlow Lite格式或   使用以下方式将TensorFlow格式转换为Google Cloud Storage位置:   ExportModel API。

答案 4 :(得分:-1)

是的。看看本指南。

https://cloud.google.com/ml-engine/docs/tensorflow/deploying-models

  

“无论您是在云中训练模型还是在其他地方训练,您都可以   将TensorFlow模型部署到Cloud ML Engine并使用它们进行服务   预测。”

相关问题