Skip to content

Commit

Permalink
feat: Added option for user to set labels
Browse files Browse the repository at this point in the history
docs: Updated various comments
chore: configure longrunning operations

PiperOrigin-RevId: 604671304
  • Loading branch information
Google APIs authored and Copybara-Service committed Feb 6, 2024
1 parent 4cc16e8 commit f4c047f
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 81 deletions.
2 changes: 1 addition & 1 deletion google/cloud/vision/v1/geometry.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
78 changes: 63 additions & 15 deletions google/cloud/vision/v1/image_annotator.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,7 +46,8 @@ service ImageAnnotator {
"https://www.googleapis.com/auth/cloud-vision";

// Run image detection and annotation for a batch of images.
rpc BatchAnnotateImages(BatchAnnotateImagesRequest) returns (BatchAnnotateImagesResponse) {
rpc BatchAnnotateImages(BatchAnnotateImagesRequest)
returns (BatchAnnotateImagesResponse) {
option (google.api.http) = {
post: "/v1/images:annotate"
body: "*"
Expand All @@ -69,7 +70,8 @@ service ImageAnnotator {
// AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each
// file provided and perform detection and annotation for each image
// extracted.
rpc BatchAnnotateFiles(BatchAnnotateFilesRequest) returns (BatchAnnotateFilesResponse) {
rpc BatchAnnotateFiles(BatchAnnotateFilesRequest)
returns (BatchAnnotateFilesResponse) {
option (google.api.http) = {
post: "/v1/files:annotate"
body: "*"
Expand All @@ -94,7 +96,8 @@ service ImageAnnotator {
//
// This service will write image annotation outputs to json files in customer
// GCS bucket, each json file containing BatchAnnotateImagesResponse proto.
rpc AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest) returns (google.longrunning.Operation) {
rpc AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/images:asyncBatchAnnotate"
body: "*"
Expand All @@ -120,7 +123,8 @@ service ImageAnnotator {
// `google.longrunning.Operations` interface.
// `Operation.metadata` contains `OperationMetadata` (metadata).
// `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results).
rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest) returns (google.longrunning.Operation) {
rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/files:asyncBatchAnnotate"
body: "*"
Expand Down Expand Up @@ -566,7 +570,9 @@ message SafeSearchAnnotation {
// Likelihood that this is a medical image.
Likelihood medical = 3;

// Likelihood that this image contains violent content.
// Likelihood that this image contains violent content. Violent content may
// include death, serious harm, or injury to individuals or groups of
// individuals.
Likelihood violence = 4;

// Likelihood that the request image contains racy content. Racy content may
Expand Down Expand Up @@ -644,8 +650,8 @@ message CropHintsParams {

// Parameters for web detection request.
message WebDetectionParams {
// Whether to include results derived from the geo information in the image.
bool include_geo_results = 2;
// This field has no effect on results.
bool include_geo_results = 2 [deprecated = true];
}

// Parameters for text detections. This is used to control TEXT_DETECTION and
Expand All @@ -656,7 +662,13 @@ message TextDetectionParams {
// score for TEXT_DETECTION as well.
bool enable_text_detection_confidence_score = 9;

// A list of advanced OCR options to fine-tune OCR behavior.
// A list of advanced OCR options to further fine-tune OCR behavior.
// Current valid values are:
//
// - `legacy_layout`: a heuristics layout detection algorithm, which serves as
// an alternative to the current ML-based layout detection algorithm.
// Customers can choose the best suitable layout algorithm based on their
// situation.
repeated string advanced_ocr_options = 11;
}

Expand Down Expand Up @@ -767,7 +779,8 @@ message AnnotateImageResponse {
// Multiple image annotation requests are batched into a single service call.
message BatchAnnotateImagesRequest {
// Required. Individual image annotation requests for this batch.
repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED];
repeated AnnotateImageRequest requests = 1
[(google.api.field_behavior) = REQUIRED];

// Optional. Target project and location to make a call.
//
Expand All @@ -782,6 +795,14 @@ message BatchAnnotateImagesRequest {
//
// Example: `projects/project-A/locations/eu`.
string parent = 4;

// Optional. The labels with user-defined metadata for the request.
//
// Label keys and values can be no longer than 63 characters
// (Unicode codepoints), can only contain lowercase letters, numeric
// characters, underscores and dashes. International characters are allowed.
// Label values are optional. Label keys must start with a letter.
map<string, string> labels = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response to a batch image annotation request.
Expand Down Expand Up @@ -838,9 +859,10 @@ message AnnotateFileResponse {

// A list of requests to annotate files using the BatchAnnotateFiles API.
message BatchAnnotateFilesRequest {
// Required. The list of file annotation requests. Right now we support only one
// AnnotateFileRequest in BatchAnnotateFilesRequest.
repeated AnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The list of file annotation requests. Right now we support only
// one AnnotateFileRequest in BatchAnnotateFilesRequest.
repeated AnnotateFileRequest requests = 1
[(google.api.field_behavior) = REQUIRED];

// Optional. Target project and location to make a call.
//
Expand All @@ -855,6 +877,14 @@ message BatchAnnotateFilesRequest {
//
// Example: `projects/project-A/locations/eu`.
string parent = 3;

// Optional. The labels with user-defined metadata for the request.
//
// Label keys and values can be no longer than 63 characters
// (Unicode codepoints), can only contain lowercase letters, numeric
// characters, underscores and dashes. International characters are allowed.
// Label values are optional. Label keys must start with a letter.
map<string, string> labels = 5 [(google.api.field_behavior) = OPTIONAL];
}

// A list of file annotation responses.
Expand Down Expand Up @@ -888,7 +918,8 @@ message AsyncAnnotateFileResponse {
// Request for async image annotation for a list of images.
message AsyncBatchAnnotateImagesRequest {
// Required. Individual image annotation requests for this batch.
repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED];
repeated AnnotateImageRequest requests = 1
[(google.api.field_behavior) = REQUIRED];

// Required. The desired output location and metadata (e.g. format).
OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED];
Expand All @@ -906,6 +937,14 @@ message AsyncBatchAnnotateImagesRequest {
//
// Example: `projects/project-A/locations/eu`.
string parent = 4;

// Optional. The labels with user-defined metadata for the request.
//
// Label keys and values can be no longer than 63 characters
// (Unicode codepoints), can only contain lowercase letters, numeric
// characters, underscores and dashes. International characters are allowed.
// Label values are optional. Label keys must start with a letter.
map<string, string> labels = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response to an async batch image annotation request.
Expand All @@ -918,7 +957,8 @@ message AsyncBatchAnnotateImagesResponse {
// call.
message AsyncBatchAnnotateFilesRequest {
// Required. Individual async file annotation requests for this batch.
repeated AsyncAnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED];
repeated AsyncAnnotateFileRequest requests = 1
[(google.api.field_behavior) = REQUIRED];

// Optional. Target project and location to make a call.
//
Expand All @@ -933,6 +973,14 @@ message AsyncBatchAnnotateFilesRequest {
//
// Example: `projects/project-A/locations/eu`.
string parent = 4;

// Optional. The labels with user-defined metadata for the request.
//
// Label keys and values can be no longer than 63 characters
// (Unicode codepoints), can only contain lowercase letters, numeric
// characters, underscores and dashes. International characters are allowed.
// Label values are optional. Label keys must start with a letter.
map<string, string> labels = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response to an async batch file annotation request.
Expand Down
9 changes: 5 additions & 4 deletions google/cloud/vision/v1/product_search.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,13 +34,14 @@ message ProductSearchParams {
// If it is not specified, system discretion will be applied.
BoundingPoly bounding_poly = 9;

// The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images.
// The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to
// be searched for similar images.
//
// Format is:
// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
string product_set = 6 [(google.api.resource_reference) = {
type: "vision.googleapis.com/ProductSet"
}];
type: "vision.googleapis.com/ProductSet"
}];

// The list of product categories to search in. Currently, we only consider
// the first category, and either "homegoods-v2", "apparel-v2", "toys-v2",
Expand Down

0 comments on commit f4c047f

Please sign in to comment.