image_annotator.proto 27 KB

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