Updating Sample Labels in Batches¶
Function¶
This API is used to update sample labels in batches, including adding, modifying, and deleting sample labels. If the parameter Labels of a sample in the request body is not specified, the label of the sample is deleted.
Debugging¶
You can debug this API through automatic authentication in or use the SDK sample code generated by API Explorer.
URI¶
PUT /v2/{project_id}/datasets/{dataset_id}/data-annotations/samples
Parameter | Mandatory | Type | Description |
---|---|---|---|
dataset_id | Yes | String | Dataset ID. |
project_id | Yes | String | Project ID. For details about how to obtain a project ID, see Obtaining a Project ID and Name. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
No | String | Email address of a labeling team member. | |
samples | No | Array of SampleLabels objects | Updated sample list. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
labels | No | Array of SampleLabel objects | Sample label list. If this parameter is left blank, all sample labels are deleted. |
metadata | No | SampleMetadata object | Key-value pair of the sample metadata attribute. |
sample_id | No | String | Sample ID. |
sample_type | No | Integer | Sample type. Options:
|
sample_usage | No | String | Sample usage. Options:
|
source | No | String | Source address of sample data, which is obtained by invoking the sample list interface. |
worker_id | No | String | ID of a labeling team member. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
annotated_by | No | String | Video labeling method, which is used to distinguish whether a video is labeled manually or automatically. Options:
|
id | No | String | Label ID. |
name | No | String | Label name. |
property | No | SampleLabelProperty object | Attribute key-value pair of the sample label, such as the object shape and shape feature. |
score | No | Float | Confidence. The value range is [0,1]. |
type | No | Integer | Label type. Options:
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
@modelarts:content | No | String | Speech text content, which is a default attribute dedicated to the speech label (including the speech content and speech start and end points). |
@modelarts:end_index | No | Integer | End position of the text, which is a default attribute dedicated to the named entity label. The end position does not include the character corresponding to the value of end_index. Example:
|
@modelarts:end_time | No | String | Speech end time, which is a default attribute dedicated to the speech start/end point label, in the format of hh:mm:ss.SSS. (hh indicates hour; mm indicates minute; ss indicates second; and SSS indicates millisecond.) |
@modelarts:feature | No | Object | Shape feature, which is a default attribute dedicated to the object detection label, with type of List. The upper left corner of the image is used as the coordinate origin [0, 0]. Each coordinate point is represented by [x, y], where x indicates the horizontal coordinate and y indicates the vertical coordinate (both x and y are >=0). The format of each shape is as follows:
|
@modelarts:from | No | String | ID of the head entity in the triplet relationship label, which is a default attribute dedicated to the triplet relationship label. |
@modelarts:hard | No | String | Sample labeled as a hard sample or not, which is a default attribute. Options:
|
@modelarts:hard_coefficient | No | String | Coefficient of difficulty of each label level, which is a default attribute. The value range is [0,1]. |
@modelarts:hard_reasons | No | String | Reasons that the sample is a hard sample, which is a default attribute. Use a hyphen (-) to separate every two hard sample reason IDs, for example, 3-20-21-19. Options:
|
@modelarts:shape | No | String | Object shape, which is a default attribute dedicated to the object detection label and is left empty by default. Options:
|
@modelarts:source | No | String | Speech source, which is a default attribute dedicated to the speech start/end point label and can be set to a speaker or narrator. |
@modelarts:start_index | No | Integer | Start position of the text, which is a default attribute dedicated to the named entity label. The start value begins from 0, including the character corresponding to the value of start_index. |
@modelarts:start_time | No | String | Speech start time, which is a default attribute dedicated to the speech start/end point label, in the format of hh:mm:ss.SSS. (hh indicates hour; mm indicates minute; ss indicates second; and SSS indicates millisecond.) |
@modelarts:to | No | String | ID of the tail entity in the triplet relationship label, which is a default attribute dedicated to the triplet relationship label. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
@modelarts:import_origin | No | Integer | Sample source, which is a built-in attribute. |
@modelarts:hard | No | Double | Whether the sample is labeled as a hard sample, which is a default attribute. Options:
|
@modelarts:hard_coefficient | No | Double | Coefficient of difficulty of each sample level, which is a default attribute. The value range is [0,1]. |
@modelarts:hard_reasons | No | Array of integers | ID of a hard sample reason, which is a default attribute. Options:
|
@modelarts:size | No | Array of objects | Image size (width, height, and depth of the image), which is a default attribute, with type of List<Integer>. In the list, the first number indicates the width (pixels), the second number indicates the height (pixels), and the third number indicates the depth (the depth can be left blank and the default value is 3). For example, [100,200,3] and [100,200] are both valid. Note: This parameter is mandatory only when the sample label list contains the object detection label. |
Response Parameters¶
Status code: 200
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
results | Array of BatchResponse objects | Response list for updating sample labels in batches. |
success | Boolean | Whether the operation is successful. Options:
|
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
success | Boolean | Check whether the operation is successful. Options:
|
Example Requests¶
Updating Sample Labels in Batches
{
"samples" : [ {
"sample_id" : "8b583c44bf249f8ba43ea42c92920221",
"labels" : [ {
"name" : "label1"
} ]
}, {
"sample_id" : "b5fe3039879660a2e6bf18166e247f68",
"labels" : [ {
"name" : "label1"
} ]
} ]
}
Example Responses¶
Status code: 200
OK
{
"success" : true
}
Status Codes¶
Status Code | Description |
---|---|
200 | OK |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
Error Codes¶
See Error Codes.