Automl image prediction problems

2019-08-21 12:31发布

I get different results when using a model to get image annotation predictions from web UI and from API. Specifically, using the web UI I actually get predictions, but using the API I get nothing - just empty output.

It's this one that gives nothing using the API: https://cloud.google.com/vision/automl/docs/predict#automl-nl-example-cli

Specifically, the return value is {} - an empty JS object. So, the call goes through just fine, there's just no output.

Any hints as to how to debug the issue?

1条回答
Emotional °昔
2楼-- · 2019-08-21 12:56

By default only results with prediction score > 0.5 are returned by the API.

To get all predictions you will need to provide extra argument 'score_threshold' to predict request:

For the REST API:

{
  "payload": {
    "image": {
      "imageBytes": "YOUR_IMAGE_BYTES"
    },
    "params": { "score_threshold": "0.0" },
  }
}

For the python call:

payload = {'image': {'image_bytes': content }, "params": { "score_threshold": "0.0" }}

With this argument all predictions will be returned. The predictions will be ordered by the 'score'.

Hope that helps,

查看更多
登录 后发表回答