AI Platform Data Labeling Service supports six types of image labeling tasks:
- Classification, where labelers assign one or more labels to each image.
- Bounding boxes, where labelers choose a label, then draw one or more bounding boxes to apply the label to the part(s) of the image.
- Oriented bounding box task, similar to bounding box tasks where the bounding boxes are x-axis aligned while oriented bounding box can be at any direction
- Bounding polygon, which is similar to bounding box, where labelers choose a label and draw closed polygons to apply the label to the part(s) of the image.
- Polyline tasks, similar to bounding box, where labelers choose a label and draw polylines to apply the label to the part(s) of the image. A polyline consists of a list of at least two points connected end-to-end by line segments.
- Segmentation tasks, where labelers generate masks for each label. The output is a color mapping table, which maps label to color.
Image classification tasks
Web UI
Open the Data Labeling Service UI.
Select Datasets from the left navigation.
The Datasets page shows the status of previously created datasets for the current project.
Click the name of the dataset you want to submit for labeling.
Datasets with status Import complete are available to submit. The Type of data column shows whether the dataset includes images, videos, or text.
On the Dataset detail page, click the Create labeling task button in the title bar.
On the New labeling task page, enter a name and description for the annotated dataset.
The annotated dataset is the version of this dataset after human labelers have labeled it.
From the Objective drop-down, select the type of labeling task you want performed on this dataset.
The drop-down list includes only the objectives available for the type of data in this dataset. If you don't see the objective you want, it probably means you've selected a dataset with a different type of data in it. Close the New labeling task page and select a different dataset.
From the Label set drop-down, select the label set you want the labelers to apply to data items in this set.
The drop-down list includes all label sets associated with this project. You must select a label set.
From the Instruction drop-down, choose the instructions you want to provide to the labelers working with this dataset.
The drop-down list includes all instructions associated with this project. You must include instructions in the labeling request.
From the labelers per data item drop-down, specify how many labelers you want to have review each item in the dataset.
The default is one, but you can request three or five labelers to label each item.
Click the check box to confirm that you understand how you will be charged for the labeling.
Click Create.
Command-line
Set the following environment variables:PROJECT_ID
variable to your Google Cloud project ID.-
DATASET_ID
variable to the ID of your dataset, from the response when you created the dataset. The ID appears at the end of the full dataset name:projects/PROJECT_ID/locations/us-central1/datasets/DATASET_ID
INSTRUCTION_RESOURCE_NAME
to the name of your instruction resource.ANNOTATION_SPEC_SET_RESOURCE_NAME
to the name of your label set resource.
curl -X POST -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json" \ https://datalabeling.googleapis.com/v1beta1/projects/${PROJECT_ID}/datasets/${DATASET_ID}/image:label \ -d '{ "basicConfig": { "instruction": "${INSTRUCTION_RESOURCE_NAME}", "annotatedDatasetDisplayName": "curl_testing_annotated_dataset", "labelGroup": "test_label_group", "replica_count": 1 }, "feature": "TEXT_CLASSIFICATION", "imageClassificationConfig": { "annotationSpecSet": "${ANNOTATION_SPEC_SET_RESOURCE_NAME}", }, }'
You should see output similar to the following. You can use the operation ID to get the status of the task. Getting the status of an operation is an example.
{ "name": "projects/data-labeling-codelab/operations/5c73dd6b_0000_2b34_a920_883d24fa2064", "metadata": { "@type": "type.googleapis.com/google.cloud.data-labeling.v1beta1.LabelImageClassificationOperationMetadata", "dataset": "projects/data-labeling-codelab/datasets/5c73db3d_0000_23e0_a25b_94eb2c119c4c" } }
Python
Before you can run this code example, you must install the Python Client Libraries.Java
Before you can run this code example, you must install the Java Client Libraries.Bounding boxes
Web UI
Open the Data Labeling Service UI.
Select Datasets from the left navigation.
The Datasets page shows the status of previously created datasets for the current project.
Click the name of the dataset you want to submit for labeling.
Datasets with status Import complete are available to submit. The Type of data column shows whether the dataset includes images, videos, or text.
On the Dataset detail page, click the Create labeling task button in the title bar.
On the New labeling task page, enter a name and description for the annotated dataset.
The annotated dataset is the version of this dataset after human labelers have labeled it.
From the Objective drop-down, select the type of labeling task you want performed on this dataset.
The drop-down list includes only the objectives available for the type of data in this dataset. If you don't see the objective you want, it probably means you've selected a dataset with a different type of data in it. Close the New labeling task page and select a different dataset.
From the Label set drop-down, select the label set you want the labelers to apply to data items in this set.
The drop-down list includes all label sets associated with this project. You must select a label set.
From the Instruction drop-down, choose the instructions you want to provide to the labelers working with this dataset.
The drop-down list includes all instructions associated with this project. You must include instructions in the labeling request.
From the labelers per data item drop-down, specify how many labelers you want to have review each item in the dataset.
The default is one, but you can request three or five labelers to label each item.
Click the check box to confirm that you understand how you will be charged for the labeling.
Click Create.
Command-line
Set the following environment variables:PROJECT_ID
variable to your Google Cloud project ID.-
DATASET_ID
variable to the ID of your dataset, from the response when you created the dataset. The ID appears at the end of the full dataset name:projects/PROJECT_ID/locations/us-central1/datasets/DATASET_ID
INSTRUCTION_RESOURCE_NAME
to the name of your instruction resource.ANNOTATION_SPEC_SET_RESOURCE_NAME
to the name of your label set resource.
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json" \ https://datalabeling.googleapis.com/v1beta1/projects/${PROJECT_ID}/datasets/${DATASET_ID}/image:label \ -d '{ "basicConfig": { "instruction": "${INSTRUCTION_RESOURCE_NAME}", "annotatedDatasetDisplayName": "curl_testing_annotated_dataset", "labelGroup": "test_label_group", "replica_count": 1 }, "feature": "BOUNDING_BOX", "boundingPolyConfig": { "annotationSpecSet": "${ANNOTATION_SPEC_SET_RESOURCE_NAME}", }, }'
You should see output similar to the following. You can use the operation ID to get the status of the task. Getting the status of an operation is an example.
{ "name": "projects/data-labeling-codelab/operations/5c73dd6b_0000_2b34_a920_883d24fa2064", "metadata": { "@type": "type.googleapis.com/google.cloud.data-labeling.v1beta1.LabelImageBoundingBoxOperationMetadata", "dataset": "projects/data-labeling-codelab/datasets/5c73db3d_0000_23e0_a25b_94eb2c119c4c" } }