data_items.proto 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. // Copyright 2020 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.v1beta1;
  16. import "google/cloud/automl/v1beta1/geometry.proto";
  17. import "google/cloud/automl/v1beta1/io.proto";
  18. import "google/cloud/automl/v1beta1/temporal.proto";
  19. import "google/cloud/automl/v1beta1/text_segment.proto";
  20. import "google/protobuf/struct.proto";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/automl/v1beta1;automl";
  22. option java_multiple_files = true;
  23. option java_package = "com.google.cloud.automl.v1beta1";
  24. option php_namespace = "Google\\Cloud\\AutoMl\\V1beta1";
  25. option ruby_package = "Google::Cloud::AutoML::V1beta1";
  26. // A representation of an image.
  27. // Only images up to 30MB in size are supported.
  28. message Image {
  29. // Input only. The data representing the image.
  30. // For Predict calls [image_bytes][google.cloud.automl.v1beta1.Image.image_bytes] must be set, as other options are not
  31. // currently supported by prediction API. You can read the contents of an
  32. // uploaded image by using the [content_uri][google.cloud.automl.v1beta1.Image.content_uri] field.
  33. oneof data {
  34. // Image content represented as a stream of bytes.
  35. // Note: As with all `bytes` fields, protobuffers use a pure binary
  36. // representation, whereas JSON representations use base64.
  37. bytes image_bytes = 1;
  38. // An input config specifying the content of the image.
  39. InputConfig input_config = 6;
  40. }
  41. // Output only. HTTP URI to the thumbnail image.
  42. string thumbnail_uri = 4;
  43. }
  44. // A representation of a text snippet.
  45. message TextSnippet {
  46. // Required. The content of the text snippet as a string. Up to 250000
  47. // characters long.
  48. string content = 1;
  49. // Optional. The format of [content][google.cloud.automl.v1beta1.TextSnippet.content]. Currently the only two allowed
  50. // values are "text/html" and "text/plain". If left blank, the format is
  51. // automatically determined from the type of the uploaded [content][google.cloud.automl.v1beta1.TextSnippet.content].
  52. string mime_type = 2;
  53. // Output only. HTTP URI where you can download the content.
  54. string content_uri = 4;
  55. }
  56. // Message that describes dimension of a document.
  57. message DocumentDimensions {
  58. // Unit of the document dimension.
  59. enum DocumentDimensionUnit {
  60. // Should not be used.
  61. DOCUMENT_DIMENSION_UNIT_UNSPECIFIED = 0;
  62. // Document dimension is measured in inches.
  63. INCH = 1;
  64. // Document dimension is measured in centimeters.
  65. CENTIMETER = 2;
  66. // Document dimension is measured in points. 72 points = 1 inch.
  67. POINT = 3;
  68. }
  69. // Unit of the dimension.
  70. DocumentDimensionUnit unit = 1;
  71. // Width value of the document, works together with the unit.
  72. float width = 2;
  73. // Height value of the document, works together with the unit.
  74. float height = 3;
  75. }
  76. // A structured text document e.g. a PDF.
  77. message Document {
  78. // Describes the layout information of a [text_segment][google.cloud.automl.v1beta1.Document.Layout.text_segment] in the document.
  79. message Layout {
  80. // The type of TextSegment in the context of the original document.
  81. enum TextSegmentType {
  82. // Should not be used.
  83. TEXT_SEGMENT_TYPE_UNSPECIFIED = 0;
  84. // The text segment is a token. e.g. word.
  85. TOKEN = 1;
  86. // The text segment is a paragraph.
  87. PARAGRAPH = 2;
  88. // The text segment is a form field.
  89. FORM_FIELD = 3;
  90. // The text segment is the name part of a form field. It will be treated
  91. // as child of another FORM_FIELD TextSegment if its span is subspan of
  92. // another TextSegment with type FORM_FIELD.
  93. FORM_FIELD_NAME = 4;
  94. // The text segment is the text content part of a form field. It will be
  95. // treated as child of another FORM_FIELD TextSegment if its span is
  96. // subspan of another TextSegment with type FORM_FIELD.
  97. FORM_FIELD_CONTENTS = 5;
  98. // The text segment is a whole table, including headers, and all rows.
  99. TABLE = 6;
  100. // The text segment is a table's headers. It will be treated as child of
  101. // another TABLE TextSegment if its span is subspan of another TextSegment
  102. // with type TABLE.
  103. TABLE_HEADER = 7;
  104. // The text segment is a row in table. It will be treated as child of
  105. // another TABLE TextSegment if its span is subspan of another TextSegment
  106. // with type TABLE.
  107. TABLE_ROW = 8;
  108. // The text segment is a cell in table. It will be treated as child of
  109. // another TABLE_ROW TextSegment if its span is subspan of another
  110. // TextSegment with type TABLE_ROW.
  111. TABLE_CELL = 9;
  112. }
  113. // Text Segment that represents a segment in
  114. // [document_text][google.cloud.automl.v1beta1.Document.document_text].
  115. TextSegment text_segment = 1;
  116. // Page number of the [text_segment][google.cloud.automl.v1beta1.Document.Layout.text_segment] in the original document, starts
  117. // from 1.
  118. int32 page_number = 2;
  119. // The position of the [text_segment][google.cloud.automl.v1beta1.Document.Layout.text_segment] in the page.
  120. // Contains exactly 4
  121. //
  122. // [normalized_vertices][google.cloud.automl.v1beta1.BoundingPoly.normalized_vertices]
  123. // and they are connected by edges in the order provided, which will
  124. // represent a rectangle parallel to the frame. The
  125. // [NormalizedVertex-s][google.cloud.automl.v1beta1.NormalizedVertex] are
  126. // relative to the page.
  127. // Coordinates are based on top-left as point (0,0).
  128. BoundingPoly bounding_poly = 3;
  129. // The type of the [text_segment][google.cloud.automl.v1beta1.Document.Layout.text_segment] in document.
  130. TextSegmentType text_segment_type = 4;
  131. }
  132. // An input config specifying the content of the document.
  133. DocumentInputConfig input_config = 1;
  134. // The plain text version of this document.
  135. TextSnippet document_text = 2;
  136. // Describes the layout of the document.
  137. // Sorted by [page_number][].
  138. repeated Layout layout = 3;
  139. // The dimensions of the page in the document.
  140. DocumentDimensions document_dimensions = 4;
  141. // Number of pages in the document.
  142. int32 page_count = 5;
  143. }
  144. // A representation of a row in a relational table.
  145. message Row {
  146. // The resource IDs of the column specs describing the columns of the row.
  147. // If set must contain, but possibly in a different order, all input
  148. // feature
  149. //
  150. // [column_spec_ids][google.cloud.automl.v1beta1.TablesModelMetadata.input_feature_column_specs]
  151. // of the Model this row is being passed to.
  152. // Note: The below `values` field must match order of this field, if this
  153. // field is set.
  154. repeated string column_spec_ids = 2;
  155. // Required. The values of the row cells, given in the same order as the
  156. // column_spec_ids, or, if not set, then in the same order as input
  157. // feature
  158. //
  159. // [column_specs][google.cloud.automl.v1beta1.TablesModelMetadata.input_feature_column_specs]
  160. // of the Model this row is being passed to.
  161. repeated google.protobuf.Value values = 3;
  162. }
  163. // Example data used for training or prediction.
  164. message ExamplePayload {
  165. // Required. Input only. The example data.
  166. oneof payload {
  167. // Example image.
  168. Image image = 1;
  169. // Example text.
  170. TextSnippet text_snippet = 2;
  171. // Example document.
  172. Document document = 4;
  173. // Example relational table row.
  174. Row row = 3;
  175. }
  176. }