Annotation Import

class labelbox.schema.annotation_import.AnnotationImport(client, field_values)[source]

Bases: DbObject

property errors: List[Dict[str, Any]]

Errors for each individual annotation uploaded. This is a subset of statuses

Returns:

List of dicts containing error messages. Empty list means there were no errors See AnnotationImport.statuses for more details.

  • This information will expire after 24 hours.

property inputs: List[Dict[str, Any]]

Inputs for each individual annotation uploaded. This should match the ndjson annotations that you have uploaded. :returns: Uploaded ndjson.

  • This information will expire after 24 hours.

refresh() None[source]

Synchronizes values of all fields with the database.

property statuses: List[Dict[str, Any]]

Status for each individual annotation uploaded.

Returns:

A status for each annotation if the upload is done running. See below table for more details

Field

Description

uuid

Specifies the annotation for the status row.

dataRow

JSON object containing the Labelbox data row ID for the annotation.

status

Indicates SUCCESS or FAILURE.

errors

An array of error messages included when status is FAILURE. Each error has a name, message and optional (key might not exist) additional_info.

  • This information will expire after 24 hours.

wait_till_done(sleep_time_seconds: int = 10, show_progress: bool = False) None[source]

Blocks import job until certain conditions are met. Blocks until the AnnotationImport.state changes either to AnnotationImportState.FINISHED or AnnotationImportState.FAILED, periodically refreshing object’s state. :param sleep_time_seconds: a time to block between subsequent API calls :type sleep_time_seconds: int :param show_progress: should show progress bar :type show_progress: bool

class labelbox.schema.annotation_import.CreatableAnnotationImport(client, field_values)[source]

Bases: AnnotationImport

class labelbox.schema.annotation_import.LabelImport(client, field_values)[source]

Bases: CreatableAnnotationImport

classmethod create_from_file(client: Client, project_id: str, name: str, path: str) LabelImport[source]

Create a label import job from a file of annotations

Parameters:
  • client – Labelbox Client for executing queries

  • project_id – Project to import labels into

  • name – Name of the import job. Can be used to reference the task later

  • path – Path to ndjson file containing annotations

Returns:

LabelImport

classmethod create_from_objects(client: labelbox.Client, project_id: str, name: str, labels: List[Dict[str, Any]] | List[Label]) LabelImport[source]

Create a label import job from an in memory dictionary

Parameters:
  • client – Labelbox Client for executing queries

  • project_id – Project to import labels into

  • name – Name of the import job. Can be used to reference the task later

  • labels – List of labels

Returns:

LabelImport

classmethod create_from_url(client: Client, project_id: str, name: str, url: str) LabelImport[source]

Create a label annotation import job from a url The url must point to a file containing label annotations.

Parameters:
  • client – Labelbox Client for executing queries

  • project_id – Project to import labels into

  • name – Name of the import job. Can be used to reference the task later

  • url – Url pointing to file to upload

Returns:

LabelImport

classmethod from_name(client: Client, project_id: str, name: str, as_json: bool = False) LabelImport[source]

Retrieves an label import job.

Parameters:
  • client – Labelbox Client for executing queries

  • project_id – ID used for querying import jobs

  • name – Name of the import job.

Returns:

LabelImport

property parent_id: str

Identifier for this import. Used to refresh the status

class labelbox.schema.annotation_import.MALPredictionImport(client, field_values)[source]

Bases: CreatableAnnotationImport

classmethod create_from_file(client: Client, project_id: str, name: str, path: str) MALPredictionImport[source]

Create an MAL prediction import job from a file of annotations

Parameters:
  • client – Labelbox Client for executing queries

  • project_id – Project to import labels into

  • name – Name of the import job. Can be used to reference the task later

  • path – Path to ndjson file containing annotations

Returns:

MALPredictionImport

classmethod create_from_objects(client: labelbox.Client, project_id: str, name: str, predictions: List[Dict[str, Any]] | List[Label]) MALPredictionImport[source]

