class documentation

A class to facilitate connection to and management of projects in Labelbox.

On initialization, this class constructs a client based on the provided server url and credentials.

This API provides methods to easily upload, download, create, and delete projects and data through the formatted urls specified by the Labelbox API.

Additionally, samples and label schemas can be uploaded and annotations downloaded through this class.

Parameters
namethe name of the backend
urlurl of the Labelbox server
api_keythe Labelbox API key
export_versionthe Labelbox export format and API version to use. Supported values are ("v1", "v2")
Method __init__ Undocumented
Method add_member Adds a member to the given Labelbox project with the given project-level role.
Method delete_datasets Deletes the given datasets from the Labelbox server.
Method delete_project Deletes the given project from the Labelbox server.
Method delete_projects Deletes the given projects from the Labelbox server.
Method delete_unused_ontologies Deletes unused ontologies from the Labelbox server.
Method download_annotations Downloads the annotations from the Labelbox server for the given results instance and parses them into the appropriate FiftyOne types.
Method editor_url Undocumented
Method get_data_row_ids Undocumented
Method get_project Retrieves the labelbox.schema.project.Project for the project with the given ID.
Method get_project_users Returns a list of users that are assigned to the given project.
Method launch_editor Launches the Labelbox editor in your default web browser.
Method list_datasets Retrieves the list of datasets in your Labelbox account.
Method list_projects Retrieves the list of projects in your Labelbox account.
Method project_url Undocumented
Method upload_data Uploads the media for the given samples to Labelbox.
Method upload_samples Uploads the given samples to Labelbox according to the given backend's annotation and server configuration.
Instance Variable export_version Undocumented
Property attr_list_types Undocumented
Property attr_type_map Undocumented
Property base_api_url Undocumented
Property base_graphql_url Undocumented
Property projects_url Undocumented
Property roles Undocumented
Method _add_labels_to_results Adds the labels in labels_dict to results.
Method _add_video_labels_to_results Adds the video labels in frames_dict to results.
Method _build_attributes Undocumented
Method _build_classifications Returns the classifications for the given label field. Generally, the classification is a dropdown selection for given classes, but can be a text entry for scalars without provided classes.
Method _build_frame_id_map Undocumented
Method _build_tool_for_class Undocumented
Method _build_tools Undocumented
Method _convert_label_types Undocumented
Method _convert_segmentations Undocumented
Method _create_classes_as_attrs Creates radio attributes for all classes and formats all class-specific attributes.
Method _create_ontology_tools Undocumented
Method _download_project_labels Undocumented
Method _gather_classification_attributes Undocumented
Method _get_sample_metadata Undocumented
Method _get_video_labels Undocumented
Method _merge_results Undocumented
Method _parse_expected_label_fields Undocumented
Method _process_label_fields Undocumented
Method _setup Undocumented
Method _setup_editor Undocumented
Method _setup_project Undocumented
Method _skip_existing_global_keys Undocumented
Instance Variable _api_key Undocumented
Instance Variable _client Undocumented
Instance Variable _experimental Undocumented
Instance Variable _name Undocumented
Instance Variable _protocol Undocumented
Instance Variable _roles Undocumented
Instance Variable _tool_types_map Undocumented
Instance Variable _url Undocumented
Property _LabelboxExportToFiftyOneConverter 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, name, url, api_key=None, export_version=LabelboxExportVersion.V2, _experimental=False): (source)

Undocumented

def add_member(self, project, email, role): (source)

Adds a member to the given Labelbox project with the given project-level role.

If the user is not a member of the project's parent organization, an email invitivation will be sent.

Parameters
projectthe labelbox.schema.project.Project
emailthe email of the user
rolethe role for the user. Supported values are ["LABELER", "REVIEWER", "TEAM_MANAGER", "ADMIN"]
def delete_datasets(self, dataset_ids, progress=None): (source)

Deletes the given datasets from the Labelbox server.

Parameters
dataset_idsan iterable of dataset IDs
progress:Nonewhether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead
def delete_project(self, project_id, delete_batches=False, delete_ontologies=True): (source)

Deletes the given project from the Labelbox server.

Parameters
project_idthe project ID
delete_batches:Falsewhether to delete the attached batches as well
delete_ontologies:Truewhether to delete the attached ontologies as well
def delete_projects(self, project_ids, delete_batches=False): (source)

Deletes the given projects from the Labelbox server.

Parameters
project_idsan iterable of project IDs
delete_batches:Falsewhether to delete the attached batches as well
def delete_unused_ontologies(self): (source)

Deletes unused ontologies from the Labelbox server.

def download_annotations(self, results): (source)

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

Parameters
resultsa LabelboxAnnotationResults
Returns
the annotations dict
def editor_url(self, project_id): (source)

Undocumented

def get_data_row_ids(self, sample_ids): (source)

Undocumented

def get_project(self, project_id): (source)

Retrieves the labelbox.schema.project.Project for the project with the given ID.

