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

feat: add logo recognition to v1 (via synth) #15

Merged
merged 1 commit into from Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions google/cloud/videointelligence_v1/gapic/enums.py
Expand Up @@ -32,6 +32,7 @@ class Feature(enum.IntEnum):
SPEECH_TRANSCRIPTION (int): Speech transcription.
TEXT_DETECTION (int): OCR text detection and tracking.
OBJECT_TRACKING (int): Object detection and tracking.
LOGO_RECOGNITION (int): Logo detection, tracking, and recognition.
"""

FEATURE_UNSPECIFIED = 0
Expand All @@ -42,6 +43,7 @@ class Feature(enum.IntEnum):
SPEECH_TRANSCRIPTION = 6
TEXT_DETECTION = 7
OBJECT_TRACKING = 9
LOGO_RECOGNITION = 12


class LabelDetectionMode(enum.IntEnum):
Expand Down
Expand Up @@ -237,11 +237,12 @@ def annotate_video(
must be specified in the following format: ``gs://bucket-id/object-id``
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
more information, see `Request
URIs <https://cloud.google.com/storage/docs/reference-uris>`__. A video
URI may include wildcards in ``object-id``, and thus identify multiple
videos. Supported wildcards: '\*' to match 0 or more characters; '?' to
match 1 character. If unset, the input video should be embedded in the
request as ``input_content``. If set, ``input_content`` should be unset.
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__. A
video URI may include wildcards in ``object-id``, and thus identify
multiple videos. Supported wildcards: '\*' to match 0 or more
characters; '?' to match 1 character. If unset, the input video should
be embedded in the request as ``input_content``. If set,
``input_content`` should be unset.
input_content (bytes): The video data bytes. If unset, the input video(s) should be specified
via ``input_uri``. If set, ``input_uri`` should be unset.
features (list[~google.cloud.videointelligence_v1.types.Feature]): Required. Requested video annotation features.
Expand All @@ -255,7 +256,7 @@ def annotate_video(
must be specified in the following format: ``gs://bucket-id/object-id``
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
more information, see `Request
URIs <https://cloud.google.com/storage/docs/reference-uris>`__.
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__.
location_id (str): Optional. Cloud region where annotation should take place. Supported
cloud regions: ``us-east1``, ``us-west1``, ``europe-west1``,
``asia-east1``. If no region is specified, a region will be determined
Expand Down
89 changes: 85 additions & 4 deletions google/cloud/videointelligence_v1/proto/video_intelligence.proto
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC.
// Copyright 2020 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 All @@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

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

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

// Object detection and tracking.
OBJECT_TRACKING = 9;

// Logo detection, tracking, and recognition.
LOGO_RECOGNITION = 12;
}

// Label detection mode.
Expand Down Expand Up @@ -397,6 +399,67 @@ message FaceAnnotation {
repeated FaceFrame frames = 3;
}

// For tracking related features.
// An object at time_offset with attributes, and located with
// normalized_bounding_box.
message TimestampedObject {
// Normalized Bounding box in a frame, where the object is located.
NormalizedBoundingBox normalized_bounding_box = 1;

// Time-offset, relative to the beginning of the video,
// corresponding to the video frame for this object.
google.protobuf.Duration time_offset = 2;

// Optional. The attributes of the object in the bounding box.
repeated DetectedAttribute attributes = 3 [(google.api.field_behavior) = OPTIONAL];

// Optional. The detected landmarks.
repeated DetectedLandmark landmarks = 4 [(google.api.field_behavior) = OPTIONAL];
}

// A track of an object instance.
message Track {
// Video segment of a track.
VideoSegment segment = 1;

// The object with timestamp and attributes per frame in the track.
repeated TimestampedObject timestamped_objects = 2;

// Optional. Attributes in the track level.
repeated DetectedAttribute attributes = 3 [(google.api.field_behavior) = OPTIONAL];

// Optional. The confidence score of the tracked object.
float confidence = 4 [(google.api.field_behavior) = OPTIONAL];
}

// A generic detected attribute represented by name in string format.
message DetectedAttribute {
// The name of the attribute, i.e. glasses, dark_glasses, mouth_open etc.
// A full list of supported type names will be provided in the document.
string name = 1;

// Detected attribute confidence. Range [0, 1].
float confidence = 2;

// Text value of the detection result. For example, the value for "HairColor"
// can be "black", "blonde", etc.
string value = 3;
}

// A generic detected landmark represented by name in string format and a 2D
// location.
message DetectedLandmark {
// The name of this landmark, i.e. left_hand, right_shoulder.
string name = 1;

// The 2D point of the detected landmark using the normalized image
// coordindate system. The normalized coordinates have the range from 0 to 1.
NormalizedVertex point = 2;

// The confidence score of the detected landmark. Range [0, 1].
float confidence = 3;
}

// Annotation results for a single video.
message VideoAnnotationResults {
// Video file location in
Expand Down Expand Up @@ -453,6 +516,9 @@ message VideoAnnotationResults {
// Annotations for list of objects detected and tracked in video.
repeated ObjectTrackingAnnotation object_annotations = 14;

// Annotations for list of logos detected, tracked and recognized in video.
repeated LogoRecognitionAnnotation logo_recognition_annotations = 19;

// If set, indicates an error. Note that for a single `AnnotateVideoRequest`
// some videos may succeed and some may fail.
google.rpc.Status error = 9;
Expand Down Expand Up @@ -743,3 +809,18 @@ message ObjectTrackingAnnotation {
// Streaming mode: it can only be one ObjectTrackingFrame message in frames.
repeated ObjectTrackingFrame frames = 2;
}

// Annotation corresponding to one detected, tracked and recognized logo class.
message LogoRecognitionAnnotation {
// Entity category information to specify the logo class that all the logo
// tracks within this LogoRecognitionAnnotation are recognized as.
Entity entity = 1;

// All logo tracks where the recognized logo appears. Each track corresponds
// to one logo instance appearing in consecutive frames.
repeated Track tracks = 2;

// All video segments where the recognized logo appears. There might be
// multiple instances of the same logo class appearing in one VideoSegment.
repeated VideoSegment segments = 3;
}
703 changes: 652 additions & 51 deletions google/cloud/videointelligence_v1/proto/video_intelligence_pb2.py

Large diffs are not rendered by default.

Expand Up @@ -234,11 +234,12 @@ def annotate_video(
must be specified in the following format: ``gs://bucket-id/object-id``
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
more information, see `Request
URIs <https://cloud.google.com/storage/docs/reference-uris>`__. A video
URI may include wildcards in ``object-id``, and thus identify multiple
videos. Supported wildcards: '\*' to match 0 or more characters; '?' to
match 1 character. If unset, the input video should be embedded in the
request as ``input_content``. If set, ``input_content`` should be unset.
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__. A
video URI may include wildcards in ``object-id``, and thus identify
multiple videos. Supported wildcards: '\*' to match 0 or more
characters; '?' to match 1 character. If unset, the input video should
be embedded in the request as ``input_content``. If set,
``input_content`` should be unset.
input_content (bytes): The video data bytes. If unset, the input video(s) should be specified
via ``input_uri``. If set, ``input_uri`` should be unset.
features (list[~google.cloud.videointelligence_v1beta2.types.Feature]): Required. Requested video annotation features.
Expand All @@ -252,7 +253,7 @@ def annotate_video(
must be specified in the following format: ``gs://bucket-id/object-id``
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
more information, see `Request
URIs <https://cloud.google.com/storage/docs/reference-uris>`__.
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__.
location_id (str): Optional. Cloud region where annotation should take place. Supported
cloud regions: ``us-east1``, ``us-west1``, ``europe-west1``,
``asia-east1``. If no region is specified, a region will be determined
Expand Down
Expand Up @@ -64,7 +64,7 @@ message AnnotateVideoRequest {
// supported, which must be specified in the following format:
// `gs://bucket-id/object-id` (other URI formats return
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
// more information, see [Request URIs](/storage/docs/reference-uris). A video
// more information, see [Request URIs](https://cloud.google.com/storage/docs/request-endpoints). A video
// URI may include wildcards in `object-id`, and thus identify multiple
// videos. Supported wildcards: '*' to match 0 or more characters;
// '?' to match 1 character. If unset, the input video should be embedded
Expand All @@ -87,7 +87,7 @@ message AnnotateVideoRequest {
// URIs are supported, which must be specified in the following format:
// `gs://bucket-id/object-id` (other URI formats return
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
// more information, see [Request URIs](/storage/docs/reference-uris).
// more information, see [Request URIs](https://cloud.google.com/storage/docs/request-endpoints).
string output_uri = 4 [(google.api.field_behavior) = OPTIONAL];

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -236,11 +236,12 @@ def annotate_video(
must be specified in the following format: ``gs://bucket-id/object-id``
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
more information, see `Request
URIs <https://cloud.google.com/storage/docs/reference-uris>`__. A video
URI may include wildcards in ``object-id``, and thus identify multiple
videos. Supported wildcards: '\*' to match 0 or more characters; '?' to
match 1 character. If unset, the input video should be embedded in the
request as ``input_content``. If set, ``input_content`` should be unset.
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__. A
video URI may include wildcards in ``object-id``, and thus identify
multiple videos. Supported wildcards: '\*' to match 0 or more
characters; '?' to match 1 character. If unset, the input video should
be embedded in the request as ``input_content``. If set,
``input_content`` should be unset.
input_content (bytes): The video data bytes. If unset, the input video(s) should be specified
via ``input_uri``. If set, ``input_uri`` should be unset.
features (list[~google.cloud.videointelligence_v1p1beta1.types.Feature]): Required. Requested video annotation features.
Expand All @@ -254,7 +255,7 @@ def annotate_video(
must be specified in the following format: ``gs://bucket-id/object-id``
(other URI formats return ``google.rpc.Code.INVALID_ARGUMENT``). For
more information, see `Request
URIs <https://cloud.google.com/storage/docs/reference-uris>`__.
URIs <https://cloud.google.com/storage/docs/request-endpoints>`__.
location_id (str): Optional. Cloud region where annotation should take place. Supported
cloud regions: ``us-east1``, ``us-west1``, ``europe-west1``,
``asia-east1``. If no region is specified, a region will be determined
Expand Down
Expand Up @@ -62,7 +62,7 @@ message AnnotateVideoRequest {
// supported, which must be specified in the following format:
// `gs://bucket-id/object-id` (other URI formats return
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see
// [Request URIs](/storage/docs/reference-uris).
// [Request URIs](https://cloud.google.com/storage/docs/request-endpoints).
// A video URI may include wildcards in `object-id`, and thus identify
// multiple videos. Supported wildcards: '*' to match 0 or more characters;
// '?' to match 1 character. If unset, the input video should be embedded
Expand All @@ -85,7 +85,7 @@ message AnnotateVideoRequest {
// URIs are supported, which must be specified in the following format:
// `gs://bucket-id/object-id` (other URI formats return
// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see
// [Request URIs](/storage/docs/reference-uris).
// [Request URIs](https://cloud.google.com/storage/docs/request-endpoints).
string output_uri = 4 [(google.api.field_behavior) = OPTIONAL];

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.