Adding Samples in Batches
Function
This API is used to add samples in batches.
Debugging
You can debug this API through automatic authentication in or use the SDK sample code generated by API Explorer.
URI
POST /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 |
---|---|---|---|
final_annotation |
No |
Boolean |
Whether to directly import to the final result. Options: |
label_format |
No |
LabelFormat object |
Label format. This parameter is used only for text datasets. |
samples |
No |
Array of Sample objects |
Sample list. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
data |
No |
Object |
Byte data of sample files. The type is java.nio.ByteBuffer. When this parameter is called, the string converted from the byte data is uploaded. |
data_source |
No |
DataSource object |
Data source. |
encoding |
No |
String |
Encoding type of sample files, which is used to upload .txt or .csv files. The value can be UTF-8, GBK, or GB2312. The default value is UTF-8. |
labels |
No |
Array of SampleLabel objects |
Sample label list. |
metadata |
No |
SampleMetadata object |
Key-value pair of the sample metadata attribute. |
name |
No |
String |
Name of sample files. The value contains 0 to 1,024 characters and cannot contain special characters (!<>=&"'). |
sample_type |
No |
Integer |
Sample type. Options: |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
data_path |
No |
String |
Data source path. |
data_type |
No |
Integer |
Data type. Options: |
schema_maps |
No |
Array of SchemaMap objects |
Schema mapping information corresponding to the table data. |
source_info |
No |
SourceInfo object |
Information required for importing a table data source. |
with_column_header |
No |
Boolean |
Whether the first row in the file is a column name. This field is valid for the table dataset. Options: |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
dest_name |
No |
String |
Name of the destination column. |
src_name |
No |
String |
Name of the source column. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
cluster_id |
No |
String |
MRS cluster ID. You can log in to the MRS console to view the information. |
cluster_mode |
No |
String |
Running mode of an MRS cluster. Options: |
cluster_name |
No |
String |
MRS cluster name You can log in to the MRS console to view the information. |
database_name |
No |
String |
Name of the database to which the table dataset is imported. |
input |
No |
String |
HDFS path of the table data set. For example, /datasets/demo. |
ip |
No |
String |
IP address of your GaussDB(DWS) cluster. |
port |
No |
String |
Port number of your GaussDB(DWS) cluster. |
queue_name |
No |
String |
DLI queue name of a table dataset. |
subnet_id |
No |
String |
Subnet ID of an MRS cluster. |
table_name |
No |
String |
Name of the table to which a table dataset is imported. |
user_name |
No |
String |
Username, which is mandatory for GaussDB(DWS) data. |
user_password |
No |
String |
User password, which is mandatory for GaussDB(DWS) data. |
vpc_id |
No |
String |
ID of the VPC where an MRS cluster resides. |
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: |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
results |
Array of UploadSampleResp objects |
Response list for adding samples in batches. |
success |
Boolean |
Whether the operation is successful. Options: |
Example Requests
Adding Samples in Batches
{ "samples" : [ { "name" : "2.jpg", "data" : "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAA1AJUDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL" } ] }
Example Responses
Status code: 200
OK
{ "success" : true, "results" : [ { "success" : true, "name" : "/test-obs/classify/input/animals/2.jpg", "info" : "960585877c92d63911ba555ab3129d36" } ] }
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.