Asset

Properties


  • url Url This is generated by backend and expires after 1 hour. So this property might be out of date. Calling sync() 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

  • data_id UUID of Data of this Asset

  • 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 last annotation created on this asset.

Worker parameter is deprecated and cannot be used anymore. It will be removed in 6.27

Examples

some_annotation = one_asset.get_annotation()

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.

Worker parameter is deprecated and cannot be used anymore. It will be removed in 6.27

Examples

some_annotation = one_asset.create_annotation(0.120)

Arguments

  • duration (float, optional) : Duration of the annotation. Defaults to 0.0.

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.

Workers parameter is deprecated and cannot be used anymore. It will be removed in 6.27 If given, this method will raise, to prevent unexpected behaviour

⚠️ DANGER ZONE: Be careful here !

Examples

one_asset.delete_annotations()

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()