Parameters
project_idthe project ID
Returns
a labelbox.schema.project.Project
def get_project_users(self, project=None, project_id=None): (source)

Returns a list of users that are assigned to the given project.

Provide either project or project_id to this method.

Parameters
projecta labelbox.schema.project.Project
project_idthe project ID
Returns
a list of labelbox.schema.user.User objects
def launch_editor(self, url=None): (source)

Launches the Labelbox editor in your default web browser.

Parameters
url:Nonean optional URL to open. By default, the base URL of the server is opened
def list_datasets(self): (source)

Retrieves the list of datasets in your Labelbox account.

Returns
a list of dataset IDs
def list_projects(self): (source)

Retrieves the list of projects in your Labelbox account.

Returns
a list of project IDs
def project_url(self, project_id): (source)

Undocumented

def upload_data(self, samples, dataset_name, media_field='filepath'): (source)

Uploads the media for the given samples to Labelbox.

This method uses labelbox.schema.dataset.Dataset.create_data_rows() to add data in batches, and sets the global key of each DataRow to the ID of the corresponding sample.

Parameters
samplesa fiftyone.core.collections.SampleCollection containing the media to upload
dataset_namethe name of the Labelbox dataset created if data needs to be uploaded
media_field:"filepath"string field name containing the paths to media files on disk to upload
def upload_samples(self, samples, anno_key, backend): (source)

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

Parameters
samplesa fiftyone.core.collections.SampleCollection
anno_keythe annotation key
backenda LabelboxBackend to use to perform the upload
Returns
a LabelboxAnnotationResults
export_version: "v2" = (source)

Undocumented

@property
attr_list_types = (source)

Undocumented

@property
attr_type_map = (source)

Undocumented

@property
base_api_url = (source)

Undocumented

@property
base_graphql_url = (source)

Undocumented

@property
projects_url = (source)

Undocumented

Undocumented

def _add_labels_to_results(self, results, labels_dict, sample_id, label_schema): (source)

Adds the labels in labels_dict to results.

results:

<label_field>: {
    <label_type>: {
        <sample_id>: {
            <label_id>:
                <fo.Label> or <label - for scalars>
        }
    }
}

labels_dict:

{
    <label_field>: {
        <label_type>: [<fo.Label>, ...]
    }
}
def _add_video_labels_to_results(self, results, frames_dict, sample_id, label_schema): (source)

Adds the video labels in frames_dict to results.

results:

<label_field>: {
    <label_type>: {
        <sample_id>: {
            <frame_id>: {
                <label_id>: <fo.Label>
            }
            or <label - for scalars>
        }
    }
}

frames_dict:

{
    <frame_id>: {
        <label_field>: {
            <label_type>: [<fo.Label>, ...]
        }
    }
}
def _build_attributes(self, attr_schema): (source)

Undocumented

def _build_classifications(self, classes, name, general_attrs, label_type, label_field): (source)

Returns the classifications for the given label field. Generally, the classification is a dropdown selection for given classes, but can be a text entry for scalars without provided classes.

Attributes are available for Classification and Classifications types in nested dropdowns.

def _build_frame_id_map(self, samples): (source)

Undocumented

def _build_tool_for_class(self, class_name, label_type, attributes): (source)

Undocumented

def _build_tools(self, classes, label_field, label_type, general_attrs, classes_as_attrs): (source)

Undocumented

def _convert_label_types(self, labels_dict, expected_type, sample_id, frame_id=None, mask_targets=None): (source)

Undocumented

def _convert_segmentations(self, labels_list, label_type, mask_targets=None): (source)

Undocumented

def _create_classes_as_attrs(self, classes, general_attrs): (source)

Creates radio attributes for all classes and formats all class-specific attributes.

def _create_ontology_tools(self, label_info, label_field, classes_as_attrs): (source)

Undocumented

def _download_project_labels(self, project_id=None, project=None): (source)

Undocumented

def _gather_classification_attributes(self, labels_dict, label_schema): (source)

Undocumented

def _get_sample_metadata(self, project, sample_id): (source)

Undocumented

def _get_video_labels(self, label_dict): (source)

Undocumented

def _merge_results(self, results, new_results): (source)

Undocumented

def _parse_expected_label_fields(self, results, labels_dict, sample_id, label_schema, attributes, frame_id=None): (source)

Undocumented

def _process_label_fields(self, label_schema, labels_dict): (source)

Undocumented

def _setup(self): (source)

Undocumented

def _setup_editor(self, project, label_schema, classes_as_attrs): (source)

Undocumented

def _setup_project(self, project_name, global_keys, label_schema, classes_as_attrs, is_video): (source)

Undocumented

def _skip_existing_global_keys(self, media_paths, sample_ids): (source)

Undocumented

_api_key = (source)

Undocumented

Undocumented

_experimental = (source)

Undocumented

Undocumented

_protocol = (source)

Undocumented

Undocumented

_tool_types_map = (source)

Undocumented

Undocumented

@property
_LabelboxExportToFiftyOneConverter = (source)

Undocumented