data_items.proto 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.automl.v1;
  16. import "google/cloud/automl/v1/geometry.proto";
  17. import "google/cloud/automl/v1/io.proto";
  18. import "google/cloud/automl/v1/text_segment.proto";
  19. option csharp_namespace = "Google.Cloud.AutoML.V1";
  20. option go_package = "google.golang.org/genproto/googleapis/cloud/automl/v1;automl";
  21. option java_multiple_files = true;
  22. option java_package = "com.google.cloud.automl.v1";
  23. option php_namespace = "Google\\Cloud\\AutoMl\\V1";
  24. option ruby_package = "Google::Cloud::AutoML::V1";
  25. // A representation of an image.
  26. // Only images up to 30MB in size are supported.
  27. message Image {
  28. // Input only. The data representing the image.
  29. // For Predict calls [image_bytes][google.cloud.automl.v1.Image.image_bytes] must be set .
  30. oneof data {
  31. // Image content represented as a stream of bytes.
  32. // Note: As with all `bytes` fields, protobuffers use a pure binary
  33. // representation, whereas JSON representations use base64.
  34. bytes image_bytes = 1;
  35. }
  36. // Output only. HTTP URI to the thumbnail image.
  37. string thumbnail_uri = 4;
  38. }
  39. // A representation of a text snippet.
  40. message TextSnippet {
  41. // Required. The content of the text snippet as a string. Up to 250000
  42. // characters long.
  43. string content = 1;
  44. // Optional. The format of [content][google.cloud.automl.v1.TextSnippet.content]. Currently the only two allowed
  45. // values are "text/html" and "text/plain". If left blank, the format is
  46. // automatically determined from the type of the uploaded [content][google.cloud.automl.v1.TextSnippet.content].
  47. string mime_type = 2;
  48. // Output only. HTTP URI where you can download the content.
  49. string content_uri = 4;
  50. }
  51. // Message that describes dimension of a document.
  52. message DocumentDimensions {
  53. // Unit of the document dimension.
  54. enum DocumentDimensionUnit {
  55. // Should not be used.
  56. DOCUMENT_DIMENSION_UNIT_UNSPECIFIED = 0;
  57. // Document dimension is measured in inches.
  58. INCH = 1;
  59. // Document dimension is measured in centimeters.
  60. CENTIMETER = 2;
  61. // Document dimension is measured in points. 72 points = 1 inch.
  62. POINT = 3;
  63. }
  64. // Unit of the dimension.
  65. DocumentDimensionUnit unit = 1;
  66. // Width value of the document, works together with the unit.
  67. float width = 2;
  68. // Height value of the document, works together with the unit.
  69. float height = 3;
  70. }
  71. // A structured text document e.g. a PDF.
  72. message Document {
  73. // Describes the layout information of a [text_segment][google.cloud.automl.v1.Document.Layout.text_segment] in the document.
  74. message Layout {
  75. // The type of TextSegment in the context of the original document.
  76. enum TextSegmentType {
  77. // Should not be used.
  78. TEXT_SEGMENT_TYPE_UNSPECIFIED = 0;
  79. // The text segment is a token. e.g. word.
  80. TOKEN = 1;
  81. // The text segment is a paragraph.
  82. PARAGRAPH = 2;
  83. // The text segment is a form field.
  84. FORM_FIELD = 3;
  85. // The text segment is the name part of a form field. It will be treated
  86. // as child of another FORM_FIELD TextSegment if its span is subspan of
  87. // another TextSegment with type FORM_FIELD.
  88. FORM_FIELD_NAME = 4;
  89. // The text segment is the text content part of a form field. It will be
  90. // treated as child of another FORM_FIELD TextSegment if its span is
  91. // subspan of another TextSegment with type FORM_FIELD.
  92. FORM_FIELD_CONTENTS = 5;
  93. // The text segment is a whole table, including headers, and all rows.
  94. TABLE = 6;
  95. // The text segment is a table's headers. It will be treated as child of
  96. // another TABLE TextSegment if its span is subspan of another TextSegment
  97. // with type TABLE.
  98. TABLE_HEADER = 7;
  99. // The text segment is a row in table. It will be treated as child of
  100. // another TABLE TextSegment if its span is subspan of another TextSegment
  101. // with type TABLE.
  102. TABLE_ROW = 8;
  103. // The text segment is a cell in table. It will be treated as child of
  104. // another TABLE_ROW TextSegment if its span is subspan of another
  105. // TextSegment with type TABLE_ROW.
  106. TABLE_CELL = 9;
  107. }
  108. // Text Segment that represents a segment in
  109. // [document_text][google.cloud.automl.v1p1beta.Document.document_text].
  110. TextSegment text_segment = 1;
  111. // Page number of the [text_segment][google.cloud.automl.v1.Document.Layout.text_segment] in the original document, starts
  112. // from 1.
  113. int32 page_number = 2;
  114. // The position of the [text_segment][google.cloud.automl.v1.Document.Layout.text_segment] in the page.
  115. // Contains exactly 4
  116. // [normalized_vertices][google.cloud.automl.v1p1beta.BoundingPoly.normalized_vertices]
  117. // and they are connected by edges in the order provided, which will
  118. // represent a rectangle parallel to the frame. The
  119. // [NormalizedVertex-s][google.cloud.automl.v1p1beta.NormalizedVertex] are
  120. // relative to the page.
  121. // Coordinates are based on top-left as point (0,0).
  122. BoundingPoly bounding_poly = 3;
  123. // The type of the [text_segment][google.cloud.automl.v1.Document.Layout.text_segment] in document.
  124. TextSegmentType text_segment_type = 4;
  125. }
  126. // An input config specifying the content of the document.
  127. DocumentInputConfig input_config = 1;
  128. // The plain text version of this document.
  129. TextSnippet document_text = 2;
  130. // Describes the layout of the document.
  131. // Sorted by [page_number][].
  132. repeated Layout layout = 3;
  133. // The dimensions of the page in the document.
  134. DocumentDimensions document_dimensions = 4;
  135. // Number of pages in the document.
  136. int32 page_count = 5;
  137. }
  138. // Example data used for training or prediction.
  139. message ExamplePayload {
  140. // Required. The example data.
  141. oneof payload {
  142. // Example image.
  143. Image image = 1;
  144. // Example text.
  145. TextSnippet text_snippet = 2;
  146. // Example document.
  147. Document document = 4;
  148. }
  149. }