Creating a Dataset Label
Function
This API is used to create a dataset label.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
POST /v2/{project_id}/datasets/{dataset_id}/data-annotations/labels
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 |
---|---|---|---|
labels |
No |
Array of Label objects |
List of labels to be created. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
attributes |
No |
Array of LabelAttribute objects |
Multi-dimensional attribute of a label. For example, if the label is music, attributes such as style and artist may be included. |
name |
No |
String |
Label name. |
property |
No |
LabelProperty object |
Basic attribute key-value pair of a label, such as color and shortcut keys. |
type |
No |
Integer |
Label type. Options:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
default_value |
No |
String |
Default value of a label attribute. |
id |
No |
String |
Label attribute ID. You can query the tag by invoking the tag list. |
name |
No |
String |
Label attribute name. The value contains a maximum of 64 characters and cannot contain the character. <>=&"'. |
type |
No |
String |
Label attribute type. Options:
|
values |
No |
Array of LabelAttributeValue objects |
List of label attribute values. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
No |
String |
Label attribute value ID. |
value |
No |
String |
Label attribute value. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
@modelarts:color |
No |
String |
Default attribute: Label color, which is a hexadecimal code of the color. By default, this parameter is left blank. Example: #FFFFF0. |
@modelarts:default_shape |
No |
String |
Default attribute: Default shape of an object detection label (dedicated attribute). By default, this parameter is left blank. Options:
|
@modelarts:from_type |
No |
String |
Default attribute: Type of the head entity in the triplet relationship label. This attribute must be specified when a relationship label is created. This parameter is used only for the text triplet dataset. |
@modelarts:rename_to |
No |
String |
Default attribute: The new name of the label. |
@modelarts:shortcut |
No |
String |
Default attribute: Label shortcut key. By default, this parameter is left blank. For example: D. |
@modelarts:to_type |
No |
String |
Default attribute: Type of the tail entity in the triplet relationship label. This attribute must be specified when a relationship label is created. This parameter is used only for the text triplet dataset. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
results |
Array of BatchResponse objects |
Response body for creating a label. |
success |
Boolean |
Check whether the operation is successful. Options:
|
Example Requests
The following is an example of how to create a dataset label whose name is Cat and shape is bndbox for object detection by default.
{ "labels" : [ { "name" : "Cat", "property" : { "@modelarts:color" : "#3399ff", "@modelarts:default_shape" : "bndbox" } } ] }
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot