Google Cloud ML returns 使用对象检测模型的空预测

Google Cloud ML returns empty predictions with object detection model

我是第一次将模型部署到 Google Cloud ML。我已经在本地训练和测试了模型,它仍然需要工作,但它工作正常。

我已将其上传到 Cloud ML 并使用我在本地测试的相同示例图像进行测试,我知道这些图像会被检测到。 (使用 this tutorial

当我这样做时,我没有检测到。起初我以为我上传了错误的检查点,但我测试了,同样的检查点可以离线使用这些图像,我不知道如何进一步调试。

当我查看结果文件时

prediction.results-00000-of-00001

只是空的

和文件

prediction.errors_stats-00000-of-00001

包含以下文本:('No JSON object could be decoded', 1)

这是检测 运行 但什么也没检测到的迹象,还是 运行 宁时有问题?

也许问题是我准备上传的图片有误?

日志显示完全没有错误

谢谢

编辑:

我正在做更多测试,并尝试使用命令 "gcloud ml-engine local predict" 而不是通常的本地代码在本地 运行 模型。我得到的结果和网上一样,根本没有答案,也没有错误信息

编辑 2: 我正在使用 TF_Record 文件,所以我不理解 JSON 响应。这是我的命令的副本:

gcloud ml-engine jobs submit prediction ${JOB_ID} --data- format=tf_record \ --input-paths=gs://MY_BUCKET/data_dir/inputs.tfr \ --output-path=gs://MY_BUCKET/data_dir/version4 \ --region us-central1 \ --model="gcp_detector" \ --version="Version4"

适用于以下命令

模型导出:

# From tensorflow/models
export PYTHONPATH=$PYTHONPATH:/home/[user]/repos/DeepLearning/tools/models/research:/home/[user]/repos/DeepLearning/tools/models/research/slim
cd /home/[user]/repos/DeepLearning/tools/models/research
python object_detection/export_inference_graph.py \
    --input_type encoded_image_string_tensor \
    --pipeline_config_path /home/[user]/[path]/ssd_mobilenet_v1_pets.config \
    --trained_checkpoint_prefix /[path_to_checkpoint]/model.ckpt-216593 \
    --output_directory /[output_path]/output_inference_graph.pb

云执行

gcloud ml-engine jobs submit prediction ${JOB_ID} --data-format=TF_RECORD \
    --input-paths=gs://my_inference/data_dir/inputs/* \
    --output-path=${YOUR_OUTPUT_DIR}  \
    --region us-central1 \
    --model="model_name" \
    --version="version_name" 

我不知道究竟是什么更改解决了这个问题,但有一些小的更改,例如 tf_record 现在是 TF_RECORD。希望这可以帮助别人。支持 google 支持他们的帮助(他们建议更改)