Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.

Commit 84b1688

Browse files
feat: add logo recognition to v1 (via synth) (#15)
1 parent ae0c8a9 commit 84b1688

18 files changed

+823
-149
lines changed

google/cloud/videointelligence_v1/gapic/enums.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class Feature(enum.IntEnum):
3232
SPEECH_TRANSCRIPTION (int): Speech transcription.
3333
TEXT_DETECTION (int): OCR text detection and tracking.
3434
OBJECT_TRACKING (int): Object detection and tracking.
35+
LOGO_RECOGNITION (int): Logo detection, tracking, and recognition.
3536
"""
3637

3738
FEATURE_UNSPECIFIED = 0
@@ -42,6 +43,7 @@ class Feature(enum.IntEnum):
4243
SPEECH_TRANSCRIPTION = 6
4344
TEXT_DETECTION = 7
4445
OBJECT_TRACKING = 9
46+
LOGO_RECOGNITION = 12
4547

4648

4749
class LabelDetectionMode(enum.IntEnum):

google/cloud/videointelligence_v1/gapic/video_intelligence_service_client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,12 @@ def annotate_video(
237237
must be specified in the following format: ``gs://bucket-id/object-id``
238238
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
239239
more information, see `Request
240-
URIs <https://cloud.google.com/storage/docs/reference-uris>`__. A video
241-
URI may include wildcards in ``object-id``, and thus identify multiple
242-
videos. Supported wildcards: '\*' to match 0 or more characters; '?' to
243-
match 1 character. If unset, the input video should be embedded in the
244-
request as ``input_content``. If set, ``input_content`` should be unset.
240+
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__. A
241+
video URI may include wildcards in ``object-id``, and thus identify
242+
multiple videos. Supported wildcards: '\*' to match 0 or more
243+
characters; '?' to match 1 character. If unset, the input video should
244+
be embedded in the request as ``input_content``. If set,
245+
``input_content`` should be unset.
245246
input_content (bytes): The video data bytes. If unset, the input video(s) should be specified
246247
via ``input_uri``. If set, ``input_uri`` should be unset.
247248
features (list[~google.cloud.videointelligence_v1.types.Feature]): Required. Requested video annotation features.
@@ -255,7 +256,7 @@ def annotate_video(
255256
must be specified in the following format: ``gs://bucket-id/object-id``
256257
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
257258
more information, see `Request
258-
URIs <https://cloud.google.com/storage/docs/reference-uris>`__.
259+
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__.
259260
location_id (str): Optional. Cloud region where annotation should take place. Supported
260261
cloud regions: ``us-east1``, ``us-west1``, ``europe-west1``,
261262
``asia-east1``. If no region is specified, a region will be determined

google/cloud/videointelligence_v1/proto/video_intelligence.proto

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC.
1+
// Copyright 2020 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
1514

1615
syntax = "proto3";
1716

@@ -62,7 +61,7 @@ message AnnotateVideoRequest {
6261
// supported, which must be specified in the following format:
6362
// `gs://bucket-id/object-id` (other URI formats return
6463
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see
65-
// [Request URIs](/storage/docs/reference-uris).
64+
// [Request URIs](https://cloud.google.com/storage/docs/request-endpoints).
6665
// A video URI may include wildcards in `object-id`, and thus identify
6766
// multiple videos. Supported wildcards: '*' to match 0 or more characters;
6867
// '?' to match 1 character. If unset, the input video should be embedded
@@ -85,7 +84,7 @@ message AnnotateVideoRequest {
8584
// URIs are supported, which must be specified in the following format:
8685
// `gs://bucket-id/object-id` (other URI formats return
8786
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see
88-
// [Request URIs](/storage/docs/reference-uris).
87+
// [Request URIs](https://cloud.google.com/storage/docs/request-endpoints).
8988
string output_uri = 4 [(google.api.field_behavior) = OPTIONAL];
9089

9190
// Optional. Cloud region where annotation should take place. Supported cloud
@@ -148,6 +147,9 @@ enum Feature {
148147

149148
// Object detection and tracking.
150149
OBJECT_TRACKING = 9;
150+
151+
// Logo detection, tracking, and recognition.
152+
LOGO_RECOGNITION = 12;
151153
}
152154

153155
// Label detection mode.
@@ -397,6 +399,67 @@ message FaceAnnotation {
397399
repeated FaceFrame frames = 3;
398400
}
399401

402+
// For tracking related features.
403+
// An object at time_offset with attributes, and located with
404+
// normalized_bounding_box.
405+
message TimestampedObject {
406+
// Normalized Bounding box in a frame, where the object is located.
407+
NormalizedBoundingBox normalized_bounding_box = 1;
408+
409+
// Time-offset, relative to the beginning of the video,
410+
// corresponding to the video frame for this object.
411+
google.protobuf.Duration time_offset = 2;
412+
413+
// Optional. The attributes of the object in the bounding box.
414+
repeated DetectedAttribute attributes = 3 [(google.api.field_behavior) = OPTIONAL];
415+
416+
// Optional. The detected landmarks.
417+
repeated DetectedLandmark landmarks = 4 [(google.api.field_behavior) = OPTIONAL];
418+
}
419+
420+
// A track of an object instance.
421+
message Track {
422+
// Video segment of a track.
423+
VideoSegment segment = 1;
424+
425+
// The object with timestamp and attributes per frame in the track.
426+
repeated TimestampedObject timestamped_objects = 2;
427+
428+
// Optional. Attributes in the track level.
429+
repeated DetectedAttribute attributes = 3 [(google.api.field_behavior) = OPTIONAL];
430+
431+
// Optional. The confidence score of the tracked object.
432+
float confidence = 4 [(google.api.field_behavior) = OPTIONAL];
433+
}
434+
435+
// A generic detected attribute represented by name in string format.
436+
message DetectedAttribute {
437+
// The name of the attribute, i.e. glasses, dark_glasses, mouth_open etc.
438+
// A full list of supported type names will be provided in the document.
439+
string name = 1;
440+
441+
// Detected attribute confidence. Range [0, 1].
442+
float confidence = 2;
443+
444+
// Text value of the detection result. For example, the value for "HairColor"
445+
// can be "black", "blonde", etc.
446+
string value = 3;
447+
}
448+
449+
// A generic detected landmark represented by name in string format and a 2D
450+
// location.
451+
message DetectedLandmark {
452+
// The name of this landmark, i.e. left_hand, right_shoulder.
453+
string name = 1;
454+
455+
// The 2D point of the detected landmark using the normalized image
456+
// coordindate system. The normalized coordinates have the range from 0 to 1.
457+
NormalizedVertex point = 2;
458+
459+
// The confidence score of the detected landmark. Range [0, 1].
460+
float confidence = 3;
461+
}
462+
400463
// Annotation results for a single video.
401464
message VideoAnnotationResults {
402465
// Video file location in
@@ -453,6 +516,9 @@ message VideoAnnotationResults {
453516
// Annotations for list of objects detected and tracked in video.
454517
repeated ObjectTrackingAnnotation object_annotations = 14;
455518

519+
// Annotations for list of logos detected, tracked and recognized in video.
520+
repeated LogoRecognitionAnnotation logo_recognition_annotations = 19;
521+
456522
// If set, indicates an error. Note that for a single `AnnotateVideoRequest`
457523
// some videos may succeed and some may fail.
458524
google.rpc.Status error = 9;
@@ -743,3 +809,18 @@ message ObjectTrackingAnnotation {
743809
// Streaming mode: it can only be one ObjectTrackingFrame message in frames.
744810
repeated ObjectTrackingFrame frames = 2;
745811
}
812+
813+
// Annotation corresponding to one detected, tracked and recognized logo class.
814+
message LogoRecognitionAnnotation {
815+
// Entity category information to specify the logo class that all the logo
816+
// tracks within this LogoRecognitionAnnotation are recognized as.
817+
Entity entity = 1;
818+
819+
// All logo tracks where the recognized logo appears. Each track corresponds
820+
// to one logo instance appearing in consecutive frames.
821+
repeated Track tracks = 2;
822+
823+
// All video segments where the recognized logo appears. There might be
824+
// multiple instances of the same logo class appearing in one VideoSegment.
825+
repeated VideoSegment segments = 3;
826+
}

google/cloud/videointelligence_v1/proto/video_intelligence_pb2.py

Lines changed: 652 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

google/cloud/videointelligence_v1beta2/gapic/video_intelligence_service_client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,12 @@ def annotate_video(
234234
must be specified in the following format: ``gs://bucket-id/object-id``
235235
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
236236
more information, see `Request
237-
URIs <https://cloud.google.com/storage/docs/reference-uris>`__. A video
238-
URI may include wildcards in ``object-id``, and thus identify multiple
239-
videos. Supported wildcards: '\*' to match 0 or more characters; '?' to
240-
match 1 character. If unset, the input video should be embedded in the
241-
request as ``input_content``. If set, ``input_content`` should be unset.
237+
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__. A
238+
video URI may include wildcards in ``object-id``, and thus identify
239+
multiple videos. Supported wildcards: '\*' to match 0 or more
240+
characters; '?' to match 1 character. If unset, the input video should
241+
be embedded in the request as ``input_content``. If set,
242+
``input_content`` should be unset.
242243
input_content (bytes): The video data bytes. If unset, the input video(s) should be specified
243244
via ``input_uri``. If set, ``input_uri`` should be unset.
244245
features (list[~google.cloud.videointelligence_v1beta2.types.Feature]): Required. Requested video annotation features.
@@ -252,7 +253,7 @@ def annotate_video(
252253
must be specified in the following format: ``gs://bucket-id/object-id``
253254
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
254255
more information, see `Request
255-
URIs <https://cloud.google.com/storage/docs/reference-uris>`__.
256+
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__.
256257
location_id (str): Optional. Cloud region where annotation should take place. Supported
257258
cloud regions: ``us-east1``, ``us-west1``, ``europe-west1``,
258259
``asia-east1``. If no region is specified, a region will be determined

google/cloud/videointelligence_v1beta2/proto/video_intelligence.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ message AnnotateVideoRequest {
6464
// supported, which must be specified in the following format:
6565
// `gs://bucket-id/object-id` (other URI formats return
6666
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
67-
// more information, see [Request URIs](/storage/docs/reference-uris). A video
67+
// more information, see [Request URIs](https://cloud.google.com/storage/docs/request-endpoints). A video
6868
// URI may include wildcards in `object-id`, and thus identify multiple
6969
// videos. Supported wildcards: '*' to match 0 or more characters;
7070
// '?' to match 1 character. If unset, the input video should be embedded
@@ -87,7 +87,7 @@ message AnnotateVideoRequest {
8787
// URIs are supported, which must be specified in the following format:
8888
// `gs://bucket-id/object-id` (other URI formats return
8989
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
90-
// more information, see [Request URIs](/storage/docs/reference-uris).
90+
// more information, see [Request URIs](https://cloud.google.com/storage/docs/request-endpoints).
9191
string output_uri = 4 [(google.api.field_behavior) = OPTIONAL];
9292

9393
// Optional. Cloud region where annotation should take place. Supported cloud

google/cloud/videointelligence_v1beta2/proto/video_intelligence_pb2.py

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

google/cloud/videointelligence_v1p1beta1/gapic/video_intelligence_service_client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,12 @@ def annotate_video(
236236
must be specified in the following format: ``gs://bucket-id/object-id``
237237
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
238238
more information, see `Request
239-
URIs <https://cloud.google.com/storage/docs/reference-uris>`__. A video
240-
URI may include wildcards in ``object-id``, and thus identify multiple
241-
videos. Supported wildcards: '\*' to match 0 or more characters; '?' to
242-
match 1 character. If unset, the input video should be embedded in the
243-
request as ``input_content``. If set, ``input_content`` should be unset.
239+
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__. A
240+
video URI may include wildcards in ``object-id``, and thus identify
241+
multiple videos. Supported wildcards: '\*' to match 0 or more
242+
characters; '?' to match 1 character. If unset, the input video should
243+
be embedded in the request as ``input_content``. If set,
244+
``input_content`` should be unset.
244245
input_content (bytes): The video data bytes. If unset, the input video(s) should be specified
245246
via ``input_uri``. If set, ``input_uri`` should be unset.
246247
features (list[~google.cloud.videointelligence_v1p1beta1.types.Feature]): Required. Requested video annotation features.
@@ -254,7 +255,7 @@ def annotate_video(
254255
must be specified in the following format: ``gs://bucket-id/object-id``
255256
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
256257
more information, see `Request
257-
URIs <https://cloud.google.com/storage/docs/reference-uris>`__.
258+
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__.
258259
location_id (str): Optional. Cloud region where annotation should take place. Supported
259260
cloud regions: ``us-east1``, ``us-west1``, ``europe-west1``,
260261
``asia-east1``. If no region is specified, a region will be determined

google/cloud/videointelligence_v1p1beta1/proto/video_intelligence.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ message AnnotateVideoRequest {
6262
// supported, which must be specified in the following format:
6363
// `gs://bucket-id/object-id` (other URI formats return
6464
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see
65-
// [Request URIs](/storage/docs/reference-uris).
65+
// [Request URIs](https://cloud.google.com/storage/docs/request-endpoints).
6666
// A video URI may include wildcards in `object-id`, and thus identify
6767
// multiple videos. Supported wildcards: '*' to match 0 or more characters;
6868
// '?' to match 1 character. If unset, the input video should be embedded
@@ -85,7 +85,7 @@ message AnnotateVideoRequest {
8585
// URIs are supported, which must be specified in the following format:
8686
// `gs://bucket-id/object-id` (other URI formats return
8787
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see
88-
// [Request URIs](/storage/docs/reference-uris).
88+
// [Request URIs](https://cloud.google.com/storage/docs/request-endpoints).
8989
string output_uri = 4 [(google.api.field_behavior) = OPTIONAL];
9090

9191
// Optional. Cloud region where annotation should take place. Supported cloud

google/cloud/videointelligence_v1p1beta1/proto/video_intelligence_pb2.py

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)