Google Vision not always including pagesWithMatchingImages in web detection responses

397 Views Asked by At

I'm sending web detection requests like this to the Google Vision API.

{
  "requests": [
    {
      "image": {
        "content": "<base 64 encoded image>"
      },
      "features": [
        {
          "maxResults": 50,
          "type": "WEB_DETECTION"
        }
      ]
    }
  ]
}

The requests are being sent to https://vision.googleapis.com/v1/images:annotate?key=<my key>.

The part of the response I need is pagesWithMatchingImages, so I can see which pages have the given image. This works for most of the images I've tried, but not for images that contain text. If the image is a common logo that includes text, for example, then the API doesn't include pagesWithMatchingImages in the response.

How can I get a list of pages with matching images for images that include text?

Here's are some samples of images that are used on a lot of web pages, but don't have pagesWithMatchingImages in the API response:

Adobe logo

Amazon logo

Nike logo

FedEx logo

Sony logo

2

There are 2 best solutions below

5
On BEST ANSWER

The issue you are facing with the Google Vision API WEB_DETECTION feature seems to be an issue detected by the Google Vision API team, they seem to be investigating more about it and they will post the updates within the Public Issue Tracker post.

One of the reasons the WEB_DETECTION feature does not responds with the pagesWithMatchingImages seems to be related to the transparency in PNG images, adding a white background might help the WEB_DETECTION feature according to the post, but does not warranty the accuracy in the response

The Public Issue Tracker is used for reporting bugs and feature requests of the Google Cloud products, by indicating that you are affected by the same issue it can help to bring more visibility on it and expedite the resolution.

3
On

You can try to add the LOGO_DETECTION type under features.

{
  "requests": [
    {
      "image": {
        "content": "<base 64 encoded image>"
      },
      "features": [
        {
          "maxResults": 50,
          "type": "WEB_DETECTION"
        }
        {
          "type": "LOGO_DETECTION"
        }
      ]
    }
  ]
}