- gcloud alpha ml vision detect-product - detect products within an image
(ALPHA)detect products within an image
- POSITIONAL ARGUMENTS
- Path to the image to be analyzed. This can be either a local path or a URL. If you provide a local file, the contents will be sent directly to Google Cloud Vision. If you provide a URL, it must be in Google Cloud Storage format (gs://bucket/object) or an HTTP URL (http://... or https://…)
- REQUIRED FLAGS
Product category to search in.
CATEGORYmust be one of:
Product set resource - The product set to be searched for similar images. The
arguments in this group can be used to specify the attributes of this resource.
(NOTE) Some attributes are not given arguments in this group but can be set in
other ways. To set the [project] attribute: provide the argument [--product-set]
on the command line with a fully specified name; provide the argument
[--project] on the command line; set the property [core/project]. This must be
- ID of the product set or fully qualified identifier for the product set. This flag must be specified if any of the other arguments in this group are specified.
- The location of the product set.
- OPTIONAL FLAGS
- Bounding polygon around the areas of interest in the image. If it is not specified, system discretion will be applied. A bounding polygon can be specified by a list of vertices or normalized vertices. A vertex (x, y) represents a 2D point in the image. x, y are integers and are in the same scale as the original image. The normalized vertex coordinates are relative to orginal image and range from 0 to 1. For example, --bounding-polygon=0.,0.,0.,0.3,0.3,0.,0.3,0.3 specifies a polygon with 4 normalized vertices - (0., 0.), (0., 0.3), (0.3, 0.), (0.3, 0.3). Notice that the decimal point is needed for normalized vertex coordindates.
- Filter expression to restrict search results based on product labels. ANDs of ORs of key-value expressions are supported, where expressions within an OR must have the same key. Expressions separated by AND must have different keys. An '=' should be used to connect the key and value. For example, '(color = red OR color = blue) AND brand = Google' is acceptable, but not '(color = red OR brand = Google)' or 'color: red'.
- Maximum number of results to be provided.
- GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account,
--log-http, --project, --quiet, --trace-token, --user-output-enabled,
$ gcloud helpfor details.
- API REFERENCE
This command uses the
vision/v1API. The full documentation for this API can be found at: https://cloud.google.com/vision/
To detect product in image 'gs://my-bucket/my-image.jpg' by searching in product
set 'my-product-set', in category 'toys', run:
$ gcloud alpha ml vision detect-product \ gs://my-bucket/my-image.jpg --product-set='my-product-set' \ --product-set-location=us-east1 --category='toys'
- This command is currently in ALPHA and may change without notice. If this command fails with API permission errors despite specifying the right project, you may be trying to access an API with an invitation-only early access whitelist. This variant is also available:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-01-07.