Create an MAL prediction import job from an in memory dictionary

Parameters:
  • client – Labelbox Client for executing queries

  • project_id – Project to import labels into

  • name – Name of the import job. Can be used to reference the task later

  • predictions – List of prediction annotations

Returns:

MALPredictionImport

classmethod create_from_url(client: Client, project_id: str, name: str, url: str) MALPredictionImport[source]

Create an MAL prediction import job from a url The url must point to a file containing prediction annotations.

Parameters:
  • client – Labelbox Client for executing queries

  • project_id – Project to import labels into

  • name – Name of the import job. Can be used to reference the task later

  • url – Url pointing to file to upload

Returns:

MALPredictionImport

delete() None[source]

Deletes a MALPredictionImport job

classmethod from_name(client: Client, project_id: str, name: str, as_json: bool = False) MALPredictionImport[source]

Retrieves an MAL import job.

Parameters:
  • client – Labelbox Client for executing queries

  • project_id – ID used for querying import jobs

  • name – Name of the import job.

Returns:

MALPredictionImport

property parent_id: str

Identifier for this import. Used to refresh the status

class labelbox.schema.annotation_import.MEAPredictionImport(client, field_values)[source]

Bases: CreatableAnnotationImport

classmethod create_from_file(client: Client, model_run_id: str, name: str, path: str) MEAPredictionImport[source]

Create an MEA prediction import job from a file of annotations

Parameters:
  • client – Labelbox Client for executing queries

  • model_run_id – Model run to import labels into

  • name – Name of the import job. Can be used to reference the task later

  • path – Path to ndjson file containing annotations

Returns:

MEAPredictionImport

classmethod create_from_objects(client: labelbox.Client, model_run_id: str, name, predictions: List[Dict[str, Any]] | List[Label]) MEAPredictionImport[source]

Create an MEA prediction import job from an in memory dictionary

Parameters:
  • client – Labelbox Client for executing queries

  • model_run_id – Model run to import labels into

  • name – Name of the import job. Can be used to reference the task later

  • predictions – List of prediction annotations

Returns:

MEAPredictionImport

classmethod create_from_url(client: Client, model_run_id: str, name: str, url: str) MEAPredictionImport[source]

Create an MEA prediction import job from a url The url must point to a file containing prediction annotations.

Parameters:
  • client – Labelbox Client for executing queries

  • model_run_id – Model run to import labels into

  • name – Name of the import job. Can be used to reference the task later

  • url – Url pointing to file to upload

Returns:

MEAPredictionImport

classmethod from_name(client: Client, model_run_id: str, name: str, as_json: bool = False) MEAPredictionImport[source]

Retrieves an MEA import job.

Parameters:
  • client – Labelbox Client for executing queries

  • model_run_id – ID used for querying import jobs

  • name – Name of the import job.

Returns:

MEAPredictionImport

property parent_id: str

Identifier for this import. Used to refresh the status

class labelbox.schema.annotation_import.MEAToMALPredictionImport(client, field_values)[source]

Bases: AnnotationImport

classmethod create_for_model_run_data_rows(client: Client, model_run_id: str, data_row_ids: List[str], project_id: str, name: str) MEAToMALPredictionImport[source]

Create an MEA to MAL prediction import job from a list of data row ids of a specific model run

Parameters:
  • client – Labelbox Client for executing queries

  • data_row_ids – A list of data row ids

  • model_run_id – model run id

Returns:

MEAToMALPredictionImport

classmethod from_name(client: Client, project_id: str, name: str, as_json: bool = False) MEAToMALPredictionImport[source]

Retrieves an MEA to MAL import job.

Parameters:
  • client – Labelbox Client for executing queries

  • project_id – ID used for querying import jobs

  • name – Name of the import job.

Returns:

MALPredictionImport

property parent_id: str

Identifier for this import. Used to refresh the status