Skip to content

Commit 605cb42

Browse files
yoshi-automationtseaver
authored andcommitted
feat(vision): add celebrity recognition support; add object annotation support; add 'purge_products' method (all v1p4beta1) (via synth) (#9613)
1 parent 9831c1d commit 605cb42

23 files changed

+2078
-729
lines changed

vision/google/cloud/vision_v1p4beta1/gapic/enums.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ class Likelihood(enum.IntEnum):
2626
2727
Attributes:
2828
UNKNOWN (int): Unknown likelihood.
29-
VERY_UNLIKELY (int): It is very unlikely that the image belongs to the specified vertical.
30-
UNLIKELY (int): It is unlikely that the image belongs to the specified vertical.
31-
POSSIBLE (int): It is possible that the image belongs to the specified vertical.
32-
LIKELY (int): It is likely that the image belongs to the specified vertical.
33-
VERY_LIKELY (int): It is very likely that the image belongs to the specified vertical.
29+
VERY_UNLIKELY (int): It is very unlikely.
30+
UNLIKELY (int): It is unlikely.
31+
POSSIBLE (int): It is possible.
32+
LIKELY (int): It is likely.
33+
VERY_LIKELY (int): It is very likely.
3434
"""
3535

3636
UNKNOWN = 0

vision/google/cloud/vision_v1p4beta1/gapic/image_annotator_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ def batch_annotate_files(
280280
>>> response = client.batch_annotate_files(requests)
281281
282282
Args:
283-
requests (list[Union[dict, ~google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]]): The list of file annotation requests. Right now we support only one
284-
AnnotateFileRequest in BatchAnnotateFilesRequest.
283+
requests (list[Union[dict, ~google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]]): Required. The list of file annotation requests. Right now we support only
284+
one AnnotateFileRequest in BatchAnnotateFilesRequest.
285285
286286
If a dict is provided, it must be of the same form as the protobuf
287287
message :class:`~google.cloud.vision_v1p4beta1.types.AnnotateFileRequest`
@@ -363,7 +363,7 @@ def async_batch_annotate_images(
363363
>>> metadata = response.metadata()
364364
365365
Args:
366-
requests (list[Union[dict, ~google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]]): Individual image annotation requests for this batch.
366+
requests (list[Union[dict, ~google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]]): Required. Individual image annotation requests for this batch.
367367
368368
If a dict is provided, it must be of the same form as the protobuf
369369
message :class:`~google.cloud.vision_v1p4beta1.types.AnnotateImageRequest`
@@ -451,7 +451,7 @@ def async_batch_annotate_files(
451451
>>> metadata = response.metadata()
452452
453453
Args:
454-
requests (list[Union[dict, ~google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]]): Individual async file annotation requests for this batch.
454+
requests (list[Union[dict, ~google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]]): Required. Individual async file annotation requests for this batch.
455455
456456
If a dict is provided, it must be of the same form as the protobuf
457457
message :class:`~google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest`

vision/google/cloud/vision_v1p4beta1/gapic/product_search_client.py

Lines changed: 150 additions & 45 deletions
Large diffs are not rendered by default.

vision/google/cloud/vision_v1p4beta1/gapic/product_search_client_config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@
107107
"retry_codes_name": "non_idempotent",
108108
"retry_params_name": "default",
109109
},
110+
"PurgeProducts": {
111+
"timeout_millis": 60000,
112+
"retry_codes_name": "non_idempotent",
113+
"retry_params_name": "default",
114+
},
110115
},
111116
}
112117
}

vision/google/cloud/vision_v1p4beta1/gapic/transports/product_search_grpc_transport.py

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,6 @@ def delete_product_set(self):
202202
203203
The actual image files are not deleted from Google Cloud Storage.
204204
205-
Possible errors:
206-
207-
- Returns NOT\_FOUND if the ProductSet does not exist.
208-
209205
Returns:
210206
Callable: A callable which accepts the appropriate
211207
deserialized request object and returns a
@@ -302,13 +298,9 @@ def delete_product(self):
302298
303299
Permanently deletes a product and its reference images.
304300
305-
Metadata of the product and all its images will be deleted right away,
306-
but search queries against ProductSets containing the product may still
307-
work until all related caches are refreshed.
308-
309-
Possible errors:
310-
311-
- Returns NOT\_FOUND if the product does not exist.
301+
Metadata of the product and all its images will be deleted right away, but
302+
search queries against ProductSets containing the product may still work
303+
until all related caches are refreshed.
312304
313305
Returns:
314306
Callable: A callable which accepts the appropriate
@@ -357,15 +349,11 @@ def delete_reference_image(self):
357349
Permanently deletes a reference image.
358350
359351
The image metadata will be deleted right away, but search queries
360-
against ProductSets containing the image may still work until all
361-
related caches are refreshed.
352+
against ProductSets containing the image may still work until all related
353+
caches are refreshed.
362354
363355
The actual image files are not deleted from Google Cloud Storage.
364356
365-
Possible errors:
366-
367-
- Returns NOT\_FOUND if the reference image does not exist.
368-
369357
Returns:
370358
Callable: A callable which accepts the appropriate
371359
deserialized request object and returns a
@@ -435,10 +423,6 @@ def remove_product_from_product_set(self):
435423
436424
Removes a Product from the specified ProductSet.
437425
438-
Possible errors:
439-
440-
- Returns NOT\_FOUND If the Product is not found under the ProductSet.
441-
442426
Returns:
443427
Callable: A callable which accepts the appropriate
444428
deserialized request object and returns a
@@ -488,3 +472,39 @@ def import_product_sets(self):
488472
deserialized response object.
489473
"""
490474
return self._stubs["product_search_stub"].ImportProductSets
475+
476+
@property
477+
def purge_products(self):
478+
"""Return the gRPC stub for :meth:`ProductSearchClient.purge_products`.
479+
480+
Asynchronous API to delete all Products in a ProductSet or all Products
481+
that are in no ProductSet.
482+
483+
If a Product is a member of the specified ProductSet in addition to
484+
other ProductSets, the Product will still be deleted.
485+
486+
It is recommended to not delete the specified ProductSet until after
487+
this operation has completed. It is also recommended to not add any of
488+
the Products involved in the batch delete to a new ProductSet while this
489+
operation is running because those Products may still end up deleted.
490+
491+
It's not possible to undo the PurgeProducts operation. Therefore, it is
492+
recommended to keep the csv files used in ImportProductSets (if that was
493+
how you originally built the Product Set) before starting PurgeProducts,
494+
in case you need to re-import the data after deletion.
495+
496+
If the plan is to purge all of the Products from a ProductSet and then
497+
re-use the empty ProductSet to re-import new Products into the empty
498+
ProductSet, you must wait until the PurgeProducts operation has finished
499+
for that ProductSet.
500+
501+
The ``google.longrunning.Operation`` API can be used to keep track of
502+
the progress and results of the request. ``Operation.metadata`` contains
503+
``BatchOperationMetadata``. (progress)
504+
505+
Returns:
506+
Callable: A callable which accepts the appropriate
507+
deserialized request object and returns a
508+
deserialized response object.
509+
"""
510+
return self._stubs["product_search_stub"].PurgeProducts
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2019 Google LLC.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
syntax = "proto3";
17+
18+
package google.cloud.vision.v1p4beta1;
19+
20+
import "google/api/annotations.proto";
21+
import "google/cloud/vision/v1p4beta1/geometry.proto";
22+
23+
option cc_enable_arenas = true;
24+
option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1;vision";
25+
option java_multiple_files = true;
26+
option java_outer_classname = "CelebrityProto";
27+
option java_package = "com.google.cloud.vision.v1p4beta1";
28+
option objc_class_prefix = "GCVN";
29+
30+
// Parameters for a celebrity recognition request.
31+
message FaceRecognitionParams {
32+
// The resource names for one or more
33+
// [CelebritySet][google.cloud.vision.v1p4beta1.CelebritySet]s. A celebrity
34+
// set is preloaded and can be specified as "builtin/default". If this is
35+
// specified, the algorithm will try to match the faces detected in the input
36+
// image to the Celebrities in the CelebritySets.
37+
repeated string celebrity_set = 1;
38+
}
39+
40+
// A Celebrity is a group of Faces with an identity.
41+
message Celebrity {
42+
// The resource name of the preloaded Celebrity. Has the format
43+
// `builtin/{mid}`.
44+
string name = 1;
45+
46+
// The Celebrity's display name.
47+
string display_name = 2;
48+
49+
// The Celebrity's description.
50+
string description = 3;
51+
}
52+
53+
// Information about a face's identity.
54+
message FaceRecognitionResult {
55+
// The [Celebrity][google.cloud.vision.v1p4beta1.Celebrity] that this face was
56+
// matched to.
57+
Celebrity celebrity = 1;
58+
59+
// Recognition confidence. Range [0, 1].
60+
float confidence = 2;
61+
}

0 commit comments

Comments
 (0)