class documentation

A class to upload tasks and predictions to and fetch annotations from Label Studio.

On initialization, the class will check if the server is reachable.

Method __init__ Undocumented
Method delete_project Deletes the project from Label Studio.
Method delete_tasks Deletes the given tasks from Label Studio.
Method download_annotations Downloads the annotations from the Label Studio server for the given results instance and parses them into the appropriate FiftyOne types.
Method upload_predictions Uploads the given predictions to an existing Label Studio project.
Method upload_samples Uploads the given samples to Label Studio according to the given backend's annotation and server configuration.
Instance Variable backend Undocumented
Instance Variable url Undocumented
Static Method _get_matched_labeled_tasks Undocumented
Method _export_to_label_studio Undocumented
Method _import_annotations Undocumented
Method _init_project Creates a new project on Label Studio.
Method _prepare_tasks Prepares Label Studio tasks for the given data.
Method _setup Undocumented
Method _upload_tasks Uploads files to Label Studio and registers them as tasks.
Method _verify_server_version Undocumented
Instance Variable _api_key Undocumented
Instance Variable _client Undocumented
Instance Variable _min_server_version Undocumented

Inherited from AnnotationAPI:

Method __enter__ Undocumented
Method __exit__ Undocumented
Method close Closes the API session.
Method _prompt_api_key Undocumented
Method _prompt_username_password Undocumented
def __init__(self, url, api_key): (source)

Undocumented

def delete_project(self, project_id): (source)

Deletes the project from Label Studio.

Parameters
project_idproject id
def delete_tasks(self, task_ids): (source)

Deletes the given tasks from Label Studio.

Parameters
task_idslist of task ids
def download_annotations(self, results): (source)

Downloads the annotations from the Label Studio server for the given results instance and parses them into the appropriate FiftyOne types.

Parameters
resultsa LabelStudioAnnotationResults
Returns
the annotations dict
def upload_predictions(self, project, tasks, sample_labels, label_type): (source)

Uploads the given predictions to an existing Label Studio project.

Parameters
projecta label_studio_sdk.Project
tasksa list of task dicts
sample_labelsa list or list of lists of fiftyone.core.labels.Label instances
label_typethe label type string
def upload_samples(self, samples, anno_key, backend): (source)

Uploads the given samples to Label Studio according to the given backend's annotation and server configuration.

Parameters
samplesa fiftyone.core.collections.SampleCollection
anno_keythe annotation key
backenda LabelStudioBackend to use to perform the upload
Returns
a LabelStudioAnnotationResults

Undocumented

Undocumented

@staticmethod
def _get_matched_labeled_tasks(project, task_ids): (source)

Undocumented

def _export_to_label_studio(self, labels, label_type): (source)

Undocumented

def _import_annotations(self, tasks, task_map): (source)

Undocumented

def _init_project(self, config, samples): (source)

Creates a new project on Label Studio.

If project_name is not set in the configs, it will be generated. If project_name exists on the server, a timestamp will be added to the project name.

Parameters
configa LabelStudioBackendConfig
samplesa fiftyone.core.collections.SampleCollection
Returns
a label_studio_sdk.Project
def _prepare_tasks(self, samples, label_schema, media_field): (source)

Prepares Label Studio tasks for the given data.

def _setup(self): (source)

Undocumented

def _upload_tasks(self, project, tasks, predictions=None): (source)

Uploads files to Label Studio and registers them as tasks.

Parameters
projecta label_studio_sdk.Project
tasksa list of task dicts
predictions:Noneoptional predictions to upload
Returns
a dict mapping task_id to sample_id
def _verify_server_version(self): (source)

Undocumented

_api_key = (source)

Undocumented

Undocumented

_min_server_version: str = (source)

Undocumented