1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package sagemaker 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/sagemaker/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Creates a job that uses workers to label the data objects in your input dataset. 15// You can use the labeled data to train machine learning models. You can select 16// your workforce from one of three providers: 17// 18// * A private workforce that you 19// create. It can include employees, contractors, and outside experts. Use a 20// private workforce when want the data to stay within your organization or when a 21// specific set of skills is required. 22// 23// * One or more vendors that you select from 24// the Amazon Web Services Marketplace. Vendors provide expertise in specific 25// areas. 26// 27// * The Amazon Mechanical Turk workforce. This is the largest workforce, 28// but it should only be used for public data or data that has been stripped of any 29// personally identifiable information. 30// 31// You can also use automated data labeling 32// to reduce the number of data objects that need to be labeled by a human. 33// Automated data labeling uses active learning to determine if a data object can 34// be labeled by machine or if it needs to be sent to a human worker. For more 35// information, see Using Automated Data Labeling 36// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-automated-labeling.html). 37// The data objects to be labeled are contained in an Amazon S3 bucket. You create 38// a manifest file that describes the location of each object. For more 39// information, see Using Input and Output Data 40// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-data.html). The output can 41// be used as the manifest file for another labeling job or as training data for 42// your machine learning models. You can use this operation to create a static 43// labeling job or a streaming labeling job. A static labeling job stops if all 44// data objects in the input manifest file identified in ManifestS3Uri have been 45// labeled. A streaming labeling job runs perpetually until it is manually stopped, 46// or remains idle for 10 days. You can send new data objects to an active 47// (InProgress) streaming labeling job in real time. To learn how to create a 48// static labeling job, see Create a Labeling Job (API) 49// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-create-labeling-job-api.html) 50// in the Amazon SageMaker Developer Guide. To learn how to create a streaming 51// labeling job, see Create a Streaming Labeling Job 52// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-streaming-create-job.html). 53func (c *Client) CreateLabelingJob(ctx context.Context, params *CreateLabelingJobInput, optFns ...func(*Options)) (*CreateLabelingJobOutput, error) { 54 if params == nil { 55 params = &CreateLabelingJobInput{} 56 } 57 58 result, metadata, err := c.invokeOperation(ctx, "CreateLabelingJob", params, optFns, c.addOperationCreateLabelingJobMiddlewares) 59 if err != nil { 60 return nil, err 61 } 62 63 out := result.(*CreateLabelingJobOutput) 64 out.ResultMetadata = metadata 65 return out, nil 66} 67 68type CreateLabelingJobInput struct { 69 70 // Configures the labeling task and how it is presented to workers; including, but 71 // not limited to price, keywords, and batch size (task count). 72 // 73 // This member is required. 74 HumanTaskConfig *types.HumanTaskConfig 75 76 // Input data for the labeling job, such as the Amazon S3 location of the data 77 // objects and the location of the manifest file that describes the data objects. 78 // You must specify at least one of the following: S3DataSource or 79 // SnsDataSource. 80 // 81 // * Use SnsDataSource to specify an SNS input topic for a 82 // streaming labeling job. If you do not specify and SNS input topic ARN, Ground 83 // Truth will create a one-time labeling job that stops after all data objects in 84 // the input manifest file have been labeled. 85 // 86 // * Use S3DataSource to specify an 87 // input manifest file for both streaming and one-time labeling jobs. Adding an 88 // S3DataSource is optional if you use SnsDataSource to create a streaming labeling 89 // job. 90 // 91 // If you use the Amazon Mechanical Turk workforce, your input data should 92 // not include confidential information, personal information or protected health 93 // information. Use ContentClassifiers to specify that your data is free of 94 // personally identifiable information and adult content. 95 // 96 // This member is required. 97 InputConfig *types.LabelingJobInputConfig 98 99 // The attribute name to use for the label in the output manifest file. This is the 100 // key for the key/value pair formed with the label that a worker assigns to the 101 // object. The LabelAttributeName must meet the following requirements. 102 // 103 // * The name 104 // can't end with "-metadata". 105 // 106 // * If you are using one of the following built-in 107 // task types 108 // (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-task-types.html), the 109 // attribute name must end with "-ref". If the task type you are using is not 110 // listed below, the attribute name must not end with "-ref". 111 // 112 // * Image semantic 113 // segmentation (SemanticSegmentation), and adjustment 114 // (AdjustmentSemanticSegmentation) and verification 115 // (VerificationSemanticSegmentation) labeling jobs for this task type. 116 // 117 // * Video 118 // frame object detection (VideoObjectDetection), and adjustment and verification 119 // (AdjustmentVideoObjectDetection) labeling jobs for this task type. 120 // 121 // * Video 122 // frame object tracking (VideoObjectTracking), and adjustment and verification 123 // (AdjustmentVideoObjectTracking) labeling jobs for this task type. 124 // 125 // * 3D point 126 // cloud semantic segmentation (3DPointCloudSemanticSegmentation), and adjustment 127 // and verification (Adjustment3DPointCloudSemanticSegmentation) labeling jobs for 128 // this task type. 129 // 130 // * 3D point cloud object tracking (3DPointCloudObjectTracking), 131 // and adjustment and verification (Adjustment3DPointCloudObjectTracking) labeling 132 // jobs for this task type. 133 // 134 // If you are creating an adjustment or verification 135 // labeling job, you must use a different LabelAttributeName than the one used in 136 // the original labeling job. The original labeling job is the Ground Truth 137 // labeling job that produced the labels that you want verified or adjusted. To 138 // learn more about adjustment and verification labeling jobs, see Verify and 139 // Adjust Labels 140 // (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-verification-data.html). 141 // 142 // This member is required. 143 LabelAttributeName *string 144 145 // The name of the labeling job. This name is used to identify the job in a list of 146 // labeling jobs. Labeling job names must be unique within an Amazon Web Services 147 // account and region. LabelingJobName is not case sensitive. For example, 148 // Example-job and example-job are considered the same labeling job name by Ground 149 // Truth. 150 // 151 // This member is required. 152 LabelingJobName *string 153 154 // The location of the output data and the Amazon Web Services Key Management 155 // Service key ID for the key used to encrypt the output data, if any. 156 // 157 // This member is required. 158 OutputConfig *types.LabelingJobOutputConfig 159 160 // The Amazon Resource Number (ARN) that Amazon SageMaker assumes to perform tasks 161 // on your behalf during data labeling. You must grant this role the necessary 162 // permissions so that Amazon SageMaker can successfully complete data labeling. 163 // 164 // This member is required. 165 RoleArn *string 166 167 // The S3 URI of the file, referred to as a label category configuration file, that 168 // defines the categories used to label the data objects. For 3D point cloud and 169 // video frame task types, you can add label category attributes and frame 170 // attributes to your label category configuration file. To learn how, see Create a 171 // Labeling Category Configuration File for 3D Point Cloud Labeling Jobs 172 // (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-point-cloud-label-category-config.html). 173 // For named entity recognition jobs, in addition to "labels", you must provide 174 // worker instructions in the label category configuration file using the 175 // "instructions" parameter: "instructions": {"shortInstruction":" 176 // Add header 177 // 178 // 179 // Add Instructions 180 // 181 // ", "fullInstruction":"Add additional instructions."}. For 182 // details and an example, see Create a Named Entity Recognition Labeling Job (API) 183 // (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-named-entity-recg.html#sms-creating-ner-api). 184 // For all other built-in task types 185 // (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-task-types.html) and custom 186 // tasks 187 // (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-custom-templates.html), 188 // your label category configuration file must be a JSON file in the following 189 // format. Identify the labels you want to use by replacing label_1, 190 // label_2,...,label_n with your label categories. { 191 // "document-version": 192 // "2018-11-28", 193 // 194 // "labels": [{"label": "label_1"},{"label": 195 // "label_2"},...{"label": "label_n"}] 196 // 197 // } Note the following about the label 198 // category configuration file: 199 // 200 // * For image classification and text classification 201 // (single and multi-label) you must specify at least two label categories. For all 202 // other task types, the minimum number of label categories required is one. 203 // 204 // * 205 // Each label category must be unique, you cannot specify duplicate label 206 // categories. 207 // 208 // * If you create a 3D point cloud or video frame adjustment or 209 // verification labeling job, you must include auditLabelAttributeName in the label 210 // category configuration. Use this parameter to enter the LabelAttributeName 211 // (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-LabelAttributeName) 212 // of the labeling job you want to adjust or verify annotations of. 213 LabelCategoryConfigS3Uri *string 214 215 // Configures the information required to perform automated data labeling. 216 LabelingJobAlgorithmsConfig *types.LabelingJobAlgorithmsConfig 217 218 // A set of conditions for stopping the labeling job. If any of the conditions are 219 // met, the job is automatically stopped. You can use these conditions to control 220 // the cost of data labeling. 221 StoppingConditions *types.LabelingJobStoppingConditions 222 223 // An array of key/value pairs. For more information, see Using Cost Allocation 224 // Tags 225 // (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html#allocation-what) 226 // in the Amazon Web Services Billing and Cost Management User Guide. 227 Tags []types.Tag 228 229 noSmithyDocumentSerde 230} 231 232type CreateLabelingJobOutput struct { 233 234 // The Amazon Resource Name (ARN) of the labeling job. You use this ARN to identify 235 // the labeling job. 236 // 237 // This member is required. 238 LabelingJobArn *string 239 240 // Metadata pertaining to the operation's result. 241 ResultMetadata middleware.Metadata 242 243 noSmithyDocumentSerde 244} 245 246func (c *Client) addOperationCreateLabelingJobMiddlewares(stack *middleware.Stack, options Options) (err error) { 247 err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateLabelingJob{}, middleware.After) 248 if err != nil { 249 return err 250 } 251 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateLabelingJob{}, middleware.After) 252 if err != nil { 253 return err 254 } 255 if err = addSetLoggerMiddleware(stack, options); err != nil { 256 return err 257 } 258 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 259 return err 260 } 261 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 262 return err 263 } 264 if err = addResolveEndpointMiddleware(stack, options); err != nil { 265 return err 266 } 267 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 268 return err 269 } 270 if err = addRetryMiddlewares(stack, options); err != nil { 271 return err 272 } 273 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 274 return err 275 } 276 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 277 return err 278 } 279 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 280 return err 281 } 282 if err = addClientUserAgent(stack); err != nil { 283 return err 284 } 285 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 286 return err 287 } 288 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 289 return err 290 } 291 if err = addOpCreateLabelingJobValidationMiddleware(stack); err != nil { 292 return err 293 } 294 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateLabelingJob(options.Region), middleware.Before); err != nil { 295 return err 296 } 297 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 298 return err 299 } 300 if err = addResponseErrorMiddleware(stack); err != nil { 301 return err 302 } 303 if err = addRequestResponseLogging(stack, options); err != nil { 304 return err 305 } 306 return nil 307} 308 309func newServiceMetadataMiddleware_opCreateLabelingJob(region string) *awsmiddleware.RegisterServiceMetadata { 310 return &awsmiddleware.RegisterServiceMetadata{ 311 Region: region, 312 ServiceID: ServiceID, 313 SigningName: "sagemaker", 314 OperationName: "CreateLabelingJob", 315 } 316} 317