class documentation

Base class for annotation backends.

Parameters
configan AnnotationBackendConfig
Method __enter__ Undocumented
Method __exit__ Undocumented
Method __init__ Undocumented
Method connect_to_api Returns an API instance connected to the annotation backend.
Method download_annotations Downloads the annotations from the annotation backend for the given results.
Method get_fields Gets the fields that were involved in the given run.
Method recommend_attr_tool Recommends an attribute tool for an attribute with the given name and value.
Method requires_attr_values Determines whether the list of possible values are required for attributes of the given type.
Method upload_annotations Uploads the samples and relevant existing labels from the label schema to the annotation backend.
Method use_api Registers an API instance to use for subsequent operations.
Property requires_label_schema Whether this backend requires a pre-defined label schema for its annotation runs.
Property supported_attr_types The list of attribute types supported by the backend.
Property supported_label_types The list of label types supported by the backend.
Property supported_media_types The list of media types that this backend supports.
Property supported_scalar_types The list of scalar field types supported by the backend.
Property supports_clips_views Whether this backend supports annotating clips views.
Property supports_keyframes Whether this backend supports uploading only keyframes when editing existing video track annotations.
Property supports_video_sample_fields Whether this backend supports annotating video labels at a sample-level.
Method _connect_to_api Returns a new API instance connected to the annotation backend.
Instance Variable _api Undocumented

Inherited from AnnotationMethod:

Class Method run_info_cls The BaseRunInfo class associated with this class.
Class Method _patch_function A function that can patch any ReferenceField issues with a dataset's runs.
Class Method _results_cache_field The fiftyone.core.dataset.Dataset field that stores the results cache for these runs.
Class Method _run_str A string to use when referring to these runs in log messages.
Class Method _runs_field The fiftyone.core.odm.dataset.DatasetDocument field in which these runs are stored.

Inherited from BaseRun (via AnnotationMethod):

Class Method delete_run Deletes the results associated with the given run key from the collection.
Class Method delete_runs Deletes all runs from the collection.
Class Method get_run_info Gets the BaseRunInfo for the given key on the collection.
Class Method has_cached_run_results Determines whether BaseRunResults for the given key are cached on the collection.
Class Method list_runs Returns the list of run keys on the given collection.
Class Method load_run_results Loads the BaseRunResults for the given key on the collection.
Class Method load_run_view Loads the fiftyone.core.view.DatasetView on which the specified run was performed.
Class Method save_run_info Saves the run information on the collection.
Class Method save_run_results Saves the run results on the collection.
Class Method update_run_config Updates the BaseRunConfig for the given run on the collection.
Class Method update_run_key Replaces the key for the given run with a new key.
Method cleanup Cleans up the results of the run with the given key from the collection.
Method ensure_requirements Ensures that any necessary packages to execute this run are installed.
Method ensure_usage_requirements Ensures that any necessary packages to use existing results for this run are installed.
Method register_run Registers a run of this method under the given key on the given collection.
Method rename Performs any necessary operations required to rename this run's key.
Method validate_run Validates that the collection can accept this run.
Class Method _get_run_doc Undocumented
Class Method _get_run_docs Undocumented
Class Method _get_run_fields Undocumented
Method _validate_fields_match Undocumented
Method _validate_run Subclass-specific validation when a run with the given key already exists.

Inherited from Configurable (via AnnotationMethod, BaseRun):

Instance Variable config Undocumented
def __enter__(self): (source)

Undocumented

def __exit__(self, *args): (source)

Undocumented

def __init__(self, *args, **kwargs): (source)
def connect_to_api(self): (source)

Returns an API instance connected to the annotation backend.

Existing API instances are reused, if available.

Some annotation backends may not expose this functionality.

Returns
an AnnotationAPI, or None if the backend does not expose an API
def download_annotations(self, results): (source)

Downloads the annotations from the annotation backend for the given results.

The returned labels should be represented as either scalar values or fiftyone.core.labels.Label instances.

For image datasets, the return dictionary should have the following nested structure:

# Scalar fields
results[label_type][sample_id] = scalar

# Label fields
results[label_type][sample_id][label_id] = label

For video datasets, the returned labels dictionary should have the following nested structure:

# Scalar fields
results[label_type][sample_id][frame_id] = scalar

# Label fields
results[label_type][sample_id][frame_id][label_id] = label

The valid values for label_type are:

  • "classifications": single or multilabel classifications
  • "detections": detections or instance segmentations
  • "polylines": polygons or polylines
  • "segmentation": semantic segmentations
  • "scalar": scalar values
Parameters
resultsan AnnotationResults
Returns
the labels results dict
def get_fields(self, samples, anno_key): (source)

Gets the fields that were involved in the given run.

Parameters
samplesa fiftyone.core.collections.SampleCollection
anno_keyUndocumented
keya run key
Returns
a list of fields
def recommend_attr_tool(self, name, value): (source)

Recommends an attribute tool for an attribute with the given name and value.

For example, a backend may recommend a tool as follows for a boolean value:

{
    "type": "radio",
    "values": [False, True],
}

or a tool as follows for a generic value:

{"type": "text"}
Parameters
namethe name of the attribute
valuethe attribute value, which may be None
Returns
an attribute type dict
def requires_attr_values(self, attr_type): (source)

Determines whether the list of possible values are required for attributes of the given type.

Parameters
attr_typethe attribute type string
Returns
True/False
def upload_annotations(self, samples, anno_key, launch_editor=False): (source)

Uploads the samples and relevant existing labels from the label schema to the annotation backend.

Parameters
samplesa fiftyone.core.collections.SampleCollection
anno_keythe annotation key
launch_editor:Falsewhether to launch the annotation backend's editor after uploading the samples
Returns
an AnnotationResults
def use_api(self, api): (source)

Registers an API instance to use for subsequent operations.

Parameters
apian AnnotationAPI
@property
requires_label_schema = (source)

Whether this backend requires a pre-defined label schema for its annotation runs.

@property
supported_attr_types = (source)

The list of attribute types supported by the backend.

This list defines the valid string values for the type field of an attributes dict of the label schema provided to the backend.

For example, CVAT supports ["text", "select", "radio", "checkbox"].

@property
supported_label_types = (source)

The list of label types supported by the backend.

Backends may support any subset of the following label types:

  • "classification"
  • "classifications"
  • "detection"
  • "detections"
  • "instance"
  • "instances"
  • "polyline"
  • "polylines"
  • "polygon"
  • "polygons"
  • "keypoint"
  • "keypoints"
  • "segmentation"
  • "scalar"
@property
supported_media_types = (source)

The list of media types that this backend supports.

For example, CVAT supports ["image", "video"].

@property
supports_clips_views = (source)

Whether this backend supports annotating clips views.

@property
supports_keyframes = (source)

Whether this backend supports uploading only keyframes when editing existing video track annotations.

@property
supports_video_sample_fields = (source)

Whether this backend supports annotating video labels at a sample-level.

def _connect_to_api(self): (source)

Returns a new API instance connected to the annotation backend.

Returns
an AnnotationAPI, or None if the backend does not expose an API

Undocumented