xref: /aosp_15_r20/external/googleapis/google/cloud/visionai/v1/annotations.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 Google LLC
2*d5c09012SAndroid Build Coastguard Worker//
3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*d5c09012SAndroid Build Coastguard Worker//
7*d5c09012SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*d5c09012SAndroid Build Coastguard Worker//
9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*d5c09012SAndroid Build Coastguard Worker// limitations under the License.
14*d5c09012SAndroid Build Coastguard Worker
15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
16*d5c09012SAndroid Build Coastguard Worker
17*d5c09012SAndroid Build Coastguard Workerpackage google.cloud.visionai.v1;
18*d5c09012SAndroid Build Coastguard Worker
19*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/struct.proto";
20*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/timestamp.proto";
21*d5c09012SAndroid Build Coastguard Worker
22*d5c09012SAndroid Build Coastguard Workeroption csharp_namespace = "Google.Cloud.VisionAI.V1";
23*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/visionai/apiv1/visionaipb;visionaipb";
24*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
25*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "AnnotationsProto";
26*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.cloud.visionai.v1";
27*d5c09012SAndroid Build Coastguard Workeroption php_namespace = "Google\\Cloud\\VisionAI\\V1";
28*d5c09012SAndroid Build Coastguard Workeroption ruby_package = "Google::Cloud::VisionAI::V1";
29*d5c09012SAndroid Build Coastguard Worker
30*d5c09012SAndroid Build Coastguard Worker// Enum describing all possible types of a stream annotation.
31*d5c09012SAndroid Build Coastguard Workerenum StreamAnnotationType {
32*d5c09012SAndroid Build Coastguard Worker  // Type UNSPECIFIED.
33*d5c09012SAndroid Build Coastguard Worker  STREAM_ANNOTATION_TYPE_UNSPECIFIED = 0;
34*d5c09012SAndroid Build Coastguard Worker
35*d5c09012SAndroid Build Coastguard Worker  // active_zone annotation defines a polygon on top of the content from an
36*d5c09012SAndroid Build Coastguard Worker  // image/video based stream, following processing will only focus on the
37*d5c09012SAndroid Build Coastguard Worker  // content inside the active zone.
38*d5c09012SAndroid Build Coastguard Worker  STREAM_ANNOTATION_TYPE_ACTIVE_ZONE = 1;
39*d5c09012SAndroid Build Coastguard Worker
40*d5c09012SAndroid Build Coastguard Worker  // crossing_line annotation defines a polyline on top of the content from an
41*d5c09012SAndroid Build Coastguard Worker  // image/video based Vision AI stream, events happening across the line will
42*d5c09012SAndroid Build Coastguard Worker  // be captured. For example, the counts of people who goes acroos the line
43*d5c09012SAndroid Build Coastguard Worker  // in Occupancy Analytic Processor.
44*d5c09012SAndroid Build Coastguard Worker  STREAM_ANNOTATION_TYPE_CROSSING_LINE = 2;
45*d5c09012SAndroid Build Coastguard Worker}
46*d5c09012SAndroid Build Coastguard Worker
47*d5c09012SAndroid Build Coastguard Worker// Output format for Personal Protective Equipment Detection Operator.
48*d5c09012SAndroid Build Coastguard Workermessage PersonalProtectiveEquipmentDetectionOutput {
49*d5c09012SAndroid Build Coastguard Worker  // The entity info for annotations from person detection prediction result.
50*d5c09012SAndroid Build Coastguard Worker  message PersonEntity {
51*d5c09012SAndroid Build Coastguard Worker    // Entity id.
52*d5c09012SAndroid Build Coastguard Worker    int64 person_entity_id = 1;
53*d5c09012SAndroid Build Coastguard Worker  }
54*d5c09012SAndroid Build Coastguard Worker
55*d5c09012SAndroid Build Coastguard Worker  // The entity info for annotations from PPE detection prediction result.
56*d5c09012SAndroid Build Coastguard Worker  message PPEEntity {
57*d5c09012SAndroid Build Coastguard Worker    // Label id.
58*d5c09012SAndroid Build Coastguard Worker    int64 ppe_label_id = 1;
59*d5c09012SAndroid Build Coastguard Worker
60*d5c09012SAndroid Build Coastguard Worker    // Human readable string of the label (Examples: helmet, glove, mask).
61*d5c09012SAndroid Build Coastguard Worker    string ppe_label_string = 2;
62*d5c09012SAndroid Build Coastguard Worker
63*d5c09012SAndroid Build Coastguard Worker    // Human readable string of the super category label (Examples: head_cover,
64*d5c09012SAndroid Build Coastguard Worker    // hands_cover, face_cover).
65*d5c09012SAndroid Build Coastguard Worker    string ppe_supercategory_label_string = 3;
66*d5c09012SAndroid Build Coastguard Worker
67*d5c09012SAndroid Build Coastguard Worker    // Entity id.
68*d5c09012SAndroid Build Coastguard Worker    int64 ppe_entity_id = 4;
69*d5c09012SAndroid Build Coastguard Worker  }
70*d5c09012SAndroid Build Coastguard Worker
71*d5c09012SAndroid Build Coastguard Worker  // Bounding Box in the normalized coordinates.
72*d5c09012SAndroid Build Coastguard Worker  message NormalizedBoundingBox {
73*d5c09012SAndroid Build Coastguard Worker    // Min in x coordinate.
74*d5c09012SAndroid Build Coastguard Worker    float xmin = 1;
75*d5c09012SAndroid Build Coastguard Worker
76*d5c09012SAndroid Build Coastguard Worker    // Min in y coordinate.
77*d5c09012SAndroid Build Coastguard Worker    float ymin = 2;
78*d5c09012SAndroid Build Coastguard Worker
79*d5c09012SAndroid Build Coastguard Worker    // Width of the bounding box.
80*d5c09012SAndroid Build Coastguard Worker    float width = 3;
81*d5c09012SAndroid Build Coastguard Worker
82*d5c09012SAndroid Build Coastguard Worker    // Height of the bounding box.
83*d5c09012SAndroid Build Coastguard Worker    float height = 4;
84*d5c09012SAndroid Build Coastguard Worker  }
85*d5c09012SAndroid Build Coastguard Worker
86*d5c09012SAndroid Build Coastguard Worker  // PersonIdentified box contains the location and the entity info of the
87*d5c09012SAndroid Build Coastguard Worker  // person.
88*d5c09012SAndroid Build Coastguard Worker  message PersonIdentifiedBox {
89*d5c09012SAndroid Build Coastguard Worker    // An unique id for this box.
90*d5c09012SAndroid Build Coastguard Worker    int64 box_id = 1;
91*d5c09012SAndroid Build Coastguard Worker
92*d5c09012SAndroid Build Coastguard Worker    // Bounding Box in the normalized coordinates.
93*d5c09012SAndroid Build Coastguard Worker    NormalizedBoundingBox normalized_bounding_box = 2;
94*d5c09012SAndroid Build Coastguard Worker
95*d5c09012SAndroid Build Coastguard Worker    // Confidence score associated with this box.
96*d5c09012SAndroid Build Coastguard Worker    float confidence_score = 3;
97*d5c09012SAndroid Build Coastguard Worker
98*d5c09012SAndroid Build Coastguard Worker    // Person entity info.
99*d5c09012SAndroid Build Coastguard Worker    PersonEntity person_entity = 4;
100*d5c09012SAndroid Build Coastguard Worker  }
101*d5c09012SAndroid Build Coastguard Worker
102*d5c09012SAndroid Build Coastguard Worker  // PPEIdentified box contains the location and the entity info of the PPE.
103*d5c09012SAndroid Build Coastguard Worker  message PPEIdentifiedBox {
104*d5c09012SAndroid Build Coastguard Worker    // An unique id for this box.
105*d5c09012SAndroid Build Coastguard Worker    int64 box_id = 1;
106*d5c09012SAndroid Build Coastguard Worker
107*d5c09012SAndroid Build Coastguard Worker    // Bounding Box in the normalized coordinates.
108*d5c09012SAndroid Build Coastguard Worker    NormalizedBoundingBox normalized_bounding_box = 2;
109*d5c09012SAndroid Build Coastguard Worker
110*d5c09012SAndroid Build Coastguard Worker    // Confidence score associated with this box.
111*d5c09012SAndroid Build Coastguard Worker    float confidence_score = 3;
112*d5c09012SAndroid Build Coastguard Worker
113*d5c09012SAndroid Build Coastguard Worker    // PPE entity info.
114*d5c09012SAndroid Build Coastguard Worker    PPEEntity ppe_entity = 4;
115*d5c09012SAndroid Build Coastguard Worker  }
116*d5c09012SAndroid Build Coastguard Worker
117*d5c09012SAndroid Build Coastguard Worker  // Detected Person contains the detected person and their associated
118*d5c09012SAndroid Build Coastguard Worker  // ppes and their protecting information.
119*d5c09012SAndroid Build Coastguard Worker  message DetectedPerson {
120*d5c09012SAndroid Build Coastguard Worker    // The id of detected person.
121*d5c09012SAndroid Build Coastguard Worker    int64 person_id = 1;
122*d5c09012SAndroid Build Coastguard Worker
123*d5c09012SAndroid Build Coastguard Worker    // The info of detected person identified box.
124*d5c09012SAndroid Build Coastguard Worker    PersonIdentifiedBox detected_person_identified_box = 2;
125*d5c09012SAndroid Build Coastguard Worker
126*d5c09012SAndroid Build Coastguard Worker    // The info of detected person associated ppe identified boxes.
127*d5c09012SAndroid Build Coastguard Worker    repeated PPEIdentifiedBox detected_ppe_identified_boxes = 3;
128*d5c09012SAndroid Build Coastguard Worker
129*d5c09012SAndroid Build Coastguard Worker    // Coverage score for each body part.
130*d5c09012SAndroid Build Coastguard Worker    // Coverage score for face.
131*d5c09012SAndroid Build Coastguard Worker    optional float face_coverage_score = 4;
132*d5c09012SAndroid Build Coastguard Worker
133*d5c09012SAndroid Build Coastguard Worker    // Coverage score for eyes.
134*d5c09012SAndroid Build Coastguard Worker    optional float eyes_coverage_score = 5;
135*d5c09012SAndroid Build Coastguard Worker
136*d5c09012SAndroid Build Coastguard Worker    // Coverage score for head.
137*d5c09012SAndroid Build Coastguard Worker    optional float head_coverage_score = 6;
138*d5c09012SAndroid Build Coastguard Worker
139*d5c09012SAndroid Build Coastguard Worker    // Coverage score for hands.
140*d5c09012SAndroid Build Coastguard Worker    optional float hands_coverage_score = 7;
141*d5c09012SAndroid Build Coastguard Worker
142*d5c09012SAndroid Build Coastguard Worker    // Coverage score for body.
143*d5c09012SAndroid Build Coastguard Worker    optional float body_coverage_score = 8;
144*d5c09012SAndroid Build Coastguard Worker
145*d5c09012SAndroid Build Coastguard Worker    // Coverage score for feet.
146*d5c09012SAndroid Build Coastguard Worker    optional float feet_coverage_score = 9;
147*d5c09012SAndroid Build Coastguard Worker  }
148*d5c09012SAndroid Build Coastguard Worker
149*d5c09012SAndroid Build Coastguard Worker  // Current timestamp.
150*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp current_time = 1;
151*d5c09012SAndroid Build Coastguard Worker
152*d5c09012SAndroid Build Coastguard Worker  // A list of DetectedPersons.
153*d5c09012SAndroid Build Coastguard Worker  repeated DetectedPerson detected_persons = 2;
154*d5c09012SAndroid Build Coastguard Worker}
155*d5c09012SAndroid Build Coastguard Worker
156*d5c09012SAndroid Build Coastguard Worker// Prediction output format for Generic Object Detection.
157*d5c09012SAndroid Build Coastguard Workermessage ObjectDetectionPredictionResult {
158*d5c09012SAndroid Build Coastguard Worker  // The entity info for annotations from object detection prediction result.
159*d5c09012SAndroid Build Coastguard Worker  message Entity {
160*d5c09012SAndroid Build Coastguard Worker    // Label id.
161*d5c09012SAndroid Build Coastguard Worker    int64 label_id = 1;
162*d5c09012SAndroid Build Coastguard Worker
163*d5c09012SAndroid Build Coastguard Worker    // Human readable string of the label.
164*d5c09012SAndroid Build Coastguard Worker    string label_string = 2;
165*d5c09012SAndroid Build Coastguard Worker  }
166*d5c09012SAndroid Build Coastguard Worker
167*d5c09012SAndroid Build Coastguard Worker  // Identified box contains location and the entity of the object.
168*d5c09012SAndroid Build Coastguard Worker  message IdentifiedBox {
169*d5c09012SAndroid Build Coastguard Worker    // Bounding Box in the normalized coordinates.
170*d5c09012SAndroid Build Coastguard Worker    message NormalizedBoundingBox {
171*d5c09012SAndroid Build Coastguard Worker      // Min in x coordinate.
172*d5c09012SAndroid Build Coastguard Worker      float xmin = 1;
173*d5c09012SAndroid Build Coastguard Worker
174*d5c09012SAndroid Build Coastguard Worker      // Min in y coordinate.
175*d5c09012SAndroid Build Coastguard Worker      float ymin = 2;
176*d5c09012SAndroid Build Coastguard Worker
177*d5c09012SAndroid Build Coastguard Worker      // Width of the bounding box.
178*d5c09012SAndroid Build Coastguard Worker      float width = 3;
179*d5c09012SAndroid Build Coastguard Worker
180*d5c09012SAndroid Build Coastguard Worker      // Height of the bounding box.
181*d5c09012SAndroid Build Coastguard Worker      float height = 4;
182*d5c09012SAndroid Build Coastguard Worker    }
183*d5c09012SAndroid Build Coastguard Worker
184*d5c09012SAndroid Build Coastguard Worker    // An unique id for this box.
185*d5c09012SAndroid Build Coastguard Worker    int64 box_id = 1;
186*d5c09012SAndroid Build Coastguard Worker
187*d5c09012SAndroid Build Coastguard Worker    // Bounding Box in the normalized coordinates.
188*d5c09012SAndroid Build Coastguard Worker    NormalizedBoundingBox normalized_bounding_box = 2;
189*d5c09012SAndroid Build Coastguard Worker
190*d5c09012SAndroid Build Coastguard Worker    // Confidence score associated with this box.
191*d5c09012SAndroid Build Coastguard Worker    float confidence_score = 3;
192*d5c09012SAndroid Build Coastguard Worker
193*d5c09012SAndroid Build Coastguard Worker    // Entity of this box.
194*d5c09012SAndroid Build Coastguard Worker    Entity entity = 4;
195*d5c09012SAndroid Build Coastguard Worker  }
196*d5c09012SAndroid Build Coastguard Worker
197*d5c09012SAndroid Build Coastguard Worker  // Current timestamp.
198*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp current_time = 1;
199*d5c09012SAndroid Build Coastguard Worker
200*d5c09012SAndroid Build Coastguard Worker  // A list of identified boxes.
201*d5c09012SAndroid Build Coastguard Worker  repeated IdentifiedBox identified_boxes = 2;
202*d5c09012SAndroid Build Coastguard Worker}
203*d5c09012SAndroid Build Coastguard Worker
204*d5c09012SAndroid Build Coastguard Worker// Prediction output format for Image Object Detection.
205*d5c09012SAndroid Build Coastguard Workermessage ImageObjectDetectionPredictionResult {
206*d5c09012SAndroid Build Coastguard Worker  // The resource IDs of the AnnotationSpecs that had been identified, ordered
207*d5c09012SAndroid Build Coastguard Worker  // by the confidence score descendingly. It is the id segment instead of full
208*d5c09012SAndroid Build Coastguard Worker  // resource name.
209*d5c09012SAndroid Build Coastguard Worker  repeated int64 ids = 1;
210*d5c09012SAndroid Build Coastguard Worker
211*d5c09012SAndroid Build Coastguard Worker  // The display names of the AnnotationSpecs that had been identified, order
212*d5c09012SAndroid Build Coastguard Worker  // matches the IDs.
213*d5c09012SAndroid Build Coastguard Worker  repeated string display_names = 2;
214*d5c09012SAndroid Build Coastguard Worker
215*d5c09012SAndroid Build Coastguard Worker  // The Model's confidences in correctness of the predicted IDs, higher value
216*d5c09012SAndroid Build Coastguard Worker  // means higher confidence. Order matches the Ids.
217*d5c09012SAndroid Build Coastguard Worker  repeated float confidences = 3;
218*d5c09012SAndroid Build Coastguard Worker
219*d5c09012SAndroid Build Coastguard Worker  // Bounding boxes, i.e. the rectangles over the image, that pinpoint
220*d5c09012SAndroid Build Coastguard Worker  // the found AnnotationSpecs. Given in order that matches the IDs. Each
221*d5c09012SAndroid Build Coastguard Worker  // bounding box is an array of 4 numbers `xMin`, `xMax`, `yMin`, and
222*d5c09012SAndroid Build Coastguard Worker  // `yMax`, which represent the extremal coordinates of the box. They are
223*d5c09012SAndroid Build Coastguard Worker  // relative to the image size, and the point 0,0 is in the top left
224*d5c09012SAndroid Build Coastguard Worker  // of the image.
225*d5c09012SAndroid Build Coastguard Worker  repeated google.protobuf.ListValue bboxes = 4;
226*d5c09012SAndroid Build Coastguard Worker}
227*d5c09012SAndroid Build Coastguard Worker
228*d5c09012SAndroid Build Coastguard Worker// Prediction output format for Image and Text Classification.
229*d5c09012SAndroid Build Coastguard Workermessage ClassificationPredictionResult {
230*d5c09012SAndroid Build Coastguard Worker  // The resource IDs of the AnnotationSpecs that had been identified.
231*d5c09012SAndroid Build Coastguard Worker  repeated int64 ids = 1;
232*d5c09012SAndroid Build Coastguard Worker
233*d5c09012SAndroid Build Coastguard Worker  // The display names of the AnnotationSpecs that had been identified, order
234*d5c09012SAndroid Build Coastguard Worker  // matches the IDs.
235*d5c09012SAndroid Build Coastguard Worker  repeated string display_names = 2;
236*d5c09012SAndroid Build Coastguard Worker
237*d5c09012SAndroid Build Coastguard Worker  // The Model's confidences in correctness of the predicted IDs, higher value
238*d5c09012SAndroid Build Coastguard Worker  // means higher confidence. Order matches the Ids.
239*d5c09012SAndroid Build Coastguard Worker  repeated float confidences = 3;
240*d5c09012SAndroid Build Coastguard Worker}
241*d5c09012SAndroid Build Coastguard Worker
242*d5c09012SAndroid Build Coastguard Worker// Prediction output format for Image Segmentation.
243*d5c09012SAndroid Build Coastguard Workermessage ImageSegmentationPredictionResult {
244*d5c09012SAndroid Build Coastguard Worker  // A PNG image where each pixel in the mask represents the category in which
245*d5c09012SAndroid Build Coastguard Worker  // the pixel in the original image was predicted to belong to. The size of
246*d5c09012SAndroid Build Coastguard Worker  // this image will be the same as the original image. The mapping between the
247*d5c09012SAndroid Build Coastguard Worker  // AnntoationSpec and the color can be found in model's metadata. The model
248*d5c09012SAndroid Build Coastguard Worker  // will choose the most likely category and if none of the categories reach
249*d5c09012SAndroid Build Coastguard Worker  // the confidence threshold, the pixel will be marked as background.
250*d5c09012SAndroid Build Coastguard Worker  string category_mask = 1;
251*d5c09012SAndroid Build Coastguard Worker
252*d5c09012SAndroid Build Coastguard Worker  // A one channel image which is encoded as an 8bit lossless PNG. The size of
253*d5c09012SAndroid Build Coastguard Worker  // the image will be the same as the original image. For a specific pixel,
254*d5c09012SAndroid Build Coastguard Worker  // darker color means less confidence in correctness of the cateogry in the
255*d5c09012SAndroid Build Coastguard Worker  // categoryMask for the corresponding pixel. Black means no confidence and
256*d5c09012SAndroid Build Coastguard Worker  // white means complete confidence.
257*d5c09012SAndroid Build Coastguard Worker  string confidence_mask = 2;
258*d5c09012SAndroid Build Coastguard Worker}
259*d5c09012SAndroid Build Coastguard Worker
260*d5c09012SAndroid Build Coastguard Worker// Prediction output format for Video Action Recognition.
261*d5c09012SAndroid Build Coastguard Workermessage VideoActionRecognitionPredictionResult {
262*d5c09012SAndroid Build Coastguard Worker  // Each IdentifiedAction is one particular identification of an action
263*d5c09012SAndroid Build Coastguard Worker  // specified with the AnnotationSpec id, display_name and the associated
264*d5c09012SAndroid Build Coastguard Worker  // confidence score.
265*d5c09012SAndroid Build Coastguard Worker  message IdentifiedAction {
266*d5c09012SAndroid Build Coastguard Worker    // The resource ID of the AnnotationSpec that had been identified.
267*d5c09012SAndroid Build Coastguard Worker    string id = 1;
268*d5c09012SAndroid Build Coastguard Worker
269*d5c09012SAndroid Build Coastguard Worker    // The display name of the AnnotationSpec that had been identified.
270*d5c09012SAndroid Build Coastguard Worker    string display_name = 2;
271*d5c09012SAndroid Build Coastguard Worker
272*d5c09012SAndroid Build Coastguard Worker    // The Model's confidence in correction of this identification, higher
273*d5c09012SAndroid Build Coastguard Worker    // value means higher confidence.
274*d5c09012SAndroid Build Coastguard Worker    float confidence = 3;
275*d5c09012SAndroid Build Coastguard Worker  }
276*d5c09012SAndroid Build Coastguard Worker
277*d5c09012SAndroid Build Coastguard Worker  // The beginning, inclusive, of the video's time segment in which the
278*d5c09012SAndroid Build Coastguard Worker  // actions have been identified.
279*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp segment_start_time = 1;
280*d5c09012SAndroid Build Coastguard Worker
281*d5c09012SAndroid Build Coastguard Worker  // The end, inclusive, of the video's time segment in which the actions have
282*d5c09012SAndroid Build Coastguard Worker  // been identified. Particularly, if the end is the same as the start, it
283*d5c09012SAndroid Build Coastguard Worker  // means the identification happens on a specific video frame.
284*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp segment_end_time = 2;
285*d5c09012SAndroid Build Coastguard Worker
286*d5c09012SAndroid Build Coastguard Worker  // All of the actions identified in the time range.
287*d5c09012SAndroid Build Coastguard Worker  repeated IdentifiedAction actions = 3;
288*d5c09012SAndroid Build Coastguard Worker}
289*d5c09012SAndroid Build Coastguard Worker
290*d5c09012SAndroid Build Coastguard Worker// Prediction output format for Video Object Tracking.
291*d5c09012SAndroid Build Coastguard Workermessage VideoObjectTrackingPredictionResult {
292*d5c09012SAndroid Build Coastguard Worker  // Boundingbox for detected object. I.e. the rectangle over the video frame
293*d5c09012SAndroid Build Coastguard Worker  // pinpointing the found AnnotationSpec. The coordinates are relative to the
294*d5c09012SAndroid Build Coastguard Worker  // frame size, and the point 0,0 is in the top left of the frame.
295*d5c09012SAndroid Build Coastguard Worker  message BoundingBox {
296*d5c09012SAndroid Build Coastguard Worker    // The leftmost coordinate of the bounding box.
297*d5c09012SAndroid Build Coastguard Worker    float x_min = 1;
298*d5c09012SAndroid Build Coastguard Worker
299*d5c09012SAndroid Build Coastguard Worker    // The rightmost coordinate of the bounding box.
300*d5c09012SAndroid Build Coastguard Worker    float x_max = 2;
301*d5c09012SAndroid Build Coastguard Worker
302*d5c09012SAndroid Build Coastguard Worker    // The topmost coordinate of the bounding box.
303*d5c09012SAndroid Build Coastguard Worker    float y_min = 3;
304*d5c09012SAndroid Build Coastguard Worker
305*d5c09012SAndroid Build Coastguard Worker    // The bottommost coordinate of the bounding box.
306*d5c09012SAndroid Build Coastguard Worker    float y_max = 4;
307*d5c09012SAndroid Build Coastguard Worker  }
308*d5c09012SAndroid Build Coastguard Worker
309*d5c09012SAndroid Build Coastguard Worker  // Each DetectedObject is one particular identification of an object
310*d5c09012SAndroid Build Coastguard Worker  // specified with the AnnotationSpec id and display_name, the bounding box,
311*d5c09012SAndroid Build Coastguard Worker  // the associated confidence score and the corresponding track_id.
312*d5c09012SAndroid Build Coastguard Worker  message DetectedObject {
313*d5c09012SAndroid Build Coastguard Worker    // The resource ID of the AnnotationSpec that had been identified.
314*d5c09012SAndroid Build Coastguard Worker    string id = 1;
315*d5c09012SAndroid Build Coastguard Worker
316*d5c09012SAndroid Build Coastguard Worker    // The display name of the AnnotationSpec that had been identified.
317*d5c09012SAndroid Build Coastguard Worker    string display_name = 2;
318*d5c09012SAndroid Build Coastguard Worker
319*d5c09012SAndroid Build Coastguard Worker    // Boundingbox.
320*d5c09012SAndroid Build Coastguard Worker    BoundingBox bounding_box = 3;
321*d5c09012SAndroid Build Coastguard Worker
322*d5c09012SAndroid Build Coastguard Worker    // The Model's confidence in correction of this identification, higher
323*d5c09012SAndroid Build Coastguard Worker    // value means higher confidence.
324*d5c09012SAndroid Build Coastguard Worker    float confidence = 4;
325*d5c09012SAndroid Build Coastguard Worker
326*d5c09012SAndroid Build Coastguard Worker    // The same object may be identified on muitiple frames which are typical
327*d5c09012SAndroid Build Coastguard Worker    // adjacent. The set of frames where a particular object has been detected
328*d5c09012SAndroid Build Coastguard Worker    // form a track. This track_id can be used to trace down all frames for an
329*d5c09012SAndroid Build Coastguard Worker    // detected object.
330*d5c09012SAndroid Build Coastguard Worker    int64 track_id = 5;
331*d5c09012SAndroid Build Coastguard Worker  }
332*d5c09012SAndroid Build Coastguard Worker
333*d5c09012SAndroid Build Coastguard Worker  // The beginning, inclusive, of the video's time segment in which the
334*d5c09012SAndroid Build Coastguard Worker  // current identifications happens.
335*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp segment_start_time = 1;
336*d5c09012SAndroid Build Coastguard Worker
337*d5c09012SAndroid Build Coastguard Worker  // The end, inclusive, of the video's time segment in which the current
338*d5c09012SAndroid Build Coastguard Worker  // identifications happen. Particularly, if the end is the same as the start,
339*d5c09012SAndroid Build Coastguard Worker  // it means the identifications happen on a specific video frame.
340*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp segment_end_time = 2;
341*d5c09012SAndroid Build Coastguard Worker
342*d5c09012SAndroid Build Coastguard Worker  // All of the objects detected in the specified time range.
343*d5c09012SAndroid Build Coastguard Worker  repeated DetectedObject objects = 3;
344*d5c09012SAndroid Build Coastguard Worker}
345*d5c09012SAndroid Build Coastguard Worker
346*d5c09012SAndroid Build Coastguard Worker// Prediction output format for Video Classification.
347*d5c09012SAndroid Build Coastguard Workermessage VideoClassificationPredictionResult {
348*d5c09012SAndroid Build Coastguard Worker  // Each IdentifiedClassification is one particular identification of an
349*d5c09012SAndroid Build Coastguard Worker  // classification specified with the AnnotationSpec id and display_name,
350*d5c09012SAndroid Build Coastguard Worker  // and the associated confidence score.
351*d5c09012SAndroid Build Coastguard Worker  message IdentifiedClassification {
352*d5c09012SAndroid Build Coastguard Worker    // The resource ID of the AnnotationSpec that had been identified.
353*d5c09012SAndroid Build Coastguard Worker    string id = 1;
354*d5c09012SAndroid Build Coastguard Worker
355*d5c09012SAndroid Build Coastguard Worker    // The display name of the AnnotationSpec that had been identified.
356*d5c09012SAndroid Build Coastguard Worker    string display_name = 2;
357*d5c09012SAndroid Build Coastguard Worker
358*d5c09012SAndroid Build Coastguard Worker    // The Model's confidence in correction of this identification, higher
359*d5c09012SAndroid Build Coastguard Worker    // value means higher confidence.
360*d5c09012SAndroid Build Coastguard Worker    float confidence = 3;
361*d5c09012SAndroid Build Coastguard Worker  }
362*d5c09012SAndroid Build Coastguard Worker
363*d5c09012SAndroid Build Coastguard Worker  // The beginning, inclusive, of the video's time segment in which the
364*d5c09012SAndroid Build Coastguard Worker  // classifications have been identified.
365*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp segment_start_time = 1;
366*d5c09012SAndroid Build Coastguard Worker
367*d5c09012SAndroid Build Coastguard Worker  // The end, inclusive, of the video's time segment in which the
368*d5c09012SAndroid Build Coastguard Worker  // classifications have been identified. Particularly, if the end is the same
369*d5c09012SAndroid Build Coastguard Worker  // as the start, it means the identification happens on a specific video
370*d5c09012SAndroid Build Coastguard Worker  // frame.
371*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp segment_end_time = 2;
372*d5c09012SAndroid Build Coastguard Worker
373*d5c09012SAndroid Build Coastguard Worker  // All of the classifications identified in the time range.
374*d5c09012SAndroid Build Coastguard Worker  repeated IdentifiedClassification classifications = 3;
375*d5c09012SAndroid Build Coastguard Worker}
376*d5c09012SAndroid Build Coastguard Worker
377*d5c09012SAndroid Build Coastguard Worker// The prediction result proto for occupancy counting.
378*d5c09012SAndroid Build Coastguard Workermessage OccupancyCountingPredictionResult {
379*d5c09012SAndroid Build Coastguard Worker  // The entity info for annotations from occupancy counting operator.
380*d5c09012SAndroid Build Coastguard Worker  message Entity {
381*d5c09012SAndroid Build Coastguard Worker    // Label id.
382*d5c09012SAndroid Build Coastguard Worker    int64 label_id = 1;
383*d5c09012SAndroid Build Coastguard Worker
384*d5c09012SAndroid Build Coastguard Worker    // Human readable string of the label.
385*d5c09012SAndroid Build Coastguard Worker    string label_string = 2;
386*d5c09012SAndroid Build Coastguard Worker  }
387*d5c09012SAndroid Build Coastguard Worker
388*d5c09012SAndroid Build Coastguard Worker  // Identified box contains location and the entity of the object.
389*d5c09012SAndroid Build Coastguard Worker  message IdentifiedBox {
390*d5c09012SAndroid Build Coastguard Worker    // Bounding Box in the normalized coordinates.
391*d5c09012SAndroid Build Coastguard Worker    message NormalizedBoundingBox {
392*d5c09012SAndroid Build Coastguard Worker      // Min in x coordinate.
393*d5c09012SAndroid Build Coastguard Worker      float xmin = 1;
394*d5c09012SAndroid Build Coastguard Worker
395*d5c09012SAndroid Build Coastguard Worker      // Min in y coordinate.
396*d5c09012SAndroid Build Coastguard Worker      float ymin = 2;
397*d5c09012SAndroid Build Coastguard Worker
398*d5c09012SAndroid Build Coastguard Worker      // Width of the bounding box.
399*d5c09012SAndroid Build Coastguard Worker      float width = 3;
400*d5c09012SAndroid Build Coastguard Worker
401*d5c09012SAndroid Build Coastguard Worker      // Height of the bounding box.
402*d5c09012SAndroid Build Coastguard Worker      float height = 4;
403*d5c09012SAndroid Build Coastguard Worker    }
404*d5c09012SAndroid Build Coastguard Worker
405*d5c09012SAndroid Build Coastguard Worker    // An unique id for this box.
406*d5c09012SAndroid Build Coastguard Worker    int64 box_id = 1;
407*d5c09012SAndroid Build Coastguard Worker
408*d5c09012SAndroid Build Coastguard Worker    // Bounding Box in the normalized coordinates.
409*d5c09012SAndroid Build Coastguard Worker    NormalizedBoundingBox normalized_bounding_box = 2;
410*d5c09012SAndroid Build Coastguard Worker
411*d5c09012SAndroid Build Coastguard Worker    // Confidence score associated with this box.
412*d5c09012SAndroid Build Coastguard Worker    float score = 3;
413*d5c09012SAndroid Build Coastguard Worker
414*d5c09012SAndroid Build Coastguard Worker    // Entity of this box.
415*d5c09012SAndroid Build Coastguard Worker    Entity entity = 4;
416*d5c09012SAndroid Build Coastguard Worker
417*d5c09012SAndroid Build Coastguard Worker    // An unique id to identify a track. It should be consistent across frames.
418*d5c09012SAndroid Build Coastguard Worker    // It only exists if tracking is enabled.
419*d5c09012SAndroid Build Coastguard Worker    int64 track_id = 5;
420*d5c09012SAndroid Build Coastguard Worker  }
421*d5c09012SAndroid Build Coastguard Worker
422*d5c09012SAndroid Build Coastguard Worker  // The statistics info for annotations from occupancy counting operator.
423*d5c09012SAndroid Build Coastguard Worker  message Stats {
424*d5c09012SAndroid Build Coastguard Worker    // The object info and instant count for annotations from occupancy counting
425*d5c09012SAndroid Build Coastguard Worker    // operator.
426*d5c09012SAndroid Build Coastguard Worker    message ObjectCount {
427*d5c09012SAndroid Build Coastguard Worker      // Entity of this object.
428*d5c09012SAndroid Build Coastguard Worker      Entity entity = 1;
429*d5c09012SAndroid Build Coastguard Worker
430*d5c09012SAndroid Build Coastguard Worker      // Count of the object.
431*d5c09012SAndroid Build Coastguard Worker      int32 count = 2;
432*d5c09012SAndroid Build Coastguard Worker    }
433*d5c09012SAndroid Build Coastguard Worker
434*d5c09012SAndroid Build Coastguard Worker    // The object info and accumulated count for annotations from occupancy
435*d5c09012SAndroid Build Coastguard Worker    // counting operator.
436*d5c09012SAndroid Build Coastguard Worker    message AccumulatedObjectCount {
437*d5c09012SAndroid Build Coastguard Worker      // The start time of the accumulated count.
438*d5c09012SAndroid Build Coastguard Worker      google.protobuf.Timestamp start_time = 1;
439*d5c09012SAndroid Build Coastguard Worker
440*d5c09012SAndroid Build Coastguard Worker      // The object count for the accumulated count.
441*d5c09012SAndroid Build Coastguard Worker      ObjectCount object_count = 2;
442*d5c09012SAndroid Build Coastguard Worker    }
443*d5c09012SAndroid Build Coastguard Worker
444*d5c09012SAndroid Build Coastguard Worker    // Message for Crossing line count.
445*d5c09012SAndroid Build Coastguard Worker    message CrossingLineCount {
446*d5c09012SAndroid Build Coastguard Worker      // Line annotation from the user.
447*d5c09012SAndroid Build Coastguard Worker      StreamAnnotation annotation = 1;
448*d5c09012SAndroid Build Coastguard Worker
449*d5c09012SAndroid Build Coastguard Worker      // The direction that follows the right hand rule.
450*d5c09012SAndroid Build Coastguard Worker      repeated ObjectCount positive_direction_counts = 2;
451*d5c09012SAndroid Build Coastguard Worker
452*d5c09012SAndroid Build Coastguard Worker      // The direction that is opposite to the right hand rule.
453*d5c09012SAndroid Build Coastguard Worker      repeated ObjectCount negative_direction_counts = 3;
454*d5c09012SAndroid Build Coastguard Worker
455*d5c09012SAndroid Build Coastguard Worker      // The accumulated positive count.
456*d5c09012SAndroid Build Coastguard Worker      repeated AccumulatedObjectCount accumulated_positive_direction_counts = 4;
457*d5c09012SAndroid Build Coastguard Worker
458*d5c09012SAndroid Build Coastguard Worker      // The accumulated negative count.
459*d5c09012SAndroid Build Coastguard Worker      repeated AccumulatedObjectCount accumulated_negative_direction_counts = 5;
460*d5c09012SAndroid Build Coastguard Worker    }
461*d5c09012SAndroid Build Coastguard Worker
462*d5c09012SAndroid Build Coastguard Worker    // Message for the active zone count.
463*d5c09012SAndroid Build Coastguard Worker    message ActiveZoneCount {
464*d5c09012SAndroid Build Coastguard Worker      // Active zone annotation from the user.
465*d5c09012SAndroid Build Coastguard Worker      StreamAnnotation annotation = 1;
466*d5c09012SAndroid Build Coastguard Worker
467*d5c09012SAndroid Build Coastguard Worker      // Counts in the zone.
468*d5c09012SAndroid Build Coastguard Worker      repeated ObjectCount counts = 2;
469*d5c09012SAndroid Build Coastguard Worker    }
470*d5c09012SAndroid Build Coastguard Worker
471*d5c09012SAndroid Build Coastguard Worker    // Counts of the full frame.
472*d5c09012SAndroid Build Coastguard Worker    repeated ObjectCount full_frame_count = 1;
473*d5c09012SAndroid Build Coastguard Worker
474*d5c09012SAndroid Build Coastguard Worker    // Crossing line counts.
475*d5c09012SAndroid Build Coastguard Worker    repeated CrossingLineCount crossing_line_counts = 2;
476*d5c09012SAndroid Build Coastguard Worker
477*d5c09012SAndroid Build Coastguard Worker    // Active zone counts.
478*d5c09012SAndroid Build Coastguard Worker    repeated ActiveZoneCount active_zone_counts = 3;
479*d5c09012SAndroid Build Coastguard Worker  }
480*d5c09012SAndroid Build Coastguard Worker
481*d5c09012SAndroid Build Coastguard Worker  // The track info for annotations from occupancy counting operator.
482*d5c09012SAndroid Build Coastguard Worker  message TrackInfo {
483*d5c09012SAndroid Build Coastguard Worker    // An unique id to identify a track. It should be consistent across frames.
484*d5c09012SAndroid Build Coastguard Worker    string track_id = 1;
485*d5c09012SAndroid Build Coastguard Worker
486*d5c09012SAndroid Build Coastguard Worker    // Start timestamp of this track.
487*d5c09012SAndroid Build Coastguard Worker    google.protobuf.Timestamp start_time = 2;
488*d5c09012SAndroid Build Coastguard Worker  }
489*d5c09012SAndroid Build Coastguard Worker
490*d5c09012SAndroid Build Coastguard Worker  // The dwell time info for annotations from occupancy counting operator.
491*d5c09012SAndroid Build Coastguard Worker  message DwellTimeInfo {
492*d5c09012SAndroid Build Coastguard Worker    // An unique id to identify a track. It should be consistent across frames.
493*d5c09012SAndroid Build Coastguard Worker    string track_id = 1;
494*d5c09012SAndroid Build Coastguard Worker
495*d5c09012SAndroid Build Coastguard Worker    // The unique id for the zone in which the object is dwelling/waiting.
496*d5c09012SAndroid Build Coastguard Worker    string zone_id = 2;
497*d5c09012SAndroid Build Coastguard Worker
498*d5c09012SAndroid Build Coastguard Worker    // The beginning time when a dwelling object has been identified in a zone.
499*d5c09012SAndroid Build Coastguard Worker    google.protobuf.Timestamp dwell_start_time = 3;
500*d5c09012SAndroid Build Coastguard Worker
501*d5c09012SAndroid Build Coastguard Worker    // The end time when a dwelling object has exited in a zone.
502*d5c09012SAndroid Build Coastguard Worker    google.protobuf.Timestamp dwell_end_time = 4;
503*d5c09012SAndroid Build Coastguard Worker  }
504*d5c09012SAndroid Build Coastguard Worker
505*d5c09012SAndroid Build Coastguard Worker  // Current timestamp.
506*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp current_time = 1;
507*d5c09012SAndroid Build Coastguard Worker
508*d5c09012SAndroid Build Coastguard Worker  // A list of identified boxes.
509*d5c09012SAndroid Build Coastguard Worker  repeated IdentifiedBox identified_boxes = 2;
510*d5c09012SAndroid Build Coastguard Worker
511*d5c09012SAndroid Build Coastguard Worker  // Detection statistics.
512*d5c09012SAndroid Build Coastguard Worker  Stats stats = 3;
513*d5c09012SAndroid Build Coastguard Worker
514*d5c09012SAndroid Build Coastguard Worker  // Track related information. All the tracks that are live at this timestamp.
515*d5c09012SAndroid Build Coastguard Worker  // It only exists if tracking is enabled.
516*d5c09012SAndroid Build Coastguard Worker  repeated TrackInfo track_info = 4;
517*d5c09012SAndroid Build Coastguard Worker
518*d5c09012SAndroid Build Coastguard Worker  // Dwell time related information. All the tracks that are live in a given
519*d5c09012SAndroid Build Coastguard Worker  // zone with a start and end dwell time timestamp
520*d5c09012SAndroid Build Coastguard Worker  repeated DwellTimeInfo dwell_time_info = 5;
521*d5c09012SAndroid Build Coastguard Worker
522*d5c09012SAndroid Build Coastguard Worker  // The presentation timestamp of the frame.
523*d5c09012SAndroid Build Coastguard Worker  optional int64 pts = 6;
524*d5c09012SAndroid Build Coastguard Worker}
525*d5c09012SAndroid Build Coastguard Worker
526*d5c09012SAndroid Build Coastguard Worker// message about annotations about Vision AI stream resource.
527*d5c09012SAndroid Build Coastguard Workermessage StreamAnnotation {
528*d5c09012SAndroid Build Coastguard Worker  oneof annotation_payload {
529*d5c09012SAndroid Build Coastguard Worker    // Annotation for type ACTIVE_ZONE
530*d5c09012SAndroid Build Coastguard Worker    NormalizedPolygon active_zone = 5;
531*d5c09012SAndroid Build Coastguard Worker
532*d5c09012SAndroid Build Coastguard Worker    // Annotation for type CROSSING_LINE
533*d5c09012SAndroid Build Coastguard Worker    NormalizedPolyline crossing_line = 6;
534*d5c09012SAndroid Build Coastguard Worker  }
535*d5c09012SAndroid Build Coastguard Worker
536*d5c09012SAndroid Build Coastguard Worker  // ID of the annotation. It must be unique when used in the certain context.
537*d5c09012SAndroid Build Coastguard Worker  // For example, all the annotations to one input streams of a Vision AI
538*d5c09012SAndroid Build Coastguard Worker  // application.
539*d5c09012SAndroid Build Coastguard Worker  string id = 1;
540*d5c09012SAndroid Build Coastguard Worker
541*d5c09012SAndroid Build Coastguard Worker  // User-friendly name for the annotation.
542*d5c09012SAndroid Build Coastguard Worker  string display_name = 2;
543*d5c09012SAndroid Build Coastguard Worker
544*d5c09012SAndroid Build Coastguard Worker  // The Vision AI stream resource name.
545*d5c09012SAndroid Build Coastguard Worker  string source_stream = 3;
546*d5c09012SAndroid Build Coastguard Worker
547*d5c09012SAndroid Build Coastguard Worker  // The actual type of Annotation.
548*d5c09012SAndroid Build Coastguard Worker  StreamAnnotationType type = 4;
549*d5c09012SAndroid Build Coastguard Worker}
550*d5c09012SAndroid Build Coastguard Worker
551*d5c09012SAndroid Build Coastguard Worker// A wrapper of repeated StreamAnnotation.
552*d5c09012SAndroid Build Coastguard Workermessage StreamAnnotations {
553*d5c09012SAndroid Build Coastguard Worker  // Multiple annotations.
554*d5c09012SAndroid Build Coastguard Worker  repeated StreamAnnotation stream_annotations = 1;
555*d5c09012SAndroid Build Coastguard Worker}
556*d5c09012SAndroid Build Coastguard Worker
557*d5c09012SAndroid Build Coastguard Worker// Normalized Polygon.
558*d5c09012SAndroid Build Coastguard Workermessage NormalizedPolygon {
559*d5c09012SAndroid Build Coastguard Worker  // The bounding polygon normalized vertices. Top left corner of the image
560*d5c09012SAndroid Build Coastguard Worker  // will be [0, 0].
561*d5c09012SAndroid Build Coastguard Worker  repeated NormalizedVertex normalized_vertices = 1;
562*d5c09012SAndroid Build Coastguard Worker}
563*d5c09012SAndroid Build Coastguard Worker
564*d5c09012SAndroid Build Coastguard Worker// Normalized Pplyline, which represents a curve consisting of connected
565*d5c09012SAndroid Build Coastguard Worker// straight-line segments.
566*d5c09012SAndroid Build Coastguard Workermessage NormalizedPolyline {
567*d5c09012SAndroid Build Coastguard Worker  // A sequence of vertices connected by straight lines.
568*d5c09012SAndroid Build Coastguard Worker  repeated NormalizedVertex normalized_vertices = 1;
569*d5c09012SAndroid Build Coastguard Worker}
570*d5c09012SAndroid Build Coastguard Worker
571*d5c09012SAndroid Build Coastguard Worker// A vertex represents a 2D point in the image.
572*d5c09012SAndroid Build Coastguard Worker// NOTE: the normalized vertex coordinates are relative to the original image
573*d5c09012SAndroid Build Coastguard Worker// and range from 0 to 1.
574*d5c09012SAndroid Build Coastguard Workermessage NormalizedVertex {
575*d5c09012SAndroid Build Coastguard Worker  // X coordinate.
576*d5c09012SAndroid Build Coastguard Worker  float x = 1;
577*d5c09012SAndroid Build Coastguard Worker
578*d5c09012SAndroid Build Coastguard Worker  // Y coordinate.
579*d5c09012SAndroid Build Coastguard Worker  float y = 2;
580*d5c09012SAndroid Build Coastguard Worker}
581*d5c09012SAndroid Build Coastguard Worker
582*d5c09012SAndroid Build Coastguard Worker// Message of essential metadata of App Platform.
583*d5c09012SAndroid Build Coastguard Worker// This message is usually attached to a certain processor output annotation for
584*d5c09012SAndroid Build Coastguard Worker// customer to identify the source of the data.
585*d5c09012SAndroid Build Coastguard Workermessage AppPlatformMetadata {
586*d5c09012SAndroid Build Coastguard Worker  // The application resource name.
587*d5c09012SAndroid Build Coastguard Worker  string application = 1;
588*d5c09012SAndroid Build Coastguard Worker
589*d5c09012SAndroid Build Coastguard Worker  // The instance resource id. Instance is the nested resource of application
590*d5c09012SAndroid Build Coastguard Worker  // under collection 'instances'.
591*d5c09012SAndroid Build Coastguard Worker  string instance_id = 2;
592*d5c09012SAndroid Build Coastguard Worker
593*d5c09012SAndroid Build Coastguard Worker  // The node name of the application graph.
594*d5c09012SAndroid Build Coastguard Worker  string node = 3;
595*d5c09012SAndroid Build Coastguard Worker
596*d5c09012SAndroid Build Coastguard Worker  // The referred processor resource name of the application node.
597*d5c09012SAndroid Build Coastguard Worker  string processor = 4;
598*d5c09012SAndroid Build Coastguard Worker}
599*d5c09012SAndroid Build Coastguard Worker
600*d5c09012SAndroid Build Coastguard Worker// For any cloud function based customer processing logic, customer's cloud
601*d5c09012SAndroid Build Coastguard Worker// function is expected to receive AppPlatformCloudFunctionRequest as request
602*d5c09012SAndroid Build Coastguard Worker// and send back AppPlatformCloudFunctionResponse as response.
603*d5c09012SAndroid Build Coastguard Worker// Message of request from AppPlatform to Cloud Function.
604*d5c09012SAndroid Build Coastguard Workermessage AppPlatformCloudFunctionRequest {
605*d5c09012SAndroid Build Coastguard Worker  // A general annotation message that uses struct format to represent different
606*d5c09012SAndroid Build Coastguard Worker  // concrete annotation protobufs.
607*d5c09012SAndroid Build Coastguard Worker  message StructedInputAnnotation {
608*d5c09012SAndroid Build Coastguard Worker    // The ingestion time of the current annotation.
609*d5c09012SAndroid Build Coastguard Worker    int64 ingestion_time_micros = 1;
610*d5c09012SAndroid Build Coastguard Worker
611*d5c09012SAndroid Build Coastguard Worker    // The struct format of the actual annotation.
612*d5c09012SAndroid Build Coastguard Worker    google.protobuf.Struct annotation = 2;
613*d5c09012SAndroid Build Coastguard Worker  }
614*d5c09012SAndroid Build Coastguard Worker
615*d5c09012SAndroid Build Coastguard Worker  // The metadata of the AppPlatform for customer to identify the source of the
616*d5c09012SAndroid Build Coastguard Worker  // payload.
617*d5c09012SAndroid Build Coastguard Worker  AppPlatformMetadata app_platform_metadata = 1;
618*d5c09012SAndroid Build Coastguard Worker
619*d5c09012SAndroid Build Coastguard Worker  // The actual annotations to be processed by the customized Cloud Function.
620*d5c09012SAndroid Build Coastguard Worker  repeated StructedInputAnnotation annotations = 2;
621*d5c09012SAndroid Build Coastguard Worker}
622*d5c09012SAndroid Build Coastguard Worker
623*d5c09012SAndroid Build Coastguard Worker// Message of the response from customer's Cloud Function to AppPlatform.
624*d5c09012SAndroid Build Coastguard Workermessage AppPlatformCloudFunctionResponse {
625*d5c09012SAndroid Build Coastguard Worker  // A general annotation message that uses struct format to represent different
626*d5c09012SAndroid Build Coastguard Worker  // concrete annotation protobufs.
627*d5c09012SAndroid Build Coastguard Worker  message StructedOutputAnnotation {
628*d5c09012SAndroid Build Coastguard Worker    // The struct format of the actual annotation.
629*d5c09012SAndroid Build Coastguard Worker    google.protobuf.Struct annotation = 1;
630*d5c09012SAndroid Build Coastguard Worker  }
631*d5c09012SAndroid Build Coastguard Worker
632*d5c09012SAndroid Build Coastguard Worker  // The modified annotations that is returned back to AppPlatform.
633*d5c09012SAndroid Build Coastguard Worker  // If the annotations fields are empty, then those annotations will be dropped
634*d5c09012SAndroid Build Coastguard Worker  // by AppPlatform.
635*d5c09012SAndroid Build Coastguard Worker  repeated StructedOutputAnnotation annotations = 2;
636*d5c09012SAndroid Build Coastguard Worker
637*d5c09012SAndroid Build Coastguard Worker  // If set to true, AppPlatform will use original annotations instead of
638*d5c09012SAndroid Build Coastguard Worker  // dropping them, even if it is empty in the annotations filed.
639*d5c09012SAndroid Build Coastguard Worker  bool annotation_passthrough = 3;
640*d5c09012SAndroid Build Coastguard Worker
641*d5c09012SAndroid Build Coastguard Worker  // The event notifications that is returned back to AppPlatform. Typically it
642*d5c09012SAndroid Build Coastguard Worker  // will then be configured to be consumed/forwared to a operator that handles
643*d5c09012SAndroid Build Coastguard Worker  // events, such as Pub/Sub operator.
644*d5c09012SAndroid Build Coastguard Worker  repeated AppPlatformEventBody events = 4;
645*d5c09012SAndroid Build Coastguard Worker}
646*d5c09012SAndroid Build Coastguard Worker
647*d5c09012SAndroid Build Coastguard Worker// Message of content of appPlatform event
648*d5c09012SAndroid Build Coastguard Workermessage AppPlatformEventBody {
649*d5c09012SAndroid Build Coastguard Worker  // Human readable string of the event like "There are more than 6 people in
650*d5c09012SAndroid Build Coastguard Worker  // the scene". or "Shelf is empty!".
651*d5c09012SAndroid Build Coastguard Worker  string event_message = 1;
652*d5c09012SAndroid Build Coastguard Worker
653*d5c09012SAndroid Build Coastguard Worker  // For the case of Pub/Sub, it will be stored in the message attributes.
654*d5c09012SAndroid Build Coastguard Worker  // ​​pubsub.proto
655*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Struct payload = 2;
656*d5c09012SAndroid Build Coastguard Worker
657*d5c09012SAndroid Build Coastguard Worker  // User defined Event Id, used to classify event, within a delivery interval,
658*d5c09012SAndroid Build Coastguard Worker  // events from the same application instance with the same id will be
659*d5c09012SAndroid Build Coastguard Worker  // de-duplicated & only first one will be sent out. Empty event_id will be
660*d5c09012SAndroid Build Coastguard Worker  // treated as "".
661*d5c09012SAndroid Build Coastguard Worker  string event_id = 3;
662*d5c09012SAndroid Build Coastguard Worker}
663