问题
I am using Google cloud vision web detection API for detecting where the images have been used. But I always get 10 responses maximum even for Google's logo. Is it limit of the API or I am missing something because there is nothing mentioned in documentation.
回答1:
The default number of results returned from Cloud Vision API requests is 10 (in order to limit the size of the responses), so only then ten most exact identifications are returned. However, you can specify the maxResults
parameter in order to retrieve a larger list of results. Here you have a couple of examples of API calls that return the default 10 entities, or more if specified with the maxResults
parameter. You can run these queries yourself and see the results:
- First query without the
maxResults
parameter, returning 10 entities by default. - Second query with
"maxResults": 30
, returning 30 entities.
So the only difference in order to obtain more results from this API call is that you must add this extra parameter in the features
entry:
"features": [
{
"type": "WEB_DETECTION",
"maxResults": 30
}
]
Also note that the Web Detection functionality of Google Cloud Vision API is still under development and there are some features that are still in beta. There is also a public feature request with more functionalities for the web detection application that you can track in the following Public Issue Tracker post.
来源:https://stackoverflow.com/questions/48548552/google-cloud-vision-web-detection-api-returns-only-10-responses