Google Cloud ML使用对象检测模型返回空预测

问题描述 投票:0回答:1

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

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

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

当我查看文件的结果时

prediction.results 00000-的-00001

只是空的

和文件

prediction.errors_stats 00000-的-00001

包含以下文本:('无JSON对象可被解码',1)

这是检测已经运行并且没有检测到任何信号的标志,或者在运行时是否存在问题?

也许问题是我准备图片上传错误了吗?

日志显示没有任何错误

谢谢

编辑:

我正在做更多测试,并尝试使用命令“gcloud ml-engine local predict”而不是通常的本地代码在本地运行模型。我得到与在线相同的结果,根本没有答案,但也没有错误信息

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

gcloud ml-engine工作提交预测$ {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”

google-cloud-ml
1个回答
1
投票

使用以下命令

型号出口:

# 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。希望这有助于其他人。谷歌支持他们的帮助(他们建议改变)

© www.soinside.com 2019 - 2024. All rights reserved.