aboutsummaryrefslogtreecommitdiff
path: root/google/cloud/datalabeling/v1beta1/human_annotation_config.proto
blob: 96672aedaf535a684a97adfc8545d6dd8fc710a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.cloud.datalabeling.v1beta1;

import "google/protobuf/duration.proto";
import "google/api/annotations.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1;datalabeling";
option java_multiple_files = true;
option java_package = "com.google.cloud.datalabeling.v1beta1";


enum StringAggregationType {
  STRING_AGGREGATION_TYPE_UNSPECIFIED = 0;

  // Majority vote to aggregate answers.
  MAJORITY_VOTE = 1;

  // Unanimous answers will be adopted.
  UNANIMOUS_VOTE = 2;

  // Preserve all answers by crowd compute.
  NO_AGGREGATION = 3;
}

// Configuration for how human labeling task should be done.
message HumanAnnotationConfig {
  // Required except for LabelAudio case. Instruction resource name.
  string instruction = 1;

  // Required. A human-readable name for AnnotatedDataset defined by
  // users. Maximum of 64 characters
  // .
  string annotated_dataset_display_name = 2;

  // Optional. A human-readable description for AnnotatedDataset.
  // The description can be up to 10000 characters long.
  string annotated_dataset_description = 3;

  // Optional. A human-readable label used to logically group labeling tasks.
  // This string must match the regular expression `[a-zA-Z\\d_-]{0,128}`.
  string label_group = 4;

  // Optional. The Language of this question, as a
  // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
  // Default value is en-US.
  // Only need to set this when task is language related. For example, French
  // text classification or Chinese audio transcription.
  string language_code = 5;

  // Optional. Replication of questions. Each question will be sent to up to
  // this number of contributors to label. Aggregated answers will be returned.
  // Default is set to 1.
  // For image related labeling, valid values are 1, 3, 5.
  int32 replica_count = 6;

  // Optional. Maximum duration for contributors to answer a question. Default
  // is 1800 seconds.
  google.protobuf.Duration question_duration = 7;

  // Optional. If you want your own labeling contributors to manage and work on
  // this labeling request, you can set these contributors here. We will give
  // them access to the question types in crowdcompute. Note that these
  // emails must be registered in crowdcompute worker UI:
  // https://crowd-compute.appspot.com/
  repeated string contributor_emails = 9;
}

// Config for image classification human labeling task.
message ImageClassificationConfig {
  // Required. Annotation spec set resource name.
  string annotation_spec_set = 1;

  // Optional. If allow_multi_label is true, contributors are able to choose
  // multiple labels for one image.
  bool allow_multi_label = 2;

  // Optional. The type of how to aggregate answers.
  StringAggregationType answer_aggregation_type = 3;
}

// Config for image bounding poly (and bounding box) human labeling task.
message BoundingPolyConfig {
  // Required. Annotation spec set resource name.
  string annotation_spec_set = 1;

  // Optional. Instruction message showed on contributors UI.
  string instruction_message = 2;
}

// Config for image polyline human labeling task.
message PolylineConfig {
  // Required. Annotation spec set resource name.
  string annotation_spec_set = 1;

  // Optional. Instruction message showed on contributors UI.
  string instruction_message = 2;
}

// Config for image segmentation
message SegmentationConfig {
  // Required. Annotation spec set resource name. format:
  // projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}
  string annotation_spec_set = 1;

  // Instruction message showed on labelers UI.
  string instruction_message = 2;
}

// Config for video classification human labeling task.
// Currently two types of video classification are supported:
// 1. Assign labels on the entire video.
// 2. Split the video into multiple video clips based on camera shot, and
// assign labels on each video clip.
message VideoClassificationConfig {
  // Annotation spec set with the setting of allowing multi labels or not.
  message AnnotationSpecSetConfig {
    // Required. Annotation spec set resource name.
    string annotation_spec_set = 1;

    // Optional. If allow_multi_label is true, contributors are able to
    // choose multiple labels from one annotation spec set.
    bool allow_multi_label = 2;
  }

  // Required. The list of annotation spec set configs.
  // Since watching a video clip takes much longer time than an image, we
  // support label with multiple AnnotationSpecSet at the same time. Labels
  // in each AnnotationSpecSet will be shown in a group to contributors.
  // Contributors can select one or more (depending on whether to allow multi
  // label) from each group.
  repeated AnnotationSpecSetConfig annotation_spec_set_configs = 1;

  // Optional. Option to apply shot detection on the video.
  bool apply_shot_detection = 2;
}

// Config for video object detection human labeling task.
// Object detection will be conducted on the images extracted from the video,
// and those objects will be labeled with bounding boxes.
// User need to specify the number of images to be extracted per second as the
// extraction frame rate.
message ObjectDetectionConfig {
  // Required. Annotation spec set resource name.
  string annotation_spec_set = 1;

  // Optional. Instruction message showed on labelers UI.
  string instruction_message = 2;

  // Required. Number of frames per second to be extracted from the video.
  double extraction_frame_rate = 3;
}

// Config for video object tracking human labeling task.
message ObjectTrackingConfig {
  // Required. Annotation spec set resource name.
  string annotation_spec_set = 1;
}

// Config for video event human labeling task.
message EventConfig {
  // Required. The list of annotation spec set resource name. Similar to video
  // classification, we support selecting event from multiple AnnotationSpecSet
  // at the same time.
  repeated string annotation_spec_sets = 1;
}

// Config for text classification human labeling task.
message TextClassificationConfig {
  // Optional. If allow_multi_label is true, contributors are able to choose
  // multiple labels for one text segment.
  bool allow_multi_label = 1;

  // Required. Annotation spec set resource name.
  string annotation_spec_set = 2;

  // Optional. Configs for sentiment selection.
  SentimentConfig sentiment_config = 3;
}

// Config for setting up sentiments.
message SentimentConfig {
  // If set to true, contributors will have the option to select sentiment of
  // the label they selected, to mark it as negative or positive label. Default
  // is false.
  bool enable_label_sentiment_selection = 1;
}

// Config for text entity extraction human labeling task.
message TextEntityExtractionConfig {
  // Required. Annotation spec set resource name.
  string annotation_spec_set = 1;
}