Properties
url
Url
This is generated by backend and expires after 1 hour. So this property might be out of date.
Callingsync()
method will retrieve a new url when expired.
id
Id
object_name
Object name
filename
Filename
large
If true, this (Object) has a large size
-
dataset_version_id
UUID of DatasetVersion where this Asset is -
object_name
Object name of this Asset -
filename
Filename of this Asset -
large
If true, this Asset file is considered large -
type
Type of this Asset -
width
Width of this Asset. -
height
Height of this Asset. -
content_type
Content type of this Asset. -
duration
This field is no longer supported -
metadata
Metadata of this Data. Can be None -
embeddings
Embeddings of this Asset. Can be None if asset was not indexed
Methods
reset_url
reset_url()
Description
Reset url of this object
download
download(
target_path: Union[str, Path] = './', force_replace: bool = False,
use_id: bool = False
)
Description
Download this object into given target_path
Examples
data = clt.get_datalake().list_data(limit=1)
data.download('./data/')
Arguments
-
target_path (str, optional) : Target path where data will be downloaded. Defaults to './'.
-
force_replace (bool, optional) : Replace an existing file if exists. Defaults to False.
-
use_id (bool, optional) : If true, will download file with id and extension as file name. Defaults to False.
add_tags
add_tags(
tags: Union[Tag, list[Tag]]
)
Description
Add some tags to an object.
It can be used on Data/MultiData/Asset/MultiAsset/DatasetVersion/Dataset/Model/ModelVersion.
You can give a Tag or a list of Tag.
Examples
tag_bicycle = client.create_tag("bicycle", Target.DATA)
tag_car = client.create_tag("car", Target.DATA)
tag_truck = client.create_tag("truck", Target.DATA)
data.add_tags(tag_bicycle)
data.add_tags([tag_car, tag_truck])
remove_tags
remove_tags(
tags: Union[Tag, list[Tag]]
)
Description
Remove some tags from an object (can be used on Data/Asset/DatasetVersion/Dataset/Model/ModelVersion)
You can give a Tag or a list of Tag.
Examples
data.remove_tags(tag_bicycle)
data.remove_tags([tag_car, tag_truck])
reset_url
reset_url()
Description
Reset url property of this Asset by calling platform.
Returns
A url as str of this Asset.
to_data_schema
to_data_schema()
Description
get_tags
get_tags()
Description
Retrieve the tags of your asset.
Examples
tags = asset.get_tags()
assert tags[0].name == "bicycle"
Returns
List of Tag objects
get_data
get_data()
Description
Retrieve data of this asset
data = asset.get_data()
assert data.id == asset.data_id
assert data.filename == asset.filename
Returns
A Data object
get_data_tags
get_data_tags()
Description
Retrieve data tags of this asset
tags = asset.get_data_tags()
assert tags[0].name == "bicycle"
Returns
List of Tag objects
get_annotation
get_annotation(
worker: Optional[Worker] = None
)
Description
Retrieve the annotation of this asset by the given worker (if none given, it is the current user)
Examples
some_annotation = one_asset.get_annotation(my_worker)
my_annotation = one_asset.get_annotation()
assert some_annotation == my_annotation
Arguments
- worker (Worker, optional) : Worker who created the annotation. Defaults to None.
Returns
An object Annotation
create_annotation
create_annotation(
duration: Union[float, int] = 0.0, worker: Optional[Worker] = None
)
Description
Create an annotation on this asset
Examples
some_annotation = one_asset.create_annotation(0.120, my_worker_1)
Arguments
-
duration (float, optional) : Duration of the annotation. Defaults to 0.0.
-
worker (Worker, optional) : Worker who created the annotation. Defaults to None.
Returns
An object Annotation
list_annotations
list_annotations()
Description
List all annotation of an asset
Examples
annotations = one_asset.list_annotations()
Returns
A list of Annotation
delete_annotations
delete_annotations(
workers: Optional[list[Worker]] = None
)
Description
Delete all annotations of an asset: it will erase every shape of every annotation.
You can give workers on which it will be effectively erased.
⚠️ DANGER ZONE: Be careful here !
Examples
one_asset.delete_annotations()
Arguments
- workers (list[Worker], optional) : List of workers on which it will be effectively erased. Defaults to None.
delete
delete()
Description
Delete this asset from its dataset
⚠️ DANGER ZONE: Be very careful here!
Remove this asset and its annotation from the dataset it belongs
Examples
one_asset.delete()