【发布时间】:2019-11-02 23:07:14
【问题描述】:
我使用具有以下配置的 google ml 引擎训练了我的模型。
JOB_NAME=object_detection"_$(date +%m_%d_%Y_%H_%M_%S)"
echo $JOB_NAME
gcloud ml-engine jobs submit training $JOB_NAME \
--job-dir=gs://$1/train \
--scale-tier BASIC_GPU \
--runtime-version 1.12 \
--packages dist/object_detection-0.1.tar.gz,slim/dist/slim-0.1.tar.gz,/tmp/pycocotools/pycocotools-2.0.tar.gz \
--module-name object_detection.model_main \
--region europe-west1 \
-- \
--model_dir=gs://$1/train \
--pipeline_config_path=gs://$1/data/fast_rcnn_resnet101_coco.config
训练后,我从 GCP 下载了最新的检查点并使用以下命令导出模型:
python export_inference_graph.py --input_type encoded_image_string_tensor --pipeline_config_path training/fast_rcnn_resnet101_coco.config --trained_checkpoint_prefix training/model.ckpt-11127 --output_directory exported_graphs
我的模型配置如下所示:
The given SavedModel SignatureDef contains the following input(s):
inputs['inputs'] tensor_info:
dtype: DT_UINT8
shape: (-1, -1, -1, 3)
name: image_tensor:0
The given SavedModel SignatureDef contains the following output(s):
outputs['detection_boxes'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300, 4)
name: detection_boxes:0
outputs['detection_classes'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300)
name: detection_classes:0
outputs['detection_features'] tensor_info:
dtype: DT_FLOAT
shape: (-1, -1, -1, -1, -1)
name: detection_features:0
outputs['detection_multiclass_scores'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300, 2)
name: detection_multiclass_scores:0
outputs['detection_scores'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300)
name: detection_scores:0
outputs['num_detections'] tensor_info:
dtype: DT_FLOAT
shape: (-1)
name: num_detections:0
outputs['raw_detection_boxes'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300, 4)
name: raw_detection_boxes:0
outputs['raw_detection_scores'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300, 2)
name: raw_detection_scores:0
Method name is: tensorflow/serving/predict
在此之后,我在 ml-engine 上部署了这个模型,配置如下:
Python version 2.7
Framework TensorFlow
Framework version 1.12.3
Runtime version 1.12
Machine type Single core CPU
我收到以下错误:
错误
创建版本失败。检测到错误模型错误:“无法加载模型:加载可服务:{名称:默认版本:1}失败:未找到:在本地主机上运行的二进制文件中未注册操作类型“FusedBatchNormV3”。确保操作和内核已注册在此过程中运行的二进制文件。请注意,如果您正在加载使用来自 tf.contrib 的操作的已保存图,则应在导入图之前访问(例如)tf.contrib.resampler,因为当模块首次使用时,contrib 操作会延迟注册已访问。\n\n (错误代码: 0)"
【问题讨论】:
标签: google-cloud-ml