Skip to main content

Labels

A label row has the attributes label_hash uid, data_title, data_type, data_units, and label_status.


{    'label_hash': label_hash (uid),    'data_title': data_title,    'data_type': data_type,    'data_units': data_units,    'object_answers': object_answers,    'classification_answers': classification_answers,    'label_status': label_status,}

A label row contains a data unit or a collection of data units and associated labels, and is specific to a data asset with type video or image group.

  1. A label row with a data asset of type video contains a single data unit.

  2. A label row with a data asset of type img_group contains any number of data units.

A data unit can have any number of vector labels (e.g. bounding box, polygon, keypoint) and classifications.

Getting label rows#

Project label row IDs (label_hash uid) are found in the project information, which also contain information about the data title (data_title), data type (data_type) and label status (label_status).


curl --location --request POST 'https://api.cord.tech/public' \--header 'Content-Type: application/json' \--header 'ResourceID: <resource_id>' \--header 'Authorization: <resource_api_key>' \--header 'Accept: application/json' \--data-raw '{    "query_type": "labelrow",    "query_method": "GET",    "values": {        "uid": "<label_hash>",        "payload": null    }}'

Equivalently using NodeJS with Axios:


var axios = require('axios');var data = JSON.stringify(  {    "query_type": "labelrow",    "query_method": "GET",    "values": {      "uid": "<label_hash>",      "payload": null    }  });
var config = {  method: 'post',  url: 'https://api.cord.tech/public',  headers: {    'Content-Type': 'application/json',    'ResourceID': '<resource_id>',    'Authorization': '<resource_api_key>',    'Accept': 'application/json'  },  data : data};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});

Saving label rows#

Labels are saved to their label row ID (label_hash uid) from a label row instance. In case you want to save labels for the data which was not labeled before, follow the steps under "Creating label rows" below.

Label rows have to be saved in the same format as fetched. Please click here for information on the label row structure.


curl --location --request POST 'https://api.cord.tech/public' \--header 'Content-Type: application/json' \--header 'ResourceID: <resource_id>' \--header 'Authorization: <resource_api_key>' \--header 'Accept: application/json' \--data-raw '{    "query_type": "labelrow",    "query_method": "POST",    "values": {        "uid": "<label_hash>",        "payload": {        "label_hash": "<label_hash>",        "data_units": {            "data_uid_1": {              ...,            },            "data_uid_2": {              ...,            }        },        "object_answers": {},        "classification_answers": {},        "label_status": "LABELLED"    }    }}'

Equivalently using NodeJS with Axios:


var axios = require('axios');var data = JSON.stringify(  {    "query_type": "labelrow",    "query_method":"POST",    "values": {      "uid": "<label_hash>",      "payload": {        "label_hash": "<label_hash>",        "data_units": {          "data_uid_1": {            ...          },          "data_uid_2": {            ...          },        },        "object_answers": {},        "classification_answers": {},        "label_status": "LABELLED"      }    }});
var config = {  method: 'post',  url: 'https://api.cord.tech/public',  headers: {    'Content-Type': 'application/json',    'ResourceID': '<resource_id>',    'Authorization': '<resource_api_key>',    'Accept': 'application/json'  },  data : data};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});

Creating a label row#

If you want to save labels to a unit of data (video, img_group) for which a label row (and thus a label_hash uid) does not exist yet, you need to create a label row associated with the data.

  1. Get the data_hash (data_hash uid) that you want to create labels for. For this, request all label rows and note the ones that are NOT_LABELLED under 'label_status' (or, where label_hash is None) following the instructions here.

  2. Create the label row:


curl --location --request POST 'https://api.cord.tech/public' \--header 'Content-Type: application/json' \--header 'ResourceID: <resource_id>' \--header 'Authorization: <resource_api_key>' \--header 'Accept: application/json' \--data-raw '{    "query_type": "labelrow",    "query_method": "PUT",    "values": {        "uid": "<data_hash>",        "payload": null    }}'

Equivalently using NodeJS with Axios:


var axios = require('axios');var data = JSON.stringify(  {    "query_type": "labelrow",    "query_method":"PUT",    "values": {      "uid": "<data_hash>",      "payload": null}    });
var config = {  method: 'post',  url: 'https://api.cord.tech/public',  headers: {    'Content-Type': 'application/json',    'ResourceID': '<resource_id>',    'Authorization': '<resource_api_key>',    'Accept': 'application/json'  },  data : data};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});

The request returns a label row instance.