1// Copyright 2023 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.visionai.v1; 18 19option csharp_namespace = "Google.Cloud.VisionAI.V1"; 20option go_package = "cloud.google.com/go/visionai/apiv1/visionaipb;visionaipb"; 21option java_multiple_files = true; 22option java_outer_classname = "LvaProto"; 23option java_package = "com.google.cloud.visionai.v1"; 24option php_namespace = "Google\\Cloud\\VisionAI\\V1"; 25option ruby_package = "Google::Cloud::VisionAI::V1"; 26 27// RunMode represents the mode to launch the Process on. 28enum RunMode { 29 // Mode is unspecified. 30 RUN_MODE_UNSPECIFIED = 0; 31 32 // Live mode. Meaning the Process is launched to handle live video 33 // source, and possible packet drops are expected. 34 LIVE = 1; 35 36 // Submission mode. Meaning the Process is launched to handle bounded video 37 // files, with no packet drop. Completion status is tracked. 38 SUBMISSION = 2; 39} 40 41// Defines the interface of an Operator. 42// 43// Arguments to an operator are input/output streams that are getting 44// processesed/returned while attributes are fixed configuration parameters. 45message OperatorDefinition { 46 // Defines an argument to an operator. 47 // 48 // Used for both inputs and outputs. 49 message ArgumentDefinition { 50 // The name of the argument. 51 // 52 // Tentatively [a-z]([_a-z0-9]*[a-z0-9])?, e.g., video, audio, 53 // high_fps_frame. 54 string argument = 1; 55 56 // The data type of the argument. 57 // 58 // This should match the textual representation of a stream/Packet type. 59 string type = 2; 60 } 61 62 // Defines an attribute of an operator. 63 message AttributeDefinition { 64 // The name of the attribute. 65 // 66 // Tentatively [a-z]([_a-z0-9]*[a-z0-9])?, e.g., max_frames_per_video, 67 // resize_height. 68 string attribute = 1; 69 70 // The type of this attribute. 71 // 72 // See attribute_value.proto for possibilities. 73 string type = 2; 74 75 // The default value for the attribute. 76 AttributeValue default_value = 3; 77 } 78 79 // The name of this operator. 80 // 81 // Tentatively [A-Z][a-zA-Z0-9]*, e.g., BboxCounter, PetDetector, 82 // PetDetector1. 83 string operator = 1; 84 85 // Declares input arguments. 86 repeated ArgumentDefinition input_args = 2; 87 88 // Declares output arguments. 89 repeated ArgumentDefinition output_args = 3; 90 91 // Declares the attributes. 92 repeated AttributeDefinition attributes = 4; 93 94 // The resources for running the operator. 95 ResourceSpecification resources = 5; 96 97 // Short description of the operator. 98 string short_description = 6; 99 100 // Full description of the operator. 101 string description = 7; 102} 103 104// ResourceSpec collects a set of resources that can 105// be used to specify requests and requirements. 106// 107// Note: Highly experimental as this can be runtime dependent. 108// Can use the "extras" field to experiment first before trying 109// to abstract it. 110message ResourceSpecification { 111 // CPU specification. 112 // 113 // Examples: 114 // "100m", "0.5", "1", "2", ... correspond to 115 // 0.1, half, 1, or 2 cpus. 116 // 117 // Leave empty to let the system decide. 118 // 119 // Note that this does *not* determine the cpu vender/make, 120 // or its underlying clock speed and specific SIMD features. 121 // It is only the amount time it requires in timeslicing. 122 string cpu = 1; 123 124 // CPU limit. 125 // 126 // Examples: 127 // "100m", "0.5", "1", "2", ... correspond to 128 // 0.1, half, 1, or 2 cpus. 129 // 130 // Leave empty to indicate no limit. 131 string cpu_limits = 5; 132 133 // Memory specification (in bytes). 134 // 135 // Examples: 136 // "128974848", "129e6", "129M", "123Mi", ... correspond to 137 // 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes. 138 // 139 // Leave empty to let the system decide. 140 string memory = 2; 141 142 // Memory usage limits. 143 // 144 // Examples: 145 // "128974848", "129e6", "129M", "123Mi", ... correspond to 146 // 128974848 bytes, 129000000 bytes, 129 mebibytes, 123 megabytes. 147 // 148 // Leave empty to indicate no limit. 149 string memory_limits = 6; 150 151 // Number of gpus. 152 int32 gpus = 3; 153 154 // The maximum latency that this operator may use to process an element. 155 // 156 // If non positive, then a system default will be used. 157 // Operator developers should arrange for the system compute resources to be 158 // aligned with this latency budget; e.g. if you want a ML model to produce 159 // results within 500ms, then you should make sure you request enough 160 // cpu/gpu/memory to achieve that. 161 int32 latency_budget_ms = 4; 162} 163 164// Represents an actual value of an operator attribute. 165message AttributeValue { 166 // Attribute value. 167 oneof value { 168 // int. 169 int64 i = 1; 170 171 // float. 172 float f = 2; 173 174 // bool. 175 bool b = 3; 176 177 // string. 178 bytes s = 4; 179 } 180} 181 182// Defines an Analyzer. 183// 184// An analyzer processes data from its input streams using the logic defined in 185// the Operator that it represents. Of course, it produces data for the output 186// streams declared in the Operator. 187message AnalyzerDefinition { 188 // The inputs to this analyzer. 189 // 190 // We accept input name references of the following form: 191 // <analyzer-name>:<output-argument-name> 192 // 193 // Example: 194 // 195 // Suppose you had an operator named "SomeOp" that has 2 output 196 // arguments, the first of which is named "foo" and the second of which is 197 // named "bar", and an operator named "MyOp" that accepts 2 inputs. 198 // 199 // Also suppose that there is an analyzer named "some-analyzer" that is 200 // running "SomeOp" and another analyzer named "my-analyzer" running "MyOp". 201 // 202 // To indicate that "my-analyzer" is to consume "some-analyzer"'s "foo" 203 // output as its first input and "some-analyzer"'s "bar" output as its 204 // second input, you can set this field to the following: 205 // input = ["some-analyzer:foo", "some-analyzer:bar"] 206 message StreamInput { 207 // The name of the stream input (as discussed above). 208 string input = 1; 209 } 210 211 // Options available for debugging purposes only. 212 message DebugOptions { 213 // Environment variables. 214 map<string, string> environment_variables = 1; 215 } 216 217 // Option related to the operator. 218 message OperatorOption { 219 // Tag of the operator. 220 string tag = 1; 221 222 // Registry of the operator. e.g. public, dev. 223 string registry = 2; 224 } 225 226 // The name of this analyzer. 227 // 228 // Tentatively [a-z][a-z0-9]*(_[a-z0-9]+)*. 229 string analyzer = 1; 230 231 // The name of the operator that this analyzer runs. 232 // 233 // Must match the name of a supported operator. 234 string operator = 2; 235 236 // Input streams. 237 repeated StreamInput inputs = 3; 238 239 // The attribute values that this analyzer applies to the operator. 240 // 241 // Supply a mapping between the attribute names and the actual value you wish 242 // to apply. If an attribute name is omitted, then it will take a 243 // preconfigured default value. 244 map<string, AttributeValue> attrs = 4; 245 246 // Debug options. 247 DebugOptions debug_options = 5; 248 249 // Operator option. 250 OperatorOption operator_option = 6; 251} 252 253// Defines a full analysis. 254// 255// This is a description of the overall live analytics pipeline. 256// You may think of this as an edge list representation of a multigraph. 257// 258// This may be directly authored by a human in protobuf textformat, or it may be 259// generated by a programming API (perhaps Python or JavaScript depending on 260// context). 261message AnalysisDefinition { 262 // Analyzer definitions. 263 repeated AnalyzerDefinition analyzers = 1; 264} 265 266// Message describing the status of the Process. 267message RunStatus { 268 // State represents the running status of the Process. 269 enum State { 270 // State is unspecified. 271 STATE_UNSPECIFIED = 0; 272 273 // INITIALIZING means the Process is scheduled but yet ready to handle 274 // real traffic. 275 INITIALIZING = 1; 276 277 // RUNNING means the Process is up running and handling traffic. 278 RUNNING = 2; 279 280 // COMPLETED means the Process has completed the processing, especially 281 // for non-streaming use case. 282 COMPLETED = 3; 283 284 // FAILED means the Process failed to complete the processing. 285 FAILED = 4; 286 287 // PENDING means the Process is created but yet to be scheduled. 288 PENDING = 5; 289 } 290 291 // The state of the Process. 292 State state = 1; 293 294 // The reason of becoming the state. 295 string reason = 2; 296} 297