image_annotator.proto 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. // Copyright 2019 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. //
  15. syntax = "proto3";
  16. package google.cloud.vision.v1p2beta1;
  17. import "google/api/annotations.proto";
  18. import "google/api/client.proto";
  19. import "google/api/field_behavior.proto";
  20. import "google/cloud/vision/v1p2beta1/geometry.proto";
  21. import "google/cloud/vision/v1p2beta1/text_annotation.proto";
  22. import "google/cloud/vision/v1p2beta1/web_detection.proto";
  23. import "google/longrunning/operations.proto";
  24. import "google/protobuf/timestamp.proto";
  25. import "google/rpc/status.proto";
  26. import "google/type/color.proto";
  27. import "google/type/latlng.proto";
  28. option cc_enable_arenas = true;
  29. option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1;vision";
  30. option java_multiple_files = true;
  31. option java_outer_classname = "ImageAnnotatorProto";
  32. option java_package = "com.google.cloud.vision.v1p2beta1";
  33. // Service that performs Google Cloud Vision API detection tasks over client
  34. // images, such as face, landmark, logo, label, and text detection. The
  35. // ImageAnnotator service returns detected entities from the images.
  36. service ImageAnnotator {
  37. option (google.api.default_host) = "vision.googleapis.com";
  38. option (google.api.oauth_scopes) =
  39. "https://www.googleapis.com/auth/cloud-platform,"
  40. "https://www.googleapis.com/auth/cloud-vision";
  41. // Run image detection and annotation for a batch of images.
  42. rpc BatchAnnotateImages(BatchAnnotateImagesRequest) returns (BatchAnnotateImagesResponse) {
  43. option (google.api.http) = {
  44. post: "/v1p2beta1/images:annotate"
  45. body: "*"
  46. };
  47. option (google.api.method_signature) = "requests";
  48. }
  49. // Run async image detection and annotation for a list of generic files (e.g.
  50. // PDF) which may contain multiple pages and multiple images per page.
  51. // Progress and results can be retrieved through the
  52. // `google.longrunning.Operations` interface.
  53. // `Operation.metadata` contains `OperationMetadata` (metadata).
  54. // `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results).
  55. rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest) returns (google.longrunning.Operation) {
  56. option (google.api.http) = {
  57. post: "/v1p2beta1/files:asyncBatchAnnotate"
  58. body: "*"
  59. };
  60. option (google.api.method_signature) = "requests";
  61. option (google.longrunning.operation_info) = {
  62. response_type: "AsyncBatchAnnotateFilesResponse"
  63. metadata_type: "OperationMetadata"
  64. };
  65. }
  66. }
  67. // The type of Google Cloud Vision API detection to perform, and the maximum
  68. // number of results to return for that type. Multiple `Feature` objects can
  69. // be specified in the `features` list.
  70. message Feature {
  71. // Type of Google Cloud Vision API feature to be extracted.
  72. enum Type {
  73. // Unspecified feature type.
  74. TYPE_UNSPECIFIED = 0;
  75. // Run face detection.
  76. FACE_DETECTION = 1;
  77. // Run landmark detection.
  78. LANDMARK_DETECTION = 2;
  79. // Run logo detection.
  80. LOGO_DETECTION = 3;
  81. // Run label detection.
  82. LABEL_DETECTION = 4;
  83. // Run text detection / optical character recognition (OCR). Text detection
  84. // is optimized for areas of text within a larger image; if the image is
  85. // a document, use `DOCUMENT_TEXT_DETECTION` instead.
  86. TEXT_DETECTION = 5;
  87. // Run dense text document OCR. Takes precedence when both
  88. // `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present.
  89. DOCUMENT_TEXT_DETECTION = 11;
  90. // Run Safe Search to detect potentially unsafe
  91. // or undesirable content.
  92. SAFE_SEARCH_DETECTION = 6;
  93. // Compute a set of image properties, such as the
  94. // image's dominant colors.
  95. IMAGE_PROPERTIES = 7;
  96. // Run crop hints.
  97. CROP_HINTS = 9;
  98. // Run web detection.
  99. WEB_DETECTION = 10;
  100. }
  101. // The feature type.
  102. Type type = 1;
  103. // Maximum number of results of this type. Does not apply to
  104. // `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
  105. int32 max_results = 2;
  106. // Model to use for the feature.
  107. // Supported values: "builtin/stable" (the default if unset) and
  108. // "builtin/latest".
  109. string model = 3;
  110. }
  111. // External image source (Google Cloud Storage or web URL image location).
  112. message ImageSource {
  113. // **Use `image_uri` instead.**
  114. //
  115. // The Google Cloud Storage URI of the form
  116. // `gs://bucket_name/object_name`. Object versioning is not supported. See
  117. // [Google Cloud Storage Request
  118. // URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.
  119. string gcs_image_uri = 1;
  120. // The URI of the source image. Can be either:
  121. //
  122. // 1. A Google Cloud Storage URI of the form
  123. // `gs://bucket_name/object_name`. Object versioning is not supported. See
  124. // [Google Cloud Storage Request
  125. // URIs](https://cloud.google.com/storage/docs/reference-uris) for more
  126. // info.
  127. //
  128. // 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from
  129. // HTTP/HTTPS URLs, Google cannot guarantee that the request will be
  130. // completed. Your request may fail if the specified host denies the
  131. // request (e.g. due to request throttling or DOS prevention), or if Google
  132. // throttles requests to the site for abuse prevention. You should not
  133. // depend on externally-hosted images for production applications.
  134. //
  135. // When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes
  136. // precedence.
  137. string image_uri = 2;
  138. }
  139. // Client image to perform Google Cloud Vision API tasks over.
  140. message Image {
  141. // Image content, represented as a stream of bytes.
  142. // Note: As with all `bytes` fields, protobuffers use a pure binary
  143. // representation, whereas JSON representations use base64.
  144. bytes content = 1;
  145. // Google Cloud Storage image location, or publicly-accessible image
  146. // URL. If both `content` and `source` are provided for an image, `content`
  147. // takes precedence and is used to perform the image annotation request.
  148. ImageSource source = 2;
  149. }
  150. // A face annotation object contains the results of face detection.
  151. message FaceAnnotation {
  152. // A face-specific landmark (for example, a face feature).
  153. message Landmark {
  154. // Face landmark (feature) type.
  155. // Left and right are defined from the vantage of the viewer of the image
  156. // without considering mirror projections typical of photos. So, `LEFT_EYE`,
  157. // typically, is the person's right eye.
  158. enum Type {
  159. // Unknown face landmark detected. Should not be filled.
  160. UNKNOWN_LANDMARK = 0;
  161. // Left eye.
  162. LEFT_EYE = 1;
  163. // Right eye.
  164. RIGHT_EYE = 2;
  165. // Left of left eyebrow.
  166. LEFT_OF_LEFT_EYEBROW = 3;
  167. // Right of left eyebrow.
  168. RIGHT_OF_LEFT_EYEBROW = 4;
  169. // Left of right eyebrow.
  170. LEFT_OF_RIGHT_EYEBROW = 5;
  171. // Right of right eyebrow.
  172. RIGHT_OF_RIGHT_EYEBROW = 6;
  173. // Midpoint between eyes.
  174. MIDPOINT_BETWEEN_EYES = 7;
  175. // Nose tip.
  176. NOSE_TIP = 8;
  177. // Upper lip.
  178. UPPER_LIP = 9;
  179. // Lower lip.
  180. LOWER_LIP = 10;
  181. // Mouth left.
  182. MOUTH_LEFT = 11;
  183. // Mouth right.
  184. MOUTH_RIGHT = 12;
  185. // Mouth center.
  186. MOUTH_CENTER = 13;
  187. // Nose, bottom right.
  188. NOSE_BOTTOM_RIGHT = 14;
  189. // Nose, bottom left.
  190. NOSE_BOTTOM_LEFT = 15;
  191. // Nose, bottom center.
  192. NOSE_BOTTOM_CENTER = 16;
  193. // Left eye, top boundary.
  194. LEFT_EYE_TOP_BOUNDARY = 17;
  195. // Left eye, right corner.
  196. LEFT_EYE_RIGHT_CORNER = 18;
  197. // Left eye, bottom boundary.
  198. LEFT_EYE_BOTTOM_BOUNDARY = 19;
  199. // Left eye, left corner.
  200. LEFT_EYE_LEFT_CORNER = 20;
  201. // Right eye, top boundary.
  202. RIGHT_EYE_TOP_BOUNDARY = 21;
  203. // Right eye, right corner.
  204. RIGHT_EYE_RIGHT_CORNER = 22;
  205. // Right eye, bottom boundary.
  206. RIGHT_EYE_BOTTOM_BOUNDARY = 23;
  207. // Right eye, left corner.
  208. RIGHT_EYE_LEFT_CORNER = 24;
  209. // Left eyebrow, upper midpoint.
  210. LEFT_EYEBROW_UPPER_MIDPOINT = 25;
  211. // Right eyebrow, upper midpoint.
  212. RIGHT_EYEBROW_UPPER_MIDPOINT = 26;
  213. // Left ear tragion.
  214. LEFT_EAR_TRAGION = 27;
  215. // Right ear tragion.
  216. RIGHT_EAR_TRAGION = 28;
  217. // Left eye pupil.
  218. LEFT_EYE_PUPIL = 29;
  219. // Right eye pupil.
  220. RIGHT_EYE_PUPIL = 30;
  221. // Forehead glabella.
  222. FOREHEAD_GLABELLA = 31;
  223. // Chin gnathion.
  224. CHIN_GNATHION = 32;
  225. // Chin left gonion.
  226. CHIN_LEFT_GONION = 33;
  227. // Chin right gonion.
  228. CHIN_RIGHT_GONION = 34;
  229. }
  230. // Face landmark type.
  231. Type type = 3;
  232. // Face landmark position.
  233. Position position = 4;
  234. }
  235. // The bounding polygon around the face. The coordinates of the bounding box
  236. // are in the original image's scale, as returned in `ImageParams`.
  237. // The bounding box is computed to "frame" the face in accordance with human
  238. // expectations. It is based on the landmarker results.
  239. // Note that one or more x and/or y coordinates may not be generated in the
  240. // `BoundingPoly` (the polygon will be unbounded) if only a partial face
  241. // appears in the image to be annotated.
  242. BoundingPoly bounding_poly = 1;
  243. // The `fd_bounding_poly` bounding polygon is tighter than the
  244. // `boundingPoly`, and encloses only the skin part of the face. Typically, it
  245. // is used to eliminate the face from any image analysis that detects the
  246. // "amount of skin" visible in an image. It is not based on the
  247. // landmarker results, only on the initial face detection, hence
  248. // the <code>fd</code> (face detection) prefix.
  249. BoundingPoly fd_bounding_poly = 2;
  250. // Detected face landmarks.
  251. repeated Landmark landmarks = 3;
  252. // Roll angle, which indicates the amount of clockwise/anti-clockwise rotation
  253. // of the face relative to the image vertical about the axis perpendicular to
  254. // the face. Range [-180,180].
  255. float roll_angle = 4;
  256. // Yaw angle, which indicates the leftward/rightward angle that the face is
  257. // pointing relative to the vertical plane perpendicular to the image. Range
  258. // [-180,180].
  259. float pan_angle = 5;
  260. // Pitch angle, which indicates the upwards/downwards angle that the face is
  261. // pointing relative to the image's horizontal plane. Range [-180,180].
  262. float tilt_angle = 6;
  263. // Detection confidence. Range [0, 1].
  264. float detection_confidence = 7;
  265. // Face landmarking confidence. Range [0, 1].
  266. float landmarking_confidence = 8;
  267. // Joy likelihood.
  268. Likelihood joy_likelihood = 9;
  269. // Sorrow likelihood.
  270. Likelihood sorrow_likelihood = 10;
  271. // Anger likelihood.
  272. Likelihood anger_likelihood = 11;
  273. // Surprise likelihood.
  274. Likelihood surprise_likelihood = 12;
  275. // Under-exposed likelihood.
  276. Likelihood under_exposed_likelihood = 13;
  277. // Blurred likelihood.
  278. Likelihood blurred_likelihood = 14;
  279. // Headwear likelihood.
  280. Likelihood headwear_likelihood = 15;
  281. }
  282. // Detected entity location information.
  283. message LocationInfo {
  284. // lat/long location coordinates.
  285. google.type.LatLng lat_lng = 1;
  286. }
  287. // A `Property` consists of a user-supplied name/value pair.
  288. message Property {
  289. // Name of the property.
  290. string name = 1;
  291. // Value of the property.
  292. string value = 2;
  293. // Value of numeric properties.
  294. uint64 uint64_value = 3;
  295. }
  296. // Set of detected entity features.
  297. message EntityAnnotation {
  298. // Opaque entity ID. Some IDs may be available in
  299. // [Google Knowledge Graph Search
  300. // API](https://developers.google.com/knowledge-graph/).
  301. string mid = 1;
  302. // The language code for the locale in which the entity textual
  303. // `description` is expressed.
  304. string locale = 2;
  305. // Entity textual description, expressed in its `locale` language.
  306. string description = 3;
  307. // Overall score of the result. Range [0, 1].
  308. float score = 4;
  309. // **Deprecated. Use `score` instead.**
  310. // The accuracy of the entity detection in an image.
  311. // For example, for an image in which the "Eiffel Tower" entity is detected,
  312. // this field represents the confidence that there is a tower in the query
  313. // image. Range [0, 1].
  314. float confidence = 5;
  315. // The relevancy of the ICA (Image Content Annotation) label to the
  316. // image. For example, the relevancy of "tower" is likely higher to an image
  317. // containing the detected "Eiffel Tower" than to an image containing a
  318. // detected distant towering building, even though the confidence that
  319. // there is a tower in each image may be the same. Range [0, 1].
  320. float topicality = 6;
  321. // Image region to which this entity belongs. Not produced
  322. // for `LABEL_DETECTION` features.
  323. BoundingPoly bounding_poly = 7;
  324. // The location information for the detected entity. Multiple
  325. // `LocationInfo` elements can be present because one location may
  326. // indicate the location of the scene in the image, and another location
  327. // may indicate the location of the place where the image was taken.
  328. // Location information is usually present for landmarks.
  329. repeated LocationInfo locations = 8;
  330. // Some entities may have optional user-supplied `Property` (name/value)
  331. // fields, such a score or string that qualifies the entity.
  332. repeated Property properties = 9;
  333. }
  334. // Set of features pertaining to the image, computed by computer vision
  335. // methods over safe-search verticals (for example, adult, spoof, medical,
  336. // violence).
  337. message SafeSearchAnnotation {
  338. // Represents the adult content likelihood for the image. Adult content may
  339. // contain elements such as nudity, pornographic images or cartoons, or
  340. // sexual activities.
  341. Likelihood adult = 1;
  342. // Spoof likelihood. The likelihood that an modification
  343. // was made to the image's canonical version to make it appear
  344. // funny or offensive.
  345. Likelihood spoof = 2;
  346. // Likelihood that this is a medical image.
  347. Likelihood medical = 3;
  348. // Likelihood that this image contains violent content.
  349. Likelihood violence = 4;
  350. // Likelihood that the request image contains racy content. Racy content may
  351. // include (but is not limited to) skimpy or sheer clothing, strategically
  352. // covered nudity, lewd or provocative poses, or close-ups of sensitive
  353. // body areas.
  354. Likelihood racy = 9;
  355. }
  356. // Rectangle determined by min and max `LatLng` pairs.
  357. message LatLongRect {
  358. // Min lat/long pair.
  359. google.type.LatLng min_lat_lng = 1;
  360. // Max lat/long pair.
  361. google.type.LatLng max_lat_lng = 2;
  362. }
  363. // Color information consists of RGB channels, score, and the fraction of
  364. // the image that the color occupies in the image.
  365. message ColorInfo {
  366. // RGB components of the color.
  367. google.type.Color color = 1;
  368. // Image-specific score for this color. Value in range [0, 1].
  369. float score = 2;
  370. // The fraction of pixels the color occupies in the image.
  371. // Value in range [0, 1].
  372. float pixel_fraction = 3;
  373. }
  374. // Set of dominant colors and their corresponding scores.
  375. message DominantColorsAnnotation {
  376. // RGB color values with their score and pixel fraction.
  377. repeated ColorInfo colors = 1;
  378. }
  379. // Stores image properties, such as dominant colors.
  380. message ImageProperties {
  381. // If present, dominant colors completed successfully.
  382. DominantColorsAnnotation dominant_colors = 1;
  383. }
  384. // Single crop hint that is used to generate a new crop when serving an image.
  385. message CropHint {
  386. // The bounding polygon for the crop region. The coordinates of the bounding
  387. // box are in the original image's scale, as returned in `ImageParams`.
  388. BoundingPoly bounding_poly = 1;
  389. // Confidence of this being a salient region. Range [0, 1].
  390. float confidence = 2;
  391. // Fraction of importance of this salient region with respect to the original
  392. // image.
  393. float importance_fraction = 3;
  394. }
  395. // Set of crop hints that are used to generate new crops when serving images.
  396. message CropHintsAnnotation {
  397. // Crop hint results.
  398. repeated CropHint crop_hints = 1;
  399. }
  400. // Parameters for crop hints annotation request.
  401. message CropHintsParams {
  402. // Aspect ratios in floats, representing the ratio of the width to the height
  403. // of the image. For example, if the desired aspect ratio is 4/3, the
  404. // corresponding float value should be 1.33333. If not specified, the
  405. // best possible crop is returned. The number of provided aspect ratios is
  406. // limited to a maximum of 16; any aspect ratios provided after the 16th are
  407. // ignored.
  408. repeated float aspect_ratios = 1;
  409. }
  410. // Parameters for web detection request.
  411. message WebDetectionParams {
  412. // Whether to include results derived from the geo information in the image.
  413. bool include_geo_results = 2;
  414. }
  415. // Parameters for text detections. This is used to control TEXT_DETECTION and
  416. // DOCUMENT_TEXT_DETECTION features.
  417. message TextDetectionParams {
  418. // By default, Cloud Vision API only includes confidence score for
  419. // DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence
  420. // score for TEXT_DETECTION as well.
  421. bool enable_text_detection_confidence_score = 9;
  422. }
  423. // Image context and/or feature-specific parameters.
  424. message ImageContext {
  425. // Not used.
  426. LatLongRect lat_long_rect = 1;
  427. // List of languages to use for TEXT_DETECTION. In most cases, an empty value
  428. // yields the best results since it enables automatic language detection. For
  429. // languages based on the Latin alphabet, setting `language_hints` is not
  430. // needed. In rare cases, when the language of the text in the image is known,
  431. // setting a hint will help get better results (although it will be a
  432. // significant hindrance if the hint is wrong). Text detection returns an
  433. // error if one or more of the specified languages is not one of the
  434. // [supported languages](https://cloud.google.com/vision/docs/languages).
  435. repeated string language_hints = 2;
  436. // Parameters for crop hints annotation request.
  437. CropHintsParams crop_hints_params = 4;
  438. // Parameters for web detection.
  439. WebDetectionParams web_detection_params = 6;
  440. // Parameters for text detection and document text detection.
  441. TextDetectionParams text_detection_params = 12;
  442. }
  443. // Request for performing Google Cloud Vision API tasks over a user-provided
  444. // image, with user-requested features.
  445. message AnnotateImageRequest {
  446. // The image to be processed.
  447. Image image = 1;
  448. // Requested features.
  449. repeated Feature features = 2;
  450. // Additional context that may accompany the image.
  451. ImageContext image_context = 3;
  452. }
  453. // If an image was produced from a file (e.g. a PDF), this message gives
  454. // information about the source of that image.
  455. message ImageAnnotationContext {
  456. // The URI of the file used to produce the image.
  457. string uri = 1;
  458. // If the file was a PDF or TIFF, this field gives the page number within
  459. // the file used to produce the image.
  460. int32 page_number = 2;
  461. }
  462. // Response to an image annotation request.
  463. message AnnotateImageResponse {
  464. // If present, face detection has completed successfully.
  465. repeated FaceAnnotation face_annotations = 1;
  466. // If present, landmark detection has completed successfully.
  467. repeated EntityAnnotation landmark_annotations = 2;
  468. // If present, logo detection has completed successfully.
  469. repeated EntityAnnotation logo_annotations = 3;
  470. // If present, label detection has completed successfully.
  471. repeated EntityAnnotation label_annotations = 4;
  472. // If present, text (OCR) detection has completed successfully.
  473. repeated EntityAnnotation text_annotations = 5;
  474. // If present, text (OCR) detection or document (OCR) text detection has
  475. // completed successfully.
  476. // This annotation provides the structural hierarchy for the OCR detected
  477. // text.
  478. TextAnnotation full_text_annotation = 12;
  479. // If present, safe-search annotation has completed successfully.
  480. SafeSearchAnnotation safe_search_annotation = 6;
  481. // If present, image properties were extracted successfully.
  482. ImageProperties image_properties_annotation = 8;
  483. // If present, crop hints have completed successfully.
  484. CropHintsAnnotation crop_hints_annotation = 11;
  485. // If present, web detection has completed successfully.
  486. WebDetection web_detection = 13;
  487. // If set, represents the error message for the operation.
  488. // Note that filled-in image annotations are guaranteed to be
  489. // correct, even when `error` is set.
  490. google.rpc.Status error = 9;
  491. // If present, contextual information is needed to understand where this image
  492. // comes from.
  493. ImageAnnotationContext context = 21;
  494. }
  495. // Response to a single file annotation request. A file may contain one or more
  496. // images, which individually have their own responses.
  497. message AnnotateFileResponse {
  498. // Information about the file for which this response is generated.
  499. InputConfig input_config = 1;
  500. // Individual responses to images found within the file.
  501. repeated AnnotateImageResponse responses = 2;
  502. }
  503. // Multiple image annotation requests are batched into a single service call.
  504. message BatchAnnotateImagesRequest {
  505. // Required. Individual image annotation requests for this batch.
  506. repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED];
  507. }
  508. // Response to a batch image annotation request.
  509. message BatchAnnotateImagesResponse {
  510. // Individual responses to image annotation requests within the batch.
  511. repeated AnnotateImageResponse responses = 1;
  512. }
  513. // An offline file annotation request.
  514. message AsyncAnnotateFileRequest {
  515. // Required. Information about the input file.
  516. InputConfig input_config = 1;
  517. // Required. Requested features.
  518. repeated Feature features = 2;
  519. // Additional context that may accompany the image(s) in the file.
  520. ImageContext image_context = 3;
  521. // Required. The desired output location and metadata (e.g. format).
  522. OutputConfig output_config = 4;
  523. }
  524. // The response for a single offline file annotation request.
  525. message AsyncAnnotateFileResponse {
  526. // The output location and metadata from AsyncAnnotateFileRequest.
  527. OutputConfig output_config = 1;
  528. }
  529. // Multiple async file annotation requests are batched into a single service
  530. // call.
  531. message AsyncBatchAnnotateFilesRequest {
  532. // Required. Individual async file annotation requests for this batch.
  533. repeated AsyncAnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED];
  534. }
  535. // Response to an async batch file annotation request.
  536. message AsyncBatchAnnotateFilesResponse {
  537. // The list of file annotation responses, one for each request in
  538. // AsyncBatchAnnotateFilesRequest.
  539. repeated AsyncAnnotateFileResponse responses = 1;
  540. }
  541. // The desired input location and metadata.
  542. message InputConfig {
  543. // The Google Cloud Storage location to read the input from.
  544. GcsSource gcs_source = 1;
  545. // The type of the file. Currently only "application/pdf" and "image/tiff"
  546. // are supported. Wildcards are not supported.
  547. string mime_type = 2;
  548. }
  549. // The desired output location and metadata.
  550. message OutputConfig {
  551. // The Google Cloud Storage location to write the output(s) to.
  552. GcsDestination gcs_destination = 1;
  553. // The max number of response protos to put into each output JSON file on GCS.
  554. // The valid range is [1, 100]. If not specified, the default value is 20.
  555. //
  556. // For example, for one pdf file with 100 pages, 100 response protos will
  557. // be generated. If `batch_size` = 20, then 5 json files each
  558. // containing 20 response protos will be written under the prefix
  559. // `gcs_destination`.`uri`.
  560. //
  561. // Currently, batch_size only applies to GcsDestination, with potential future
  562. // support for other output configurations.
  563. int32 batch_size = 2;
  564. }
  565. // The Google Cloud Storage location where the input will be read from.
  566. message GcsSource {
  567. // Google Cloud Storage URI for the input file. This must only be a GCS
  568. // object. Wildcards are not currently supported.
  569. string uri = 1;
  570. }
  571. // The Google Cloud Storage location where the output will be written to.
  572. message GcsDestination {
  573. // Google Cloud Storage URI where the results will be stored. Results will
  574. // be in JSON format and preceded by its corresponding input URI. This field
  575. // can either represent a single file, or a prefix for multiple outputs.
  576. // Prefixes must end in a `/`.
  577. //
  578. // Examples:
  579. //
  580. // * File: gs://bucket-name/filename.json
  581. // * Prefix: gs://bucket-name/prefix/here/
  582. // * File: gs://bucket-name/prefix/here
  583. //
  584. // If multiple outputs, each response is still AnnotateFileResponse, each of
  585. // which contains some subset of the full list of AnnotateImageResponse.
  586. // Multiple outputs can happen if, for example, the output JSON is too large
  587. // and overflows into multiple sharded files.
  588. string uri = 1;
  589. }
  590. // Contains metadata for the BatchAnnotateImages operation.
  591. message OperationMetadata {
  592. // Batch operation states.
  593. enum State {
  594. // Invalid.
  595. STATE_UNSPECIFIED = 0;
  596. // Request is received.
  597. CREATED = 1;
  598. // Request is actively being processed.
  599. RUNNING = 2;
  600. // The batch processing is done.
  601. DONE = 3;
  602. // The batch processing was cancelled.
  603. CANCELLED = 4;
  604. }
  605. // Current state of the batch operation.
  606. State state = 1;
  607. // The time when the batch request was received.
  608. google.protobuf.Timestamp create_time = 5;
  609. // The time when the operation result was last updated.
  610. google.protobuf.Timestamp update_time = 6;
  611. }
  612. // A bucketized representation of likelihood, which is intended to give clients
  613. // highly stable results across model upgrades.
  614. enum Likelihood {
  615. // Unknown likelihood.
  616. UNKNOWN = 0;
  617. // It is very unlikely that the image belongs to the specified vertical.
  618. VERY_UNLIKELY = 1;
  619. // It is unlikely that the image belongs to the specified vertical.
  620. UNLIKELY = 2;
  621. // It is possible that the image belongs to the specified vertical.
  622. POSSIBLE = 3;
  623. // It is likely that the image belongs to the specified vertical.
  624. LIKELY = 4;
  625. // It is very likely that the image belongs to the specified vertical.
  626. VERY_LIKELY = 5;
  627. }