class documentation

Singleton metaclass for fiftyone.core.frame.Frame.

This metaclass maintains a weakref dictionary of all in-memory fiftyone.core.frame.Frame instances keyed by [collection name][sample ID][frame number].

Method __new__ Undocumented
Method _clear Removes all frames for the given collection from the cache.
Method _clear_fields Clears the values for the given fields (i.e., sets them to None) on all in-memory frames in the collection.
Method _get_instance Retrieves the fiftyone.core.document.Document instance for the given document, if one exists.
Method _get_instances Returns a frame number -> Frame dict containing all in-memory frame instances for the specified sample.
Method _purge_fields Removes the fields from all in-memory frames in the collection.
Method _register_instance Registers the given instance in the weakref dictionary.
Method _reload_doc Reloads the backing document for the given frame if it is in-memory.
Method _reload_docs Reloads the backing documents for in-memory frames in the collection.
Method _reload_instance Reloads the backing document for the given instance (or view), if a reference exists to it.
Method _rename_fields Renames the field on all in-memory frames in the collection.
Method _reset_docs Resets the backing documents for in-memory frames in the collection.
Method _reset_docs_by_frame_id Resets the backing documents for all in-memory frames with the given frame IDs.
Method _reset_docs_for_sample Resets the backing documents for all in-memory frames with the given frame numbers attached to the specified sample.
Method _sync_docs Syncs the backing documents for all in-memory frames according to the following rules:
Method _sync_docs_for_sample Syncs the backing documents for all in-memory frames attached to the specified sample according to the following rules:
def __new__(metacls, *args, **kwargs): (source)

Undocumented

def _clear(cls, collection_name): (source)

Removes all frames for the given collection from the cache.

def _clear_fields(cls, collection_name, field_names): (source)

Clears the values for the given fields (i.e., sets them to None) on all in-memory frames in the collection.

def _get_instance(cls, doc): (source)

Retrieves the fiftyone.core.document.Document instance for the given document, if one exists.

Parameters
clsUndocumented
doca fiftyone.core.odm.document.Document
Returns
a fiftyone.core.document.Document instance, or None
def _get_instances(cls, collection_name, sample_id): (source)

Returns a frame number -> Frame dict containing all in-memory frame instances for the specified sample.

def _purge_fields(cls, collection_name, field_names): (source)

Removes the fields from all in-memory frames in the collection.

def _register_instance(cls, obj): (source)

Registers the given instance in the weakref dictionary.

Parameters
clsUndocumented
obja Document
def _reload_doc(cls, collection_name, sample_id, frame_number, hard=False): (source)

Reloads the backing document for the given frame if it is in-memory.

def _reload_docs(cls, collection_name, sample_ids=None, frame_ids=None, hard=False): (source)

Reloads the backing documents for in-memory frames in the collection.

If sample_ids are provided, only frames attached to samples with these IDs are reloaded.

def _reload_instance(cls, obj): (source)

Reloads the backing document for the given instance (or view), if a reference exists to it.

Parameters
clsUndocumented
obja Document or DocumentView
def _rename_fields(cls, collection_name, field_names, new_field_names): (source)

Renames the field on all in-memory frames in the collection.

def _reset_docs(cls, collection_name, sample_ids=None): (source)

Resets the backing documents for in-memory frames in the collection.

If sample_ids are provided, only frames attached to samples with the given sample IDs are reset.

def _reset_docs_by_frame_id(cls, collection_name, frame_ids, keep=False): (source)

Resets the backing documents for all in-memory frames with the given frame IDs.

When keep=True, all frames whose IDs are not in frame_ids are reset instead.

def _reset_docs_for_sample(cls, collection_name, sample_id, frame_numbers, keep=False): (source)

Resets the backing documents for all in-memory frames with the given frame numbers attached to the specified sample.

When keep=True, all frames whose frame numbers are not in frame_numbers are reset instead.

def _sync_docs(cls, collection_name, sample_ids, hard=False): (source)

Syncs the backing documents for all in-memory frames according to the following rules:

  • Frames attached to samples whose IDs are in sample_ids are reloaded
  • Frames attached to samples whose IDs are not in sample_ids are reset
def _sync_docs_for_sample(cls, collection_name, sample_id, frame_numbers, hard=False): (source)

Syncs the backing documents for all in-memory frames attached to the specified sample according to the following rules:

  • Frames whose frame numbers are in frame_numbers are reloaded
  • Frames whose frame numbers are not in frame_numbers are reset