Home

Bases: BaseModel

A dataset class representing a dataset in the Tenyks platform

Attributes:

NameTypeDescription
client Client The client to interact with the Tenyks API.
workspace_name strName of the workspace the dataset belongs to.
key strKey of the dataset.
name strName of the dataset.
owner strOwner of the dataset.
owner_email EmailStr Owner email of the dataset.
created_at datetime Creation timestamp of the dataset.
images_location Optional [ Union [ AWSLocation , AzureLocation , GCSLocation ]]Directory location of the images of the dataset.
metadata_location Optional [ Union [ AWSLocation , AzureLocation , GCSLocation ]]Directory location of the metadata of the dataset.
categories List [ Category ]Categories/classes of the dataset.
models List Names of the models of the dataset.
status strStatus of the dataset.
n_images intNumber of images in the dataset.
iou_threshold floatIOU threshold set for the dataset.

add_image

add_image ( image_path , annotations = None , tags = None , verbose = False )

Add an image to the dataset along with its annotations and tags.

Parameters:

NameTypeDescriptionDefault
image_pathstrThe path of the image to add.required
annotationsOptional [ List [ Annotation ]]The annotations to add to the image. Defaults to None.None
tagsOptional [ List [ Tag ]]The tags to add to the image. Defaults to None.None
verboseOptional [bool]If True, provides progress updates. Defaults to False.False

count_images

count_images ( filter = None , model_key = None )

Return image count that match the filter criteria.

Parameters:

NameTypeDescriptionDefault
filterOptional [str]Filter conditions for counting. Defaults to None.None
model_keyOptional [str]Model key to filter images. Defaults to None.None

Returns:

NameTypeDescription
intintNumber of images that match the filter criteria.

create_model

create_model ( name , confidence_threshold = None , iou_threshold = None )

Create a new model for the dataset.

Parameters:

NameTypeDescriptionDefault
namestrThe name of the new model.required
confidence_thresholdOptional [float]The confidence threshold for the model. Defaults to None.None
iou_thresholdOptional [float]The IOU threshold for the model. Defaults to None.None

Returns:

NameTypeDescription
ModelModel The newly created model.

delete_model

delete_model ( key )

Delete a model from the dataset.

Parameters:

NameTypeDescriptionDefault
keystrThe key of the model to delete.required

get_category_by_id

get_category_by_id ( category_id )

Retrieve a category by its ID.

Parameters:

NameTypeDescriptionDefault
category_idintThe ID of the category to retrieve.required

Returns:

NameTypeDescription
CategoryCategory The category corresponding to the given ID.

get_category_by_name

get_category_by_name ( category_name )

Retrieve a category by its name.

Parameters:

NameTypeDescriptionDefault
category_namestrThe name of the category to retrieve.required

Returns:

NameTypeDescription
CategoryCategory The category corresponding to the given name.

get_image_by_key

get_image_by_key ( image_key )

Retrieve an image by its key.

Parameters:

NameTypeDescriptionDefault
image_keystrThe key of the image to retrieve.required

Returns:

NameTypeDescription
ImageImage The image corresponding to the given key.

get_model

get_model ( key )

Retrieve a model by its key.

Parameters:

NameTypeDescriptionDefault
keystrThe key of the model to retrieve.required

Returns:

NameTypeDescription
ModelModel The model corresponding to the given key.

get_model_names

get_model_names ()

Retrieve the names of the models associated with the dataset.

Returns:

TypeDescription
List [str]List[str]: A list of model display names.

get_models

get_models ()

Retrieve the models associated with the dataset.

Returns:

TypeDescription
List [ Model ]List[Model]: A list of models associated with the dataset.

get_tag_by_key

get_tag_by_key ( tag_key )

Retrieve a tag by its key.

Parameters:

NameTypeDescriptionDefault
tag_keystrThe key of the tag to retrieve.required

Returns:

NameTypeDescription
TagTag The tag corresponding to the given key.

get_tag_by_name

get_tag_by_name ( tag_name )

Retrieve a tag by its display name.

Parameters:

NameTypeDescriptionDefault
tag_namestrThe name of the tag to retrieve.required

Returns:

NameTypeDescription
TagTag The tag corresponding to the given display name.

get_tags

get_tags ()

Retrieve the tags associated with the dataset.

Returns:

TypeDescription
List [ Tag ]List[Tag]: A list of tags created for the dataset.

head

head ( n = 5 )

