Automl image prediction problems

怎甘沉沦 提交于 2019-12-13 03:45:27

问题


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:


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,




回答2:


That doesn't work, at least at the moment.

Instead the params need to go at the same level as the payload. E.g.:

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


来源:https://stackoverflow.com/questions/53173867/automl-image-prediction-problems

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!