CloudML 上输入数据的正确格式
Correct format for input data on CloudML
我正在尝试将作业发送到我在 CloudML 上的对象检测模型以获得预测。我正在按照 https://cloud.google.com/ml-engine/docs/online-predict 上的指南进行操作,但在提交请求时遇到错误:
RuntimeError:预测失败:处理输入时出错:应为 uint8,得到类型为 'str' 的 '\xf6>\x00\x01\x04\xa4d\x94...(更多字节)...\x00\x10\x10\x10\x04\x80\xd9'相反。
这是我的代码:
img = base64.b64encode(open("file.jpg", "rb").read()).decode('utf-8')
json = {"b64": img}
result = predict_json(project, model, json, "v1")
我的错,导出图的时候忘了加--input_type encoded_image_string_tensor
我正在尝试将作业发送到我在 CloudML 上的对象检测模型以获得预测。我正在按照 https://cloud.google.com/ml-engine/docs/online-predict 上的指南进行操作,但在提交请求时遇到错误:
RuntimeError:预测失败:处理输入时出错:应为 uint8,得到类型为 'str' 的 '\xf6>\x00\x01\x04\xa4d\x94...(更多字节)...\x00\x10\x10\x10\x04\x80\xd9'相反。
这是我的代码:
img = base64.b64encode(open("file.jpg", "rb").read()).decode('utf-8')
json = {"b64": img}
result = predict_json(project, model, json, "v1")
我的错,导出图的时候忘了加--input_type encoded_image_string_tensor