Properties
-
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 if this is an Image. -
height
Height of this Asset if this is an Image. -
duration
Duration of this Asset if this is a Video.
Methods
reset_url
reset_url()
Description
Reset url of this object
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])
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 tags as Tag
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 tag of this asset
tags = asset.get_data_tags()
assert tags[0].name == "bicycle"
Returns
List of tags as Tag
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
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)
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()
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()
Properties
Methods
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])
copy
copy()
Description
split
split(
ratio: float
)
Description
delete
delete()
Description
Delete assets from their dataset
DANGER ZONE: Be very careful here!
Remove these assets and its annotation from the dataset it belongs
Examples
some_assets = dataset.list_assets()[:10]
some_assets.delete()
download
download(
target_path: Union[str, Path] = './', force_replace: bool = False,
max_workers: Optional[int] = None
)
Description
Download this multi asset in given target path
Examples
bunch_of_assets = client.get_dataset("foo_dataset").get_version("first").list_assets()
bunch_of_assets.download('./downloads/')
Arguments
-
target_path (str or Path, optional) : Target path where to download. Defaults to './'.
-
max_workers (int, optional) : Number of max workers used to download. Defaults to os.cpu_count() + 4.
-
force_replace : (bool, optional): Replace an existing file if exists. Defaults to False.
delete_annotations
delete_annotations(
workers: Optional[List[Worker]] = None
)
Description
Delete all annotations of all these assets: it will erase every shape of every annotation of every asset.
You can give workers on which it will be effectively erased.
DANGER ZONE: Be careful here !
Examples
multiple_assets.delete_annotations(workers=)
as_list_of_data
as_list_of_data()
Description
Convert a MultiAsset into a List of Data. Assets can come from different Datalake.
This is slower than calling .as_multidata(), so if you know that all your data are coming
from the same datalake, you should call .as_multidata instead
Returns
a list of Data object
as_multidata
as_multidata(
force_refresh: bool = True
)
Description
Convert a MultiAsset into a MultiData.
Assets must all be in the same datalake to be retrieved.
In case of a dataset with multiple datalake source, you can use .as_list_of_data() that will return a list of data but slower
Args
- force_refresh (bool, optional) : when False, will not refresh data by calling platform.
Returns
a MultiData object