image_annotator.proto 27 KB

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