1// Copyright 2021 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 15syntax = "proto3"; 16 17package google.cloud.aiplatform.v1beta1.schema; 18 19import "google/cloud/aiplatform/v1beta1/schema/annotation_spec_color.proto"; 20import "google/cloud/aiplatform/v1beta1/schema/geometry.proto"; 21import "google/protobuf/duration.proto"; 22 23option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1.Schema"; 24option go_package = "cloud.google.com/go/aiplatform/apiv1beta1/schema/schemapb;schemapb"; 25option java_multiple_files = true; 26option java_outer_classname = "AnnotationPayloadProto"; 27option java_package = "com.google.cloud.aiplatform.v1beta1.schema"; 28option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1\\Schema"; 29option ruby_package = "Google::Cloud::AIPlatform::V1beta1::Schema"; 30 31// Annotation details specific to image classification. 32message ImageClassificationAnnotation { 33 // The resource Id of the AnnotationSpec that this Annotation pertains to. 34 string annotation_spec_id = 1; 35 36 // The display name of the AnnotationSpec that this Annotation pertains to. 37 string display_name = 2; 38} 39 40// Annotation details specific to image object detection. 41message ImageBoundingBoxAnnotation { 42 // The resource Id of the AnnotationSpec that this Annotation pertains to. 43 string annotation_spec_id = 1; 44 45 // The display name of the AnnotationSpec that this Annotation pertains to. 46 string display_name = 2; 47 48 // The leftmost coordinate of the bounding box. 49 double x_min = 3; 50 51 // The rightmost coordinate of the bounding box. 52 double x_max = 4; 53 54 // The topmost coordinate of the bounding box. 55 double y_min = 5; 56 57 // The bottommost coordinate of the bounding box. 58 double y_max = 6; 59} 60 61// Annotation details specific to image segmentation. 62message ImageSegmentationAnnotation { 63 // The mask based segmentation annotation. 64 message MaskAnnotation { 65 // Google Cloud Storage URI that points to the mask image. The image must be 66 // in PNG format. It must have the same size as the DataItem's image. Each 67 // pixel in the image mask represents the AnnotationSpec which the pixel in 68 // the image DataItem belong to. Each color is mapped to one AnnotationSpec 69 // based on annotation_spec_colors. 70 string mask_gcs_uri = 1; 71 72 // The mapping between color and AnnotationSpec for this Annotation. 73 repeated AnnotationSpecColor annotation_spec_colors = 2; 74 } 75 76 // Represents a polygon in image. 77 message PolygonAnnotation { 78 // The vertexes are connected one by one and the last vertex is connected to 79 // the first one to represent a polygon. 80 repeated Vertex vertexes = 1; 81 82 // The resource Id of the AnnotationSpec that this Annotation pertains to. 83 string annotation_spec_id = 2; 84 85 // The display name of the AnnotationSpec that this Annotation pertains to. 86 string display_name = 3; 87 } 88 89 // Represents a polyline in image. 90 message PolylineAnnotation { 91 // The vertexes are connected one by one and the last vertex in not 92 // connected to the first one. 93 repeated Vertex vertexes = 1; 94 95 // The resource Id of the AnnotationSpec that this Annotation pertains to. 96 string annotation_spec_id = 2; 97 98 // The display name of the AnnotationSpec that this Annotation pertains to. 99 string display_name = 3; 100 } 101 102 oneof annotation { 103 // Mask based segmentation annotation. Only one mask annotation can exist 104 // for one image. 105 MaskAnnotation mask_annotation = 3; 106 107 // Polygon annotation. 108 PolygonAnnotation polygon_annotation = 4; 109 110 // Polyline annotation. 111 PolylineAnnotation polyline_annotation = 5; 112 } 113} 114 115// Annotation details specific to text classification. 116message TextClassificationAnnotation { 117 // The resource Id of the AnnotationSpec that this Annotation pertains to. 118 string annotation_spec_id = 1; 119 120 // The display name of the AnnotationSpec that this Annotation pertains to. 121 string display_name = 2; 122} 123 124// Annotation details specific to text extraction. 125message TextExtractionAnnotation { 126 // The segment of the text content. 127 TextSegment text_segment = 1; 128 129 // The resource Id of the AnnotationSpec that this Annotation pertains to. 130 string annotation_spec_id = 2; 131 132 // The display name of the AnnotationSpec that this Annotation pertains to. 133 string display_name = 3; 134} 135 136// The text segment inside of DataItem. 137message TextSegment { 138 // Zero-based character index of the first character of the text 139 // segment (counting characters from the beginning of the text). 140 uint64 start_offset = 1; 141 142 // Zero-based character index of the first character past the end of 143 // the text segment (counting character from the beginning of the text). 144 // The character at the end_offset is NOT included in the text segment. 145 uint64 end_offset = 2; 146 147 // The text content in the segment for output only. 148 string content = 3; 149} 150 151// Annotation details specific to text sentiment. 152message TextSentimentAnnotation { 153 // The sentiment score for text. 154 int32 sentiment = 1; 155 156 // The sentiment max score for text. 157 int32 sentiment_max = 2; 158 159 // The resource Id of the AnnotationSpec that this Annotation pertains to. 160 string annotation_spec_id = 3; 161 162 // The display name of the AnnotationSpec that this Annotation pertains to. 163 string display_name = 4; 164} 165 166// Annotation details specific to video classification. 167message VideoClassificationAnnotation { 168 // This Annotation applies to the time period represented by the TimeSegment. 169 // If it's not set, the Annotation applies to the whole video. 170 TimeSegment time_segment = 1; 171 172 // The resource Id of the AnnotationSpec that this Annotation pertains to. 173 string annotation_spec_id = 2; 174 175 // The display name of the AnnotationSpec that this Annotation pertains to. 176 string display_name = 3; 177} 178 179// A time period inside of a DataItem that has a time dimension (e.g. video). 180message TimeSegment { 181 // Start of the time segment (inclusive), represented as the duration since 182 // the start of the DataItem. 183 google.protobuf.Duration start_time_offset = 1; 184 185 // End of the time segment (exclusive), represented as the duration since the 186 // start of the DataItem. 187 google.protobuf.Duration end_time_offset = 2; 188} 189 190// Annotation details specific to video object tracking. 191message VideoObjectTrackingAnnotation { 192 // A time (frame) of a video to which this annotation pertains. 193 // Represented as the duration since the video's start. 194 google.protobuf.Duration time_offset = 1; 195 196 // The leftmost coordinate of the bounding box. 197 double x_min = 2; 198 199 // The rightmost coordinate of the bounding box. 200 double x_max = 3; 201 202 // The topmost coordinate of the bounding box. 203 double y_min = 4; 204 205 // The bottommost coordinate of the bounding box. 206 double y_max = 5; 207 208 // The instance of the object, expressed as a positive integer. Used to track 209 // the same object across different frames. 210 int64 instance_id = 6; 211 212 // The resource Id of the AnnotationSpec that this Annotation pertains to. 213 string annotation_spec_id = 7; 214 215 // The display name of the AnnotationSpec that this Annotation pertains to. 216 string display_name = 8; 217} 218 219// Annotation details specific to video action recognition. 220message VideoActionRecognitionAnnotation { 221 // This Annotation applies to the time period represented by the TimeSegment. 222 // If it's not set, the Annotation applies to the whole video. 223 TimeSegment time_segment = 1; 224 225 // The resource Id of the AnnotationSpec that this Annotation pertains to. 226 string annotation_spec_id = 2; 227 228 // The display name of the AnnotationSpec that this Annotation pertains to. 229 string display_name = 3; 230} 231