File: //snap/google-cloud-cli/current/lib/surface/ml/vision/detect_product.yaml
- release_tracks: [BETA, ALPHA]
help_text:
brief: detect products within an image
description: |
detect products within an image
examples: |
To detect product in image 'gs://my-bucket/my-image.jpg' by searching in product set
'my-product-set', in category 'toys', run:
$ {command} gs://my-bucket/my-image.jpg --product-set='my-product-set' --product-set-location=us-east1 --category='toys'
request:
_COMMON_: request
static_fields:
requests.features.type: PRODUCT_SEARCH
modify_request_hooks:
- googlecloudsdk.command_lib.ml.vision.product_search.utils:AddProductSetToDetectProductRequest
- googlecloudsdk.command_lib.ml.vision.product_search.utils:AddBoundingPolygonToDetectProductRequest
response:
_COMMON_: response
arguments:
params:
- _COMMON_: args.image_field
- _COMMON_: args.max_results_field
- api_field: requests.imageContext.productSearchParams.productCategories
arg_name: category
help_text: Product category to search in.
required: true
choices:
- arg_value: apparel
enum_value: apparel
- arg_value: homegoods
enum_value: homegoods
- arg_value: toys
enum_value: toys
- api_field: requests.imageContext.productSearchParams.filter
arg_name: filter
help_text: |-
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'.
- arg_name: bounding-polygon
help_text: |-
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.
additional_arguments_hook: googlecloudsdk.command_lib.ml.vision.product_search.utils:ProductSetArgsForDetectProduct
output:
format: json