class documentation

Base class for storing the intermediate results of an annotation run that has been initiated and is waiting for its results to be merged back into the FiftyOne dataset.

The id_map dictionary must record the IDs of any existing labels that are being edited by the annotation run. Any new label fields do not need to have keys in this dictionary.

For image datasets, id_map should have the following format:

{
    "<label-field>": {
        "<sample-id>": "label-id" or ["label-id", ...],
        ...
    },
    ...
}

For video datasets, id_map should have the following format:

{
    "<label-field>": {
        "<sample-id>": {
            "<frame-id>": label-id" or ["label-id", ...],
            ...
        },
        ...
    },
    ...
}

When editing scalar fields, set the dictionary values corresponding to uploaded scalars to True (since scalars do not have IDs).

If a particular sample or frame was included in the annotation run but no labels/scalars were uploaded for editing, the corresponding entry in id_map can be either missing or have a value of None.

Note

This class is serialized for storage in the database by calling serialize.

Any public attributes of this class are included in the representation generated by serialize, so they must be JSON serializable.

Parameters
samplesa fiftyone.core.collections.SampleCollection
configan AnnotationBackendConfig
anno_keythe annotation key
id_mapa dictionary recording the existing label IDs, in the format described above
backendan AnnotationBackend
Method __enter__ Undocumented
Method __exit__ Undocumented
Method __init__ Undocumented
Method cleanup Deletes all information for this run from the annotation backend.
Method connect_to_api Returns an API instance connected to the annotation backend.
Method launch_editor Launches the annotation backend's editor for these results.
Method use_api Registers an API instance to use for subsequent operations.
Instance Variable id_map Undocumented
Class Method _from_dict Builds an AnnotationResults from a JSON dict representation of it.
Method _finalize_id_map Internal method that is (only) called prior to saving annotation results for the first time.
Method _format_label_ids Undocumented
Method _sample_ids_to_clip_ids Undocumented
Method _to_sample_annos Undocumented
Method _to_sample_ids Undocumented
Method _update_id_map Adds the given label IDs into this object's id_map.
Property _is_clips Whether this annotation run was perfromed on a clips view.
Property _is_frames Whether this annotation run was perfromed on a frames view.

Inherited from BaseRunResults (via AnnotationResults):

Class Method from_dict Builds a BaseRunResults from a JSON dict representation of it.
Static Method base_results_cls Returns the results class for the given run type.
Method attributes Returns the list of class attributes that will be serialized by serialize.
Method save Saves the results to the database.
Method save_config Saves these results config to the database.
Property cls The fully-qualified name of this BaseRunResults class.
Property config The BaseRunConfig for these results.
Property key The run key for these results.
Property samples The fiftyone.core.collections.SampleCollection associated with these results.
Instance Variable _backend Undocumented
Instance Variable _config Undocumented
Instance Variable _key Undocumented
Instance Variable _samples Undocumented
def __enter__(self): (source)

Undocumented

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

Undocumented

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 use_api(self, api): (source)

Registers an API instance to use for subsequent operations.

Parameters
apian AnnotationAPI
@classmethod
def _from_dict(cls, d, samples, config, anno_key): (source)
def _finalize_id_map(self): (source)

Internal method that is (only) called prior to saving annotation results for the first time.

def _format_label_ids(self, ids1, ids2): (source)

Undocumented

def _sample_ids_to_clip_ids(self): (source)

Undocumented

def _to_sample_annos(self, annos): (source)

Undocumented

def _to_sample_ids(self, ids): (source)

Undocumented

def _update_id_map(self, label_field, new_id_map): (source)

Adds the given label IDs into this object's id_map.

For image datasets, new_id_map should have the following format:

{
    "<sample-id>": "label-id" or ["label-id", ...],
    ...
},

For video datasets, new_id_map should have the following format:

{
    "<sample-id>": {
        "<frame-id>": label-id" or ["label-id", ...],
        ...
    },
    ...
}
Parameters
label_fieldthe label field
new_id_mapa dictionary in the format described above

Whether this annotation run was perfromed on a clips view.

Whether this annotation run was perfromed on a frames view.