Python API predict using custom AutoML model and Google Storage image object

88 views
Skip to first unread message

Peter Retief

unread,
Oct 3, 2018, 10:55:05 AM10/3/18
to cloud-vision-discuss
I am trying to write a python script to predict labels using a custom model which we have trained.  The example in the tutorial works fine, using a sample image on my local disk, where:

    # Read the image and assign to payload.
    with open(file_path, "rb") as image_file:
        content = image_file.read()
    payload = {"image": {"image_bytes": content}}

I would like to submit a sample image stored in Google Storage.  This is the sample code I have tried:

    payload = {
      "thumbnailUri": "",
      "inputConfig" : {
          "gcsSource": {
               "inputUris" : {
"gs://photogrammetry/180919/STA0001-20180828-1316-26682-CAM000003.jpg"
                             }
                        }
                    }
                }

I get this error: "ValueError: Protocol message ExamplePayload has no "inputConfig" field."

What am I doing wrong?

Does anyone have a sample Python script which predicts from a Google Storage image?

Amruth (Cloud Platform Support)

unread,
Oct 3, 2018, 6:40:12 PM10/3/18
to cloud-vision-discuss

For Cloud Vision API, ‘inputConfig’, only pdf and tiff are supported [1]. Also, I found some sample examples in Python for Vision API [2], though the examples are not specific to Cloud Storage.


[1] https://cloud.google.com/vision/docs/reference/rpc/google.cloud.vision.v1p2beta1#google.cloud.vision.v1p2beta1.InputConfig.FIELDS-table

[2] https://cloud.google.com/vision/docs/samples

AutoML Vision Feedback

unread,
Oct 3, 2018, 10:29:44 PM10/3/18
to pe...@swenitech.com, cloud-vision-discuss
Hi,

Thank you for using the product and your feedback.

AutoML Predict API doesn't support GCS input at the moment. 

We will keep this feature request in mind when working on product improvements.

AutoML Team



--
© 2018 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Cloud Vision Discussion Google Group (cloud-visi...@googlegroups.com) to participate in discussions with other members of the Google Cloud Vision community and the Google Cloud Vision Team.
---
You received this message because you are subscribed to the Google Groups "cloud-vision-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-vision-dis...@googlegroups.com.
To post to this group, send email to cloud-visi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-vision-discuss/1e6c1e74-e13c-4945-b79d-7121b9d9e9f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages