spb_curate.curate.api package
Submodules
spb_curate.curate.api.abstract module
- class spb_curate.curate.api.abstract.BaseImageSource(*, type, **params)[source]
Bases:
SuperbAIObject
spb_curate.curate.api.curate module
- class spb_curate.curate.api.curate.Annotation(*, access_key=None, team_name=None, image_id=None, image_key=None, annotation_class, annotation_type=None, annotation_value, metadata, **params)[source]
Bases:
CreateResource,DeleteResource,ModifyResource,PaginateResource- classmethod create(*, access_key=None, team_name=None, dataset_id, image_id=None, image_key=None, annotation_class, annotation_type, annotation_value, metadata)[source]
Not implemented. Annotations can be created by
Annotation.create_bulk()orDataset.add_annotations().- Return type:
- classmethod create_bulk(*, access_key=None, team_name=None, dataset_id, annotations, asynchronous=True)[source]
Creates a job that adds newly initialized annotations to a dataset.
- Parameters:
dataset_id (
str) – The ID of the dataset to add the annotations to.annotations (
List[Annotation]) – Newly initialized annotations to add.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- delete(*, access_key=None, team_name=None)[source]
Deletes the annotation.
- Parameters:
access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- classmethod delete_bulk(*, access_key=None, team_name=None, dataset_id, annotations=None, annotation_ids=None, asynchronous=True)[source]
Creates a job that deletes annotations from a dataset.
- Parameters:
dataset_id (
str) – The ID of the dataset to delete annotations from.annotations (
Optional[List[Annotation]] (default:None)) – Annotations to delete.annotation_ids (
Optional[List[str]] (default:None)) – IDs of annotations to delete.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- classmethod delete_bulk_by_filters(*, access_key=None, team_name=None, dataset_id, query=None, slice=None, annotation_classes=None, annotation_types=None, asynchronous=True)[source]
Creates a job that deletes annotations from a dataset based on the provided filters. If none of query, slice, annotation_classes, or annotation_types is provided, all annotations in the dataset will be deleted.
- Parameters:
dataset_id (
str) – The ID of the dataset to delete annotations from.query (
Optional[str] (default:None)) – A query string to filter the annotations to delete.slice (
Optional[str] (default:None)) – The name of a slice to delete annotations from.annotation_classes (
Optional[List[str]] (default:None)) – A list of annotation classes to filter the annotations to delete.annotation_types (
Optional[List[str]] (default:None)) – A list of annotation types to filter the annotations to delete.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- classmethod fetch(*, access_key=None, team_name=None, id, dataset_id, image_id)[source]
Fetches an annotation.
- Parameters:
id (
str) – The ID of the annotation to fetch.dataset_id (
str) – The ID of the dataset with the image to fetch the annotation from.image_id (
str) – The ID of the image to fetch the annotation from.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The fetched annotation.
- classmethod fetch_all(*, access_key=None, team_name=None, dataset_id, query=None, slice=None, annotation_classes=None, annotation_types=None)[source]
Fetches annotations in a dataset that match the provided filters. If filters are not provided, fetches all annotations.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch annotations from.query (
Optional[str] (default:None)) – A query string to filter the annotations to fetch.slice (
Optional[str] (default:None)) – The name of a slice to fetch annotations from.annotation_classes (
Optional[List[str]] (default:None)) – A list of annotation classes to filter the annotations to fetch.annotation_types (
Optional[List[str]] (default:None)) – A list of annotation types to filter the annotations to fetch.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
List[Annotation]- Returns:
Matching annotations.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.QuerySyntaxError – When the provided
queryis syntactically incorrect.
- classmethod fetch_all_iter(*, access_key=None, team_name=None, dataset_id, query=None, slice=None, annotation_classes=None, annotation_types=None)[source]
Iterates through annotations in a dataset that match the provided filters. If filters are not provided, iterates through all annotations.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch annotations from.query (
Optional[str] (default:None)) – A query string to filter the annotations to fetch.slice (
Optional[str] (default:None)) – The name of a slice to fetch annotations from.annotation_classes (
Optional[List[str]] (default:None)) – A list of annotation classes to filter the annotations to fetch.annotation_types (
Optional[List[str]] (default:None)) – A list of annotation types to filter the annotations to fetch.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Annotation]- Returns:
The matching annotation iterator.
- Yields:
The next matching annotation.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.QuerySyntaxError – When the provided
queryis syntactically incorrect.
- classmethod fetch_page(*, access_key=None, team_name=None, dataset_id, query=None, slice=None, annotation_classes=None, annotation_types=None, search_after=None, limit=10)[source]
Fetches a page of annotations that match the provided filters. If filters are not provided, paginates all annotations.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch annotations from.query (
Optional[str] (default:None)) – A query string to filter the annotations to fetch.slice (
Optional[str] (default:None)) – The name of a slice to fetch annotations from.annotation_classes (
Optional[List[str]] (default:None)) – A list of annotation classes to filter the annotations to fetch.annotation_types (
Optional[List[str]] (default:None)) – A list of annotation types to filter the annotations to fetch.search_after (
Optional[str] (default:None)) – The ID of an annotation to start the search from. If not provided, fetches the first page.limit (
int(default:10)) – The maximum number of annotations in a page.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Dict[str,Union[int,List[str],List[Annotation]]]- Returns:
A page of matching annotations.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.QuerySyntaxError – When the provided
queryis syntactically incorrect.
- classmethod fetch_page_iter(*, access_key=None, team_name=None, dataset_id, query=None, slice=None, annotation_classes=None, annotation_types=None)[source]
Iterates through pages of annotations from a dataset that match the provided filters. If filters are not provided, paginates all annotations.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch annotations from.query (
Optional[str] (default:None)) – A query string to filter the annotations to fetch.slice (
Optional[str] (default:None)) – The name of a slice to fetch annotations from.annotation_classes (
Optional[List[str]] (default:None)) – A list of annotation classes to filter the annotations to fetch.annotation_types (
Optional[List[str]] (default:None)) – A list of annotation types to filter the annotations to fetch.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Dict[str,Union[int,List[str],List[Annotation]]]]- Returns:
The matching annotation page iterator.
- Yields:
The next page of matching annotations.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.QuerySyntaxError – When the provided
queryis syntactically incorrect.
- modify(*, access_key=None, team_name=None, metadata=None)[source]
Modifies the annotation.
- Parameters:
metadata (
Optional[dict] (default:None)) – The metadata associated with the annotation. Must be flat (one level deep).access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- refresh(*, access_key=None, team_name=None)[source]
Refreshes the annotation.
- Parameters:
access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- class spb_curate.curate.api.curate.Dataset(id=None, access_key=None, team_name=None, **params)[source]
Bases:
CreateResource,DeleteResource,PaginateResource,ModifyResource- add_annotations(*, access_key=None, team_name=None, annotations, asynchronous=True)[source]
Creates a job that adds newly initialized annotations to the dataset.
- Parameters:
annotations (
List[Annotation]) – Newly initialized annotations to add.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- add_images(*, access_key=None, team_name=None, images, slice=None, asynchronous=True)[source]
Creates a job that adds newly initialized images to the dataset.
- Parameters:
images (
List[Image]) – Newly initialized images to add.slice (
Optional[str] (default:None)) – The name of a slice to add the images to.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job
- classmethod create(*, access_key=None, team_name=None, name, description)[source]
Creates a dataset.
- Parameters:
name (
str) – The name of the dataset to create.description (
str) – The description of the dataset to create.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created dataset.
- Raises:
ConflictError – When a dataset with the provided name already exists.
- create_slice(*, access_key=None, team_name=None, name, description)[source]
Creates a slice in the dataset.
- Parameters:
name (
str) – The name of the slice to create.description (
str) – The description of the slice to create.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created slice
- delete(*, access_key=None, team_name=None, force=False)[source]
Deletes the dataset.
- Parameters:
access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Raises:
ConflictError – When there are images in the dataset. Delete the images before deleting the dataset.
- Return type:
None
- delete_annotations(*, access_key=None, team_name=None, annotations=None, annotation_ids=None, asynchronous=True)[source]
Creates a job that deletes annotations from the dataset.
- Parameters:
annotations (
Optional[List[Annotation]] (default:None)) – Annotations to delete.annotation_ids (
Optional[List[str]] (default:None)) – IDs of annotations to delete.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- delete_annotations_by_filters(*, access_key=None, team_name=None, query=None, slice=None, annotation_classes=None, annotation_types=None, asynchronous=True)[source]
Creates a job that deletes annotations from the dataset based on the provided filters. If none of query, slice, annotation_classes, or annotation_types is provided, all annotations in the dataset will be deleted.
- Parameters:
query (
Optional[str] (default:None)) – A query string to filter the annotations to delete.slice (
Optional[str] (default:None)) – The name of a slice to delete annotations from.annotation_classes (
Optional[List[str]] (default:None)) – A list of annotation classes to filter the annotations to delete.annotation_types (
Optional[List[str]] (default:None)) – A list of annotation types to filter the annotations to delete.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- delete_images(*, access_key=None, team_name=None, images=None, image_ids=None, image_keys=None, asynchronous=True)[source]
Creates a job that deletes images from the dataset.
- Parameters:
images (
Optional[List[Image]] (default:None)) – Images to delete.image_ids (
Optional[List[str]] (default:None)) – IDs of images to delete.image_keys (
Optional[List[str]] (default:None)) – Keys of images to delete.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- classmethod fetch(*, access_key=None, team_name=None, id=None, name=None, include_image_count=False, include_slice_count=False)[source]
Fetches a dataset.
- Parameters:
id (
Optional[str] (default:None)) – The id of the dataset to fetch. Must provide at least one ofidorname.name (
Optional[str] (default:None)) – The name of the dataset to fetch. Must provide at least one ofidorname.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched dataset.include_slice_count (
bool(default:False)) – Whether to include the count of slices in the fetched dataset.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The fetched dataset.
- classmethod fetch_all(*, access_key=None, team_name=None, exact=None, contains=None, include_image_count=False, include_slice_count=False)[source]
Fetches datasets that match the provided filters. If filters are not provided, fetches all datasets.
- Parameters:
exact (
Dict[str,Any] (default:None)) – A dictionary for exact, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.contains (
Dict[str,Any] (default:None)) – A dictionary for partial, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched datasets.include_slice_count (
bool(default:False)) – Whether to include the count of slices in the fetched datasets.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
List[Dataset]- Returns:
Matching datasets.
- classmethod fetch_all_iter(*, access_key=None, team_name=None, exact=None, contains=None, include_image_count=False, include_slice_count=False)[source]
Iterates through datasets that match the provided filters. If filters are not provided, iterates through all datasets.
- Parameters:
exact (
Dict[str,Any] (default:None)) – A dictionary for exact, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.contains (
Dict[str,Any] (default:None)) – A dictionary for partial, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched datasets.include_slice_count (
bool(default:False)) – Whether to include the count of slices in the fetched datasets.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Dataset]- Returns:
The matching dataset iterator.
- Yields:
The next matching dataset.
- fetch_images(*, access_key=None, team_name=None, key=None, query=None, slice=None, include_annotations=False, include_image_url=False)[source]
Fetches images from the dataset that match the provided filters. If filters are not provided, fetches all images.
- Parameters:
key (
Optional[str] (default:None)) – The key of a specific image to fetch. If provided, only returns at most 1 matching image.query (
Optional[str] (default:None)) – A query string to filter the images to fetch.slice (
Optional[str] (default:None)) – The name of a slice to fetch images from.include_annotations (
Optional[bool] (default:False)) – Whether to include annotations in the fetched images.include_image_url (
Optional[bool] (default:False)) – Whether to include the image URL in the fetched images.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
List[Image]- Returns:
Matching images.
- Raises:
NotFoundError – When the dataset does not exist. This could occur if the dataset has been deleted.
QuerySyntaxError – When the provided
queryis syntactically incorrect.
- fetch_images_iter(*, access_key=None, team_name=None, key=None, query=None, slice=None, include_annotations=False, include_image_url=False)[source]
Iterates through images in the dataset that match the provided filters. If filters are not provided, iterates through all images.
- Parameters:
key (
Optional[str] (default:None)) – The key of a specific image to fetch. If provided, only returns at most 1 matching image.query (
Optional[str] (default:None)) – A query string to filter the images to fetch.slice (
Optional[str] (default:None)) – The name of a slice to fetch images from.include_annotations (
Optional[bool] (default:False)) – Whether to include annotations in the fetched images.include_image_url (
Optional[bool] (default:False)) – Whether to include the image URL in the fetched images.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Image]- Returns:
The matching image iterator.
- Yields:
The next matching image.
- Raises:
NotFoundError – When the dataset does not exist. This could occur if the dataset has been deleted.
QuerySyntaxError – When the provided
queryis syntactically incorrect.
- classmethod fetch_page(*, access_key=None, team_name=None, exact=None, contains=None, include_image_count=False, include_slice_count=False, page=1, limit=10)[source]
Fetches a page of datasets that match the provided filters. If filters are not provided, paginates all datasets.
- Parameters:
exact (
Dict[str,Any] (default:None)) – A dictionary for exact, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.contains (
Dict[str,Any] (default:None)) – A dictionary for partial, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched datasets.include_slice_count (
bool(default:False)) – Whether to include the count of slices in the fetched datasets.page (
int(default:1)) – The page number.limit (
int(default:10)) – The maximum number of datasets in a page.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Dict[str,Union[int,List[Dataset]]]- Returns:
A page of matching datasets.
- classmethod fetch_page_iter(*, access_key=None, team_name=None, exact=None, contains=None, include_image_count=False, include_slice_count=False)[source]
Iterates through pages of datasets that match the provided filters. If filters are not provided, paginates all datasets.
- Parameters:
exact (
Dict[str,Any] (default:None)) – A dictionary for exact, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.contains (
Dict[str,Any] (default:None)) – A dictionary for partial, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched datasets.include_slice_count (
bool(default:False)) – Whether to include the count of slices in the fetched datasets.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Dict[str,Union[int,List[Dataset]]]]- Returns:
The matching dataset page iterator.
- Yields:
The next page of matching datasets.
- fetch_slice(*, access_key=None, team_name=None, id=None, name=None, include_image_count=False)[source]
Fetches a slice from the dataset.
- Parameters:
id (
Optional[str] (default:None)) – The ID of the slice to fetch. Must provide at least one ofidorname.name (
Optional[str] (default:None)) – The name of the slice to fetch. Must provide at least one ofidorname.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched slice.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The fetched slice.
- modify(*, access_key=None, team_name=None, name=None, description=None)[source]
Modifies the dataset.
- Parameters:
name (
Optional[str] (default:None)) – The new name for the dataset.description (
Optional[str] (default:None)) – The new description for the dataset.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- refresh(*, access_key=None, team_name=None)[source]
Refreshes the dataset.
- Parameters:
access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- upload_images_from_directory(*, access_key=None, team_name=None, directory_path, slice=None, recursive=True, asynchronous=True)[source]
Creates a job that uploads image files in the given directory.
- Parameters:
directory_path (
Union[str,Path]) – The path of the directory to search for image files to upload. Supports a string path or aPathobject that points to the directory.slice (
Optional[str] (default:None)) – The name of a slice to add the images to.recursive (
bool(default:True)) – Whether to recursively search through the given directory. If set toTrue, the function searches through nested directories.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- class spb_curate.curate.api.curate.Image(*, key=None, source=None, metadata=None, **params)[source]
Bases:
DeleteResource,PaginateResource,ModifyResource- classmethod create_bulk(*, access_key=None, team_name=None, dataset_id, images, slice=None, asynchronous=True)[source]
Creates a job that adds newly initialized images to a dataset.
- Parameters:
dataset_id (
str) – The ID of the dataset to add the images to.images (
List[Union[Image,dict]]) – Newly initialized images to add.slice (
Optional[str] (default:None)) – The name of a slice to add the images to.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- delete(*, access_key=None, team_name=None)[source]
Deletes the image.
- Parameters:
access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- classmethod delete_bulk(*, access_key=None, team_name=None, dataset_id, images=None, image_ids=None, image_keys=None, asynchronous=True)[source]
Creates a job that deletes images from a dataset.
- Parameters:
dataset_id (
str) – The ID of the dataset to delete images from.images (
Optional[List[Image]] (default:None)) – Images to delete.image_ids (
Optional[List[str]] (default:None)) – IDs of images to delete.image_keys (
Optional[List[str]] (default:None)) – Keys of images to delete.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- classmethod fetch(*, access_key=None, team_name=None, dataset_id, id, include_annotations=False)[source]
Fetches an image.
- Parameters:
dataset_id (
str) – The ID of the dataset with the image to fetch.id (
str) – The ID of the image to fetch.include_annotations (
Optional[bool] (default:False)) – Whether to include annotations in the fetched images.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The fetched image.
- classmethod fetch_all(*, access_key=None, team_name=None, dataset_id, key=None, query=None, slice=None, include_annotations=False, include_image_url=False)[source]
Fetches images in a dataset that match the provided filters. If filters are not provided, fetches all images.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch images from.key (
Optional[str] (default:None)) – The key of a specific image to fetch. If provided, only returns at most 1 matching image.query (
Optional[str] (default:None)) – A query string to filter the images to fetch.slice (
Optional[str] (default:None)) – The name of a slice to fetch images from.include_annotations (
Optional[bool] (default:False)) – Whether to include annotations in the fetched images.include_image_url (
Optional[bool] (default:False)) – Whether to include the image URL in the fetched images.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
List[Image]- Returns:
Matching images.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.QuerySyntaxError – When the provided
queryis syntactically incorrect.
- classmethod fetch_all_iter(*, access_key=None, team_name=None, dataset_id, key=None, query=None, slice=None, include_annotations=False, include_image_url=False)[source]
Iterates through images in a dataset that match the provided filters. If filters are not provided, iterates through all images.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch images from.key (
Optional[str] (default:None)) – The key of a specific image to fetch. If provided, only returns at most 1 matching image.query (
Optional[str] (default:None)) – A query string to filter the images to fetch.slice (
Optional[str] (default:None)) – The name of a slice to fetch images from.include_annotations (
Optional[bool] (default:False)) – Whether to include annotations in the fetched images.include_image_url (
Optional[bool] (default:False)) – Whether to include the image URL in the fetched images.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Image]- Returns:
The matching image iterator.
- Yields:
The next matching image.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.QuerySyntaxError – When the provided
queryis syntactically incorrect.
- classmethod fetch_page(*, access_key=None, team_name=None, dataset_id, key=None, query=None, slice=None, include_annotations=False, include_image_url=False, search_after=None, limit=10)[source]
Fetches a page of images that match the provided filters. If filters are not provided, paginates all images.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch images from.key (
Optional[str] (default:None)) – The key of a specific image to fetch. If provided, only returns at most 1 matching image.query (
Optional[str] (default:None)) – A query string to filter the images to fetch.slice (
Optional[str] (default:None)) – The name of a slice to fetch images from.include_annotations (
Optional[bool] (default:False)) – Whether to include annotations in the fetched images.search_after (
Optional[str] (default:None)) – The ID of an image to start the search from. If not provided, fetches the first page.limit (
int(default:10)) – The maximum number of images in a page.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Dict[str,Union[int,List[str],List[Image]]]- Returns:
A page of matching images.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.QuerySyntaxError – When the provided
queryis syntactically incorrect.
- classmethod fetch_page_iter(*, access_key=None, team_name=None, dataset_id, key=None, query=None, slice=None, include_annotations=False, include_image_url=False)[source]
Iterates through pages of images from a dataset that match the provided filters. If filters are not provided, paginates all images.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch images from.key (
Optional[str] (default:None)) – The key of a specific image to fetch. If provided, only returns at most 1 matching image.query (
Optional[str] (default:None)) – A query string to filter the images to fetch.slice (
Optional[str] (default:None)) – The name of a slice to fetch images from.include_annotations (
Optional[bool] (default:False)) – Whether to include annotations in the fetched images.include_image_url (
Optional[bool] (default:False)) – Whether to include the image URL in the fetched images.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Dict[str,Union[int,List[str],List[Image]]]]- Returns:
The matching image page iterator.
- Yields:
The next page of matching images.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.QuerySyntaxError – When the provided
queryis syntactically incorrect.
- modify(*, access_key=None, team_name=None, metadata=None)[source]
Modifies the image.
- Parameters:
metadata (
Optional[dict] (default:None)) – The metadata associated with the image. Must be flat (one level deep).access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- refresh(*, access_key=None, team_name=None)[source]
Refreshes the image.
- Parameters:
access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- class spb_curate.curate.api.curate.ImageSourceLocal(*, asset, asset_id=None, **params)[source]
Bases:
BaseImageSource
- class spb_curate.curate.api.curate.ImageSourceUrl(*, url, **params)[source]
Bases:
BaseImageSource
- class spb_curate.curate.api.curate.SearchFieldMapping(id=None, access_key=None, team_name=None, **params)[source]
Bases:
PaginateResource- classmethod fetch_all(*, access_key=None, team_name=None, dataset_id, mapping_type=None)[source]
Fetches search field mappings that match the provided filters. If filters are not provided, fetches all search field mappings.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the search field mappings from.mapping_type (
Optional[SearchFieldMappingType] (default:None)) – A type of search field mappings to filter by.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Dict[str,Union[int,List[SearchFieldMapping],str]]- Returns:
Matching search field mappings.
- classmethod fetch_all_iter(*, access_key=None, team_name=None, dataset_id, mapping_type=None)[source]
Iterates through search field mappings that match the provided filters. If filters are not provided, iterates through all search field mappings.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the search field mappings from.mapping_type (
Optional[SearchFieldMappingType] (default:None)) – A type of search field mappings to filter by.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[SearchFieldMapping]- Returns:
The matching search field mapping iterator.
- Yields:
The next matching search field mapping.
- classmethod fetch_page(*, access_key=None, team_name=None, dataset_id, mapping_type=None)[source]
Fetches a page of search field mappings that match the provided filters. If filters are not provided, paginates all search field mappings.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the search field mappings from.mapping_type (
Optional[SearchFieldMappingType] (default:None)) – A type of search field mappings to filter by.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Dict[str,Union[int,List[SearchFieldMapping]]]- Returns:
A page of matching search field mappings.
- classmethod fetch_page_iter(*, access_key=None, team_name=None, dataset_id, mapping_type=None)[source]
Iterates through pages of search field mappings that match the provided filters. If filters are not provided, paginates all search field mappings.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the search field mappings from.mapping_type (
Optional[SearchFieldMappingType] (default:None)) – A type of search field mappings to filter by.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Dict[str,Union[int,List[SearchFieldMapping]]]]- Returns:
The matching search field mapping page iterator.
- Yields:
The next page of matching search field mappings.
- class spb_curate.curate.api.curate.Slice(id=None, access_key=None, team_name=None, **params)[source]
Bases:
CreateResource,DeleteResource,PaginateResource,ModifyResource- add_images(*, access_key=None, team_name=None, images=None, image_ids=None, image_keys=None, query=None, asynchronous=True)[source]
Create a job that adds images to the slice.
- Parameters:
images (
Optional[List[Image]] (default:None)) – Images to add.image_ids (
Optional[List[str]] (default:None)) – IDs of images to add.image_keys (
Optional[List[str]] (default:None)) – Keys of images to add.query (
Optional[str] (default:None)) – A query string to filter the images to add.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- classmethod create(*, access_key=None, team_name=None, dataset_id, name, description)[source]
Creates a slice.
- Parameters:
dataset_id (
str) – The ID of the dataset to create the slice in.name (
str) – The name of the slice to create.description (
str) – The description of the slice to create.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created slice.
- Raises:
ConflictError – When a slice with the provided name already exists in the dataset.
- delete(*, access_key=None, team_name=None)[source]
Deletes the slice.
- Parameters:
access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- classmethod fetch(*, access_key=None, team_name=None, dataset_id, id=None, name=None, include_image_count=False)[source]
Fetches a slice.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the slice from.id (
Optional[str] (default:None)) – The ID of the slice to fetch. Must provide at least one ofidorname.name (
Optional[str] (default:None)) – The name of the slice to fetch. Must provide at least one ofidorname.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched slice.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The fetched slice.
- classmethod fetch_all(*, access_key=None, team_name=None, dataset_id, exact=None, contains=None, include_image_count=False)[source]
Fetches slices that match the provided filters. If filters are not provided, fetches all slices.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the slices from.exact (
Dict[str,Any] (default:None)) – A dictionary for exact, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.contains (
Dict[str,Any] (default:None)) – A dictionary for partial, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched slice.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
List[Slice]- Returns:
Matching slices.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.
- classmethod fetch_all_iter(*, access_key=None, team_name=None, dataset_id, exact=None, contains=None, include_image_count=False)[source]
Iterates through slices that match the provided filters. If filters are not provided, iterates through all slices.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the slices from.exact (
Dict[str,Any] (default:None)) – A dictionary for exact, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.contains (
Dict[str,Any] (default:None)) – A dictionary for partial, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched slice.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Slice]- Returns:
The matching slice iterator.
- Yields:
The next matching slice.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.
- fetch_images(*, access_key=None, team_name=None, key=None, query=None, include_annotations=False, include_image_url=False)[source]
Fetches images from the slice that match the provided filters. If filters are not provided, fetches all images.
- Parameters:
key (
Optional[str] (default:None)) – The key of a specific image to fetch. If provided, only returns at most 1 matching image.query (
Optional[str] (default:None)) – A query string to filter the images to fetch.include_annotations (
Optional[bool] (default:False)) – Whether to include annotations in the fetched images.include_image_url (
Optional[bool] (default:False)) – Whether to include the image URL in the fetched images.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
List[Image]- Returns:
Matching images.
- Raises:
NotFoundError – When the slice or the dataset does not exist. This could occur if the slice or the dataset has been deleted.
QuerySyntaxError – When the provided
queryis syntactically incorrect.
- fetch_images_iter(*, access_key=None, team_name=None, key=None, query=None, include_annotations=False, include_image_url=False)[source]
Iterates through images in the slice that match the provided filters. If filters are not provided, iterates through all images.
- Parameters:
key (
Optional[str] (default:None)) – The key of a specific image to fetch. If provided, only returns at most 1 matching image.query (
Optional[str] (default:None)) – A query string to filter the images to fetch.include_annotations (
Optional[bool] (default:False)) – Whether to include annotations in the fetched images.include_image_url (
Optional[bool] (default:False)) – Whether to include the image URL in the fetched images.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Image]- Returns:
The matching image iterator.
- Yields:
The next matching image.
- Raises:
NotFoundError – When the slice or the dataset does not exist. This could occur if the slice or the dataset has been deleted.
QuerySyntaxError – When the provided
queryis syntactically incorrect.
- classmethod fetch_page(*, access_key=None, team_name=None, dataset_id, exact=None, contains=None, include_image_count=False, page=1, limit=10)[source]
Fetches a page of slices that match the provided filters. If filters are not provided, paginates all slices.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the slices from.exact (
Dict[str,Any] (default:None)) – A dictionary for exact, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.contains (
Dict[str,Any] (default:None)) – A dictionary for partial, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched slices.page (
int(default:1)) – The page number.limit (
int(default:10)) – The maximum number of slices in a page.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Dict[str,Union[int,List[Slice]]]- Returns:
A page of matching slices.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.
- classmethod fetch_page_iter(*, access_key=None, team_name=None, dataset_id, exact=None, contains=None, include_image_count=False)[source]
Iterates through pages of slices that match the provided filters. If filters are not provided, paginates all slices.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the slices from.exact (
Dict[str,Any] (default:None)) – A dictionary for exact, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.contains (
Dict[str,Any] (default:None)) – A dictionary for partial, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched slices.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Dict[str,Union[int,List[Slice]]]]- Returns:
The matching slice page iterator.
- Yields:
The next page of matching slices.
- Raises:
NotFoundError – When a dataset with the provided
dataset_iddoes not exist.
- modify(*, access_key=None, team_name=None, description=None)[source]
Modifies the slice.
- Parameters:
description (
Optional[str] (default:None)) – The new description for the slice.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- refresh(*, access_key=None, team_name=None)[source]
Refreshes the slice.
- Parameters:
access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- remove_images(*, access_key=None, team_name=None, images=None, image_ids=None, image_keys=None, query=None, asynchronous=True)[source]
Create a job that removes images from the slice.
- Parameters:
images (
Optional[List[Image]] (default:None)) – Images to remove.image_ids (
Optional[List[str]] (default:None)) – IDs of images to remove.image_keys (
Optional[List[str]] (default:None)) – Keys of images to remove.query (
Optional[str] (default:None)) – A query string to filter the images to remove.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- spb_curate.curate.api.curate.create_dataset(*, access_key=None, team_name=None, name, description)[source]
Creates a dataset.
- Parameters:
name (
str) – The name of the dataset to create.description (
str) – The description of the dataset to create.access_key (
Optional[str] (default:None)) –- An access key for request authentication.
If provided, overrides the configuration.
- team_name
A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created dataset.
- Raises:
ConflictError – When a dataset with the provided name already exists.
- spb_curate.curate.api.curate.fetch_dataset(*, access_key=None, team_name=None, id=None, name=None, include_image_count=False, include_slice_count=False)[source]
Fetches a dataset.
- Parameters:
id (
Optional[str] (default:None)) – The id of the dataset to fetch. Must provide at least one ofidorname.name (
Optional[str] (default:None)) – The name of the dataset to fetch. Must provide at least one ofidorname.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched dataset.include_slice_count (
bool(default:False)) – Whether to include the count of slices in the fetched dataset.access_key (
Optional[str] (default:None)) –- An access key for request authentication.
If provided, overrides the configuration.
- team_name
A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The fetched dataset.
- spb_curate.curate.api.curate.fetch_datasets(*, access_key=None, team_name=None, exact=None, contains=None, include_image_count=False, include_slice_count=False)[source]
Fetches datasets that match the provided filters. If filters are not provided, fetches all datasets.
- Parameters:
exact (
Dict[str,Any] (default:None)) – A dictionary for exact, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.contains (
Dict[str,Any] (default:None)) – A dictionary for partial, case-sensitive filtering. Must provide field names as keys and their desired values. Supported fields:name.include_image_count (
bool(default:False)) – Whether to include the count of images in the fetched datasets.include_slice_count (
bool(default:False)) – Whether to include the count of slices in the fetched datasets.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
List[Dataset]- Returns:
Matching datasets.
spb_curate.curate.api.enums module
- class spb_curate.curate.api.enums.IouType(value)[source]
Bases:
str,EnumTypes of IoU.
- BOX = 'bbox'
- POLYGON = 'segm'
- class spb_curate.curate.api.enums.JobType(value)[source]
Bases:
EnumAvailable types of a job.
- ANNOTATION_IMPORT = 'ANNOTATION_IMPORT'
- DELETE_ANNOTATIONS_BY_FILTERS = 'DELETE_ANNOTATIONS_BY_FILTERS'
- DELETE_ANNOTATIONS_BY_IDS = 'DELETE_ANNOTATIONS_BY_IDS'
- DELETE_IMAGES = 'DELETE_IMAGES'
- IMAGE_IMPORT = 'IMAGE_IMPORT'
- IMPORT_PREDICTIONS = 'IMPORT_PREDICTIONS'
- UPDATE_SLICE = 'UPDATE_SLICE'
- UPDATE_SLICE_BY_QUERY = 'UPDATE_SLICE_BY_QUERY'
- class spb_curate.curate.api.enums.SearchFieldMappingType(value)[source]
Bases:
str,Enum- ANNOTATION_CLASS = 'annotations.class_count'
- ANNOTATION_METADATA = 'annotations.metadata'
- IMAGE_METADATA = 'images.metadata'
spb_curate.curate.api.job module
- class spb_curate.curate.api.job.Job(id=None, access_key=None, team_name=None, **params)[source]
Bases:
PaginateResource- classmethod create(*, access_key=None, team_name=None, job_type, param)[source]
Creates a job.
- Parameters:
job_type (
JobType) – The type of the job to create.param (
dict) – The parameters for the job. Differs by eachJobType.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- classmethod fetch(*, access_key=None, team_name=None, id)[source]
Fetches a job.
- Parameters:
id (
str) – The ID of the job to fetch.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The fetched job.
- classmethod fetch_all(*, access_key=None, team_name=None, from_date=None)[source]
Fetches jobs that match the date filter. If not provided, fetches all jobs.
- Parameters:
from_date (
Optional[str] (default:None)) – ISO 8601 formatted UTC date string to filter jobs created on or after the specified date.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
List[Job]- Returns:
Matching jobs.
- classmethod fetch_all_iter(*, access_key=None, team_name=None, from_date=None)[source]
Iterates through jobs that match the date filter. If not provided, iterates through all jobs.
- Parameters:
from_date (
Optional[str] (default:None)) – ISO 8601 formatted UTC date string to filter jobs created on or after the specified date.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Job]- Returns:
The matching job iterator.
- Yields:
The next matching job.
- classmethod fetch_page(*, access_key=None, team_name=None, from_date=None, cursor=None, limit=10)[source]
Fetches a page of jobs that match the date filter. If not provided, paginates all jobs.
- Parameters:
cursor (
Optional[str] (default:None)) – A cursor for pagination. Pass in next_cursor from the previous page to fetch the next page.limit (
int(default:10)) – The maximum number of jobs in a page.from_date (
Optional[str] (default:None)) – ISO 8601 formatted UTC date string to filter jobs created on or after the specified date.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Dict[str,Union[int,List[Job]]]- Returns:
A page of matching jobs.
- classmethod fetch_page_iter(*, access_key=None, team_name=None, from_date=None)[source]
Iterates through pages of jobs that match the date filter. If not provided, paginates all jobs.
- Parameters:
from_date (
Optional[str] (default:None)) – ISO 8601 formatted UTC date string to filter jobs created on or after the specified date.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Dict[str,Union[int,List[Job]]]]- Returns:
The matching job page iterator.
- Yields:
The next page of matching jobs.
- refresh(*, access_key=None, team_name=None)[source]
Refreshes the job.
- Parameters:
access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
spb_curate.curate.api.model_diagnosis module
- class spb_curate.curate.api.model_diagnosis.Diagnosis(id=None, access_key=None, team_name=None, **params)[source]
Bases:
CreateResource,PaginateResource- add_predictions(*, access_key=None, team_name=None, predictions, split=Split.VAL, asynchronous=True)[source]
Creates a job that adds newly initialized predictions to the diagnosis.
- Parameters:
predictions (
List[Prediction]) – Newly initialized predictions to add.split (
Split(default:<Split.VAL: 'VAL'>)) – The subset data type used for training the model.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- classmethod create(*, access_key=None, team_name=None, dataset_id, model_name, class_list, iou_type, metadata=None)[source]
Creates a diagnosis.
- Parameters:
dataset_id (
str) – The ID of the dataset to use for the diagnosis.model_name (
str) – The name of the model to diagnose.class_list (
List[str]) – The list of class names to diagnose.iou_type (
IouType) – The IoU type of the diagnosis.metadata (
Optional[Dict[str,Union[int,float,Decimal]]] (default:None)) – The metadata associated with the diagnosis. Supported fields:beta,target_iou.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created diagnosis.
- Raises:
ConflictError – When a diagnosis related to the dataset and model already exists.
- classmethod fetch(*, access_key=None, team_name=None, dataset_id, id)[source]
Fetches a diagnosis.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the diagnosis from.id (
str) – The ID of the diagnosis to fetch.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The fetched diagnosis.
- classmethod fetch_all(*, access_key=None, team_name=None, dataset_id)[source]
Fetches diagnoses that match the provided filters. If filters are not provided, fetches all diagnoses.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the diagnosis from.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
List[Diagnosis]- Returns:
Matching diagnoses.
- classmethod fetch_all_iter(*, access_key=None, team_name=None, dataset_id)[source]
Iterates through diagnoses that match the provided filters. If filters are not provided, iterates through all diagnoses.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the diagnosis from.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Diagnosis]- Returns:
The matching diagnosis iterator.
- Yields:
The next matching diagnosis.
- classmethod fetch_page(*, access_key=None, team_name=None, dataset_id, page=1, limit=10)[source]
Fetches a page of diagnoses that match the provided filters. If filters are not provided, paginates all diagnoses.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the diagnosis from.page (
int(default:1)) – The page number.limit (
int(default:10)) – The maximum number of diagnoses in a page.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Dict[str,Union[int,List[Diagnosis]]]- Returns:
A page of matching diagnoses.
- classmethod fetch_page_iter(*, access_key=None, team_name=None, dataset_id)[source]
Iterates through pages of diagnoses that match the provided filters. If filters are not provided, paginates all diagnoses.
- Parameters:
dataset_id (
str) – The ID of the dataset to fetch the diagnosis from.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
Iterator[Dict[str,Union[int,List[Diagnosis]]]]- Returns:
The matching diagnosis page iterator.
- Yields:
The next page of matching diagnoses.
- refresh(*, access_key=None, team_name=None)[source]
Refreshes the diagnosis.
- Parameters:
access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
None
- class spb_curate.curate.api.model_diagnosis.Evaluation(id=None, access_key=None, team_name=None, **params)[source]
Bases:
SuperbAIObject
- class spb_curate.curate.api.model_diagnosis.Prediction(*, confidence, image_id, prediction_class, prediction_value, prediction_type=None, **params)[source]
Bases:
SuperbAIObject- classmethod create_bulk(*, access_key=None, team_name=None, dataset_id, diagnosis_id, predictions, split=Split.VAL, asynchronous=True)[source]
Creates a job that adds newly initialized predictions to a diagnosis.
- Parameters:
dataset_id (
str) – The ID of the dataset to add the predictions to.diagnosis_id (
str) – The ID of the diagnosis to add the predictions to.predictions (
List[Prediction]) – Newly initialized predictions to add.split (
Split(default:<Split.VAL: 'VAL'>)) – The subset data type used for training the model.asynchronous (
bool(default:True)) – Whether to immediately return the job after creating it. If set toFalse, the function waits for the job to finish before returning.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created job.
- spb_curate.curate.api.model_diagnosis.create_diagnosis(*, access_key=None, team_name=None, dataset_id, model_name, class_list, iou_type, metadata=None)[source]
Creates a diagnosis.
- Parameters:
dataset_id (
str) – The ID of the dataset to use for the diagnosis.model_name (
str) – The name of the model to diagnose.class_list (
List[str]) – The list of class names to diagnose.iou_type (
IouType) – The iou type of the diagnosis.metadata (
Optional[Dict[str,Union[int,float,Decimal]]] (default:None)) – The metadata associated with the diagnosis. Supported fields:beta,target_iou.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Return type:
- Returns:
The created diagnosis.
- Raises:
ConflictError – When a diagnosis for the (dataset, model_name) pair already exists.
- spb_curate.curate.api.model_diagnosis.fetch_available_models(*, access_key=None, team_name=None)[source]
- Return type:
Dict[str,Any]
- spb_curate.curate.api.model_diagnosis.modify_model_name(*, access_key=None, team_name=None, id, name)[source]
Modifies the model.
- Parameters:
id (
str) – The id of the model to modify.name (
str) – The new name for the model.access_key (
Optional[str] (default:None)) – An access key for request authentication. If provided, overrides the configuration.team_name (
Optional[str] (default:None)) – A team name for request authentication. If provided, overrides the configuration.
- Raises:
ConflictError – When a model with the provided name already exists.
- Return type:
Dict[str,Any]