module documentation

FiftyOne Server utils.

Copyright 2017-2025, Voxel51, Inc.

Function cache_dataset Caches the given dataset.
Function change_label_tags Applies the changes to tags to all labels in the specified label field(s) of the collection, if necessary.
Function change_sample_tags Applies the changes to tags to all samples of the collection, if necessary.
Function from_dict Wrapping function for dacite.from_dict that ensures a common configuration is used.
Function load_and_cache_dataset Loads the dataset with the given name and caches it.
Function meets_type Determines whether the field meets type or types, or the field is a fiftyone.core.fields.ListField that meets the type or types
Function _parse_changes Undocumented
Variable _cache Undocumented
Variable _dacite_config Undocumented
def cache_dataset(dataset): (source)

Caches the given dataset.

This method ensures that subsequent calls to fiftyone.core.dataset.load_dataset in async calls will return this dataset singleton.

See load_and_cache_dataset for additional details.

Parameters
dataseta fiftyone.core.dataset.Dataset
def change_label_tags(sample_collection, changes, label_fields=None): (source)

Applies the changes to tags to all labels in the specified label field(s) of the collection, if necessary.

Parameters
sample_collectiona fiftyone.core.collections.SampleCollection
changesa dict of tags as keys and bools as values. A True value adds the tag to all labels, if necessary. A False value removes the tag from all labels, if necessary
label_fields:Nonean optional name or iterable of names of fiftyone.core.labels.Label fields. By default, all label fields are used
def change_sample_tags(sample_collection, changes): (source)

Applies the changes to tags to all samples of the collection, if necessary.

Parameters
sample_collectiona fiftyone.core.collections.SampleCollection
changesa dict of tags as keys and bools as values. A True value adds the tag to all samples, if necessary. A False value removes the tag from all samples, if necessary
def from_dict(data_class: type[T], data: Data) -> T: (source)

Wrapping function for dacite.from_dict that ensures a common configuration is used.

Parameters
data_class:type[T]a dataclass
data:Datathe data with which to instantiate the dataclass instance
Returns
Ta dataclass instance
def load_and_cache_dataset(name): (source)

Loads the dataset with the given name and caches it.

This method is a wrapper around fiftyone.core.dataset.load_dataset that stores a reference to every dataset it loads in a TTL cache to ensure that references to recently used datasets exist in memory so that dataset objects aren't garbage collected between async calls.

It is desirable to avoid dataset objects being garbage collected because datasets are singletons and may have objects (eg brain results) that are expensive to load cached on them.

Parameters
namethe dataset name
Returns
a fiftyone.core.dataset.Dataset
def meets_type(field: fof.Field, type_or_types): (source)

Determines whether the field meets type or types, or the field is a fiftyone.core.fields.ListField that meets the type or types

Parameters
field:fof.Fielda class:fiftyone.core.fields.Field
type_or_typesUndocumented
typea field type or tuple of field types
def _parse_changes(changes): (source)

Undocumented

Undocumented

_dacite_config = (source)

Undocumented