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