human_annotation_config.proto 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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.datalabeling.v1beta1;
  17. import "google/api/annotations.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/protobuf/duration.proto";
  20. option csharp_namespace = "Google.Cloud.DataLabeling.V1Beta1";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1;datalabeling";
  22. option java_multiple_files = true;
  23. option java_package = "com.google.cloud.datalabeling.v1beta1";
  24. option php_namespace = "Google\\Cloud\\DataLabeling\\V1beta1";
  25. option ruby_package = "Google::Cloud::DataLabeling::V1beta1";
  26. enum StringAggregationType {
  27. STRING_AGGREGATION_TYPE_UNSPECIFIED = 0;
  28. // Majority vote to aggregate answers.
  29. MAJORITY_VOTE = 1;
  30. // Unanimous answers will be adopted.
  31. UNANIMOUS_VOTE = 2;
  32. // Preserve all answers by crowd compute.
  33. NO_AGGREGATION = 3;
  34. }
  35. // Configuration for how human labeling task should be done.
  36. message HumanAnnotationConfig {
  37. // Required. Instruction resource name.
  38. string instruction = 1 [(google.api.field_behavior) = REQUIRED];
  39. // Required. A human-readable name for AnnotatedDataset defined by
  40. // users. Maximum of 64 characters
  41. // .
  42. string annotated_dataset_display_name = 2 [(google.api.field_behavior) = REQUIRED];
  43. // Optional. A human-readable description for AnnotatedDataset.
  44. // The description can be up to 10000 characters long.
  45. string annotated_dataset_description = 3 [(google.api.field_behavior) = OPTIONAL];
  46. // Optional. A human-readable label used to logically group labeling tasks.
  47. // This string must match the regular expression `[a-zA-Z\\d_-]{0,128}`.
  48. string label_group = 4 [(google.api.field_behavior) = OPTIONAL];
  49. // Optional. The Language of this question, as a
  50. // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
  51. // Default value is en-US.
  52. // Only need to set this when task is language related. For example, French
  53. // text classification.
  54. string language_code = 5 [(google.api.field_behavior) = OPTIONAL];
  55. // Optional. Replication of questions. Each question will be sent to up to
  56. // this number of contributors to label. Aggregated answers will be returned.
  57. // Default is set to 1.
  58. // For image related labeling, valid values are 1, 3, 5.
  59. int32 replica_count = 6 [(google.api.field_behavior) = OPTIONAL];
  60. // Optional. Maximum duration for contributors to answer a question. Maximum
  61. // is 3600 seconds. Default is 3600 seconds.
  62. google.protobuf.Duration question_duration = 7 [(google.api.field_behavior) = OPTIONAL];
  63. // Optional. If you want your own labeling contributors to manage and work on
  64. // this labeling request, you can set these contributors here. We will give
  65. // them access to the question types in crowdcompute. Note that these
  66. // emails must be registered in crowdcompute worker UI:
  67. // https://crowd-compute.appspot.com/
  68. repeated string contributor_emails = 9 [(google.api.field_behavior) = OPTIONAL];
  69. // Email of the user who started the labeling task and should be notified by
  70. // email. If empty no notification will be sent.
  71. string user_email_address = 10;
  72. }
  73. // Config for image classification human labeling task.
  74. message ImageClassificationConfig {
  75. // Required. Annotation spec set resource name.
  76. string annotation_spec_set = 1 [(google.api.field_behavior) = REQUIRED];
  77. // Optional. If allow_multi_label is true, contributors are able to choose
  78. // multiple labels for one image.
  79. bool allow_multi_label = 2 [(google.api.field_behavior) = OPTIONAL];
  80. // Optional. The type of how to aggregate answers.
  81. StringAggregationType answer_aggregation_type = 3 [(google.api.field_behavior) = OPTIONAL];
  82. }
  83. // Config for image bounding poly (and bounding box) human labeling task.
  84. message BoundingPolyConfig {
  85. // Required. Annotation spec set resource name.
  86. string annotation_spec_set = 1 [(google.api.field_behavior) = REQUIRED];
  87. // Optional. Instruction message showed on contributors UI.
  88. string instruction_message = 2 [(google.api.field_behavior) = OPTIONAL];
  89. }
  90. // Config for image polyline human labeling task.
  91. message PolylineConfig {
  92. // Required. Annotation spec set resource name.
  93. string annotation_spec_set = 1 [(google.api.field_behavior) = REQUIRED];
  94. // Optional. Instruction message showed on contributors UI.
  95. string instruction_message = 2 [(google.api.field_behavior) = OPTIONAL];
  96. }
  97. // Config for image segmentation
  98. message SegmentationConfig {
  99. // Required. Annotation spec set resource name. format:
  100. // projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}
  101. string annotation_spec_set = 1 [(google.api.field_behavior) = REQUIRED];
  102. // Instruction message showed on labelers UI.
  103. string instruction_message = 2;
  104. }
  105. // Config for video classification human labeling task.
  106. // Currently two types of video classification are supported:
  107. // 1. Assign labels on the entire video.
  108. // 2. Split the video into multiple video clips based on camera shot, and
  109. // assign labels on each video clip.
  110. message VideoClassificationConfig {
  111. // Annotation spec set with the setting of allowing multi labels or not.
  112. message AnnotationSpecSetConfig {
  113. // Required. Annotation spec set resource name.
  114. string annotation_spec_set = 1 [(google.api.field_behavior) = REQUIRED];
  115. // Optional. If allow_multi_label is true, contributors are able to
  116. // choose multiple labels from one annotation spec set.
  117. bool allow_multi_label = 2 [(google.api.field_behavior) = OPTIONAL];
  118. }
  119. // Required. The list of annotation spec set configs.
  120. // Since watching a video clip takes much longer time than an image, we
  121. // support label with multiple AnnotationSpecSet at the same time. Labels
  122. // in each AnnotationSpecSet will be shown in a group to contributors.
  123. // Contributors can select one or more (depending on whether to allow multi
  124. // label) from each group.
  125. repeated AnnotationSpecSetConfig annotation_spec_set_configs = 1 [(google.api.field_behavior) = REQUIRED];
  126. // Optional. Option to apply shot detection on the video.
  127. bool apply_shot_detection = 2 [(google.api.field_behavior) = OPTIONAL];
  128. }
  129. // Config for video object detection human labeling task.
  130. // Object detection will be conducted on the images extracted from the video,
  131. // and those objects will be labeled with bounding boxes.
  132. // User need to specify the number of images to be extracted per second as the
  133. // extraction frame rate.
  134. message ObjectDetectionConfig {
  135. // Required. Annotation spec set resource name.
  136. string annotation_spec_set = 1 [(google.api.field_behavior) = REQUIRED];
  137. // Required. Number of frames per second to be extracted from the video.
  138. double extraction_frame_rate = 3 [(google.api.field_behavior) = REQUIRED];
  139. }
  140. // Config for video object tracking human labeling task.
  141. message ObjectTrackingConfig {
  142. // Required. Annotation spec set resource name.
  143. string annotation_spec_set = 1 [(google.api.field_behavior) = REQUIRED];
  144. }
  145. // Config for video event human labeling task.
  146. message EventConfig {
  147. // Required. The list of annotation spec set resource name. Similar to video
  148. // classification, we support selecting event from multiple AnnotationSpecSet
  149. // at the same time.
  150. repeated string annotation_spec_sets = 1 [(google.api.field_behavior) = REQUIRED];
  151. }
  152. // Config for text classification human labeling task.
  153. message TextClassificationConfig {
  154. // Optional. If allow_multi_label is true, contributors are able to choose
  155. // multiple labels for one text segment.
  156. bool allow_multi_label = 1 [(google.api.field_behavior) = OPTIONAL];
  157. // Required. Annotation spec set resource name.
  158. string annotation_spec_set = 2 [(google.api.field_behavior) = REQUIRED];
  159. // Optional. Configs for sentiment selection.
  160. SentimentConfig sentiment_config = 3 [(google.api.field_behavior) = OPTIONAL];
  161. }
  162. // Config for setting up sentiments.
  163. message SentimentConfig {
  164. // If set to true, contributors will have the option to select sentiment of
  165. // the label they selected, to mark it as negative or positive label. Default
  166. // is false.
  167. bool enable_label_sentiment_selection = 1;
  168. }
  169. // Config for text entity extraction human labeling task.
  170. message TextEntityExtractionConfig {
  171. // Required. Annotation spec set resource name.
  172. string annotation_spec_set = 1 [(google.api.field_behavior) = REQUIRED];
  173. }