Dataset Items
A dataset version can contain many dataset items. Items are used to access and store the actual items in your dataset version such as images or text.
A dataset version can contain many dataset items. Items are used to access and store the actual items in your dataset version such as images or text.
Get dataset items
items = client.get_dataset_items(my_dataset.id, new_dataset_version.id)
Parameter | Type | Description |
---|
dataset_id | str | The dataset id |
dataset_version_id | str | The dataset version id |
params | dict | Additional query parameter: Default value: None Accepted keys:pageSize: int; Number of items to be returned. Default value: 10. pageCount: int: The number of the page you want to view. onlyUnlabelled: bool: If True only return items that are not labelled/annotated. labelId: str; Only return items that are labelled with this id. splitId: str; Only return items that are part of this split.
|
# All params are optional, but here we combine them together for demo purposes.
params = {
"onlyUnlabelled": True,
"pageSize": 25,
"pageCount": 0,
"labelId": new_label.id,
"splitId": my_split.id
}
client.get_dataset_items(my_dataset.id, new_dataset_version.id, params)
Create a dataset item
item = DatasetItem(
name= "An optional name",
splits= [my_split]
)
item = client.create_dataset_item(my_dataset.id, new_dataset_version.id, item)
Parameter | Type | Description |
---|
dataset_id | str | The dataset id |
dataset_version_id | str | The dataset version id |
item | DatasetItem | The dataset item object |
Dataset item properties in detail:
Property | Type | Description |
---|
id | str | Unique id for the dataset item |
created_at | str | The creation date |
updated_at | str | Last updated date |
name | str | An optional name |
description | str | The dataset item description |
user_id | str | The unique id of the dataset label creator |
splits | List[DatasetSplit] | The list of dataset splits the dataset item belongs to |
annotations | List[Annotation] | The list of annotations for the dataset item |
extension | str | The extension for the dataset item. |
Get a dataset item
item = client.get_dataset_item(my_dataset["id"], new_dataset_version["id"], item["id"])
Parameter | Type | Description |
---|
dataset_id | str | The dataset id |
dataset_version_id | str | The dataset version id |
item_id | str | The dataset item id |
Update a dataset item
item.description = "A better description"
client.update_dataset_item(my_dataset.id, new_dataset_version.id, item)
Parameter | Type | Description |
---|
dataset_id | str | The dataset id |
dataset_version_id | str | The dataset version id |
item | DatasetItem | The dataset item object |
Delete a dataset item
client.delete_dataset_item(my_dataset.id, new_dataset_version.id, item.id)
Parameter | Type | Description |
---|
dataset_id | str | The dataset id |
dataset_version_id | str | The dataset version id |
item | str | The dataset item id |
Upload a dataset item image
client.upload_dataset_item_image(my_dataset.id, new_dataset_version.id, item.id, folder="directory/to/item", filename="item_filename.jpg")
Parameter | Type | Description |
---|
dataset_id | str | The dataset id |
dataset_version_id | str | The dataset version id |
item | DatasetItem | The dataset item object |
Download a dataset item image
download_location = f"{item.id}.{item.extension}"
client.download_dataset_item_image(my_dataset.id, new_dataset_version.id, item.id, download_location, thumbnail=False)
Parameter | Type | Description |
---|
dataset_id | str | The dataset id |
dataset_version_id | str | The dataset version id |
item_id | str | The dataset item id |
download_location | str | The full location and filename of where to save the item image. |
thumbnail | bool | Flag indicating whether to download the full image or its thumbnail. |