Quickstart#
To get you started quickly, let’s see an example of how to fetch some labels.
To use the Encord SDK to fetch your labels, you first install the SDK and add your public ssh key to the web-app. The following script then fetches the labels from a given project:
from encord import EncordUserClient, Project
user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
"<your_private_key_content>",
password="<your_private_key_password_if_necessary>",
)
# Get the project
project_hash: str = user_client.get_projects()[0]["project"]["project_hash"]
project: Project = user_client.get_project(project_hash)
# Get the labels (from one label_row, not entire set of labels from the project).
label_hash: str = next(
(
lr["label_hash"]
for lr in project.label_rows
if lr["label_hash"] is not None
)
)
labels: dict = project.get_label_row(label_hash)
print(labels)
{
"label_hash": "<label_hash>",
"dataset_hash": "<dataset_hash>",
"dataset_title": "<dataset_title>",
"data_title": "<video_file_name>",
"data_type": "video",
"data_units": {
"<data_unit_hash>": {
# ... data unit information ...
}
},
"object_answers": {
"<object_hash>": {
# ... nested classification information ...
}
},
"classification_answers": {
"<classification_hash>": {
# ... frame level classification information ...
},
},
"object_actions": {
"<object_hash>": {
# ... frame level action information ...
}
},
"label_status": "<label_status>",
}
Of course, many details are not expanded upon here. We encourage you to keep reading at the General Concepts page.