Skip to content

Commit

Permalink
feat: expose logo recognition API proto for GA (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored Mar 18, 2020
1 parent 6bb7a87 commit 3613bc1
Show file tree
Hide file tree
Showing 6 changed files with 2,394 additions and 221 deletions.
Original file line number Diff line number Diff line change
@@ -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 @@ -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;
}
Loading

0 comments on commit 3613bc1

Please sign in to comment.