data_items.proto 7.8 KB

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