google-cloud-vision

Google Vision: How do I choose all types of detection


i'm playing around with Google Cloud Vision API and have implemented it on my own application. For now I can only implement one "type" in the POST, but I want to have more than one. In the Vision API - Drag and Drop Demo (https://cloud.google.com/vision/docs/drag-and-drop), you can output more than one type and I want to do the same.

After reading the documentation for the API I thought the solution was to set the "type" to "TYPE_UNSPECIFIED", but after trying that I couldn't get any response.

"type" is a ENUM and I listed the documentation under:

*// Type: The feature type.
    //
    // Possible values:
    //   "TYPE_UNSPECIFIED" - Unspecified feature type.
    //   "FACE_DETECTION" - Run face detection.
    //   "LANDMARK_DETECTION" - Run landmark detection.
    //   "LOGO_DETECTION" - Run logo detection.
    //   "LABEL_DETECTION" - Run label detection.
    //   "TEXT_DETECTION" - Run text detection / optical character*

I need help to implement more than one "type".. Any ideas?


Solution

  • From docs:

    Multiple Feature objects can be specified in the features list.

    So, to implement all types in a POST request to the annotate method of the REST API you'd have to give all types in the features list like so:

    "features": [
            {
              "type": "FACE_DETECTION"
            },
            {
              "type": "LANDMARK_DETECTION"
            },
        ...
          ]