Retrieve the first few images from the dataset.

Parameters:

NameTypeDescriptionDefault
nintThe number of images to retrieve. Defaults to 5.5

Returns:

TypeDescription
List [ Image ]List[Image]: A list of the first n images in the dataset.

images_generator

images_generator ( filter = None , sort_by = None , model_key = None , page_size = 250 )

Generator to retrieve images from the dataset in a paginated manner.

Parameters:

NameTypeDescriptionDefault
filterOptional [str]Filter conditions for the search. Defaults to None.None
sort_byOptional [str]Sort criteria for the search. Defaults to None.None
model_keyOptional [str]Model key to filter images. Defaults to None.None
page_sizeOptional [int]Number of images per page. Defaults to 250.250

Yields:

NameTypeDescription
GeneratorGenerator A generator yielding images.

ingest

ingest ( import_operation = None , verbose = True )

Trigger the ingestion process for the dataset.

Parameters:

NameTypeDescriptionDefault
import_operationOptional [str]The import operation type. Defaults to None.None
verboseOptional [bool]If True, provides progress updates. Defaults to True.True

search_images

search_images ( n_images = 250 , filter = None , sort_by = None , model_key = None )

Perform image search in the dataset based on filters.

Parameters:

NameTypeDescriptionDefault
n_imagesOptional [int]The number of images to retrieve. Defaults to 250.250
filterOptional [str]Filter conditions for the search. Defaults to None.None
sort_byOptional [str]Sort criteria for the search. Defaults to None.None
model_keyOptional [str]Model key to filter images. Defaults to None.None

Returns:

TypeDescription
List [ Image ]List[Image]: A list of images that match the search criteria.

update_image

update_image ( image_key , annotations , tags = None , verbose = False )

Update an existing image's annotations and tags.

Parameters:

NameTypeDescriptionDefault
image_keystrThe key of the image to update.required
annotationsList [ Annotation ]The new annotations for the image.required
tagsOptional [ List [ Tag ]]The new tags for the image. Defaults to None.None
verboseOptional [bool]If True, provides progress updates. Defaults to False.False

upload_annotations

upload_annotations ( coco_path_or_dict , verbose = True )

Upload annotations to the dataset.

Parameters:

NameTypeDescriptionDefault
coco_path_or_dictUnion [str, dict]The file path or dictionary of COCO annotations to upload.required
verboseOptional [bool]If True, provides progress updates. Defaults to True.True

upload_annotations_from_cloud

upload_annotations_from_cloud ( coco_file_location )

Upload annotations to the dataset from a cloud location.

Parameters:

NameTypeDescriptionDefault
coco_file_locationUnion [ AWSLocation , AzureLocation , GCSLocation ]The cloud location of the COCO annotations to upload.required

upload_custom_embeddings

upload_custom_embeddings ( embedding_type , embedding_name , embedding_location , embedding_filename = None , file_extension = 'arrow' )

Upload custom embeddings to the dataset for use in Embedding viewer.

Parameters:

NameTypeDescriptionDefault
embedding_typestrThe type of embeddings. At present only 'images' is supported. 'annotations'/'predictions' coming soon!required
embedding_namestrThe display name of the embeddings.required
embedding_locationdictThe location of the embeddings in cloud storage.required
embedding_filenamestrThe filename for JSON conversion. Defaults to None.None
file_extensionstrThe file extension (either 'json' or 'arrow'). Defaults to "arrow".'arrow'

upload_custom_embeddings_from_local

upload_custom_embeddings_from_local ( embedding_type , embedding_name , embedding_filepath , embedding_filename = None , file_extension = 'json' )

Upload custom embeddings from a local file to the dataset.

Parameters:

NameTypeDescriptionDefault
embedding_typestrThe type of embeddings. At present only 'images' is supported. 'annotations'/'predictions' coming soon!required
embedding_namestrThe display name of the embeddings.required
embedding_filepathstrThe path to the local file containing the embeddings.required
embedding_filenamestrThe filename for JSON conversion. Defaults to None.None
file_extensionstrThe file extension (only 'json' is supported for local uploads). Defaults to "json".'json'

upload_images

upload_images ( image_directory_or_paths , verbose = True )

Upload images to the dataset.

Parameters:

NameTypeDescriptionDefault
image_directory_or_pathsUnion [str, Path , List [str]]The directory or paths of the images to upload.required
verboseOptional [bool]If True, provides progress updates. Defaults to True.True