fiftyone.core.annotation.utils#

Annotation utils

Copyright 2017-2026, Voxel51, Inc.

Functions:

ensure_collection_is_supported(sample_collection)

Ensure a fiftyone.core.collections.SampleCollection is supported by the App for annotation.

get_supported_app_annotation_fields(...)

Gets the supported App annotation fields for a fiftyone.core.collections.SampleCollection.

list_valid_annotation_fields(sample_collection)

Lists all valid annotation fields for a fiftyone.core.collections.SampleCollection.

flatten_fields(collection,ย fields[,ย ...])

Flattens embedded document fields into dot-separated paths.

get_type(field)

Get the type of a field for a label schema

fiftyone.core.annotation.utils.ensure_collection_is_supported(sample_collection)#

Ensure a fiftyone.core.collections.SampleCollection is supported by the App for annotation.

Args:
sample_collection: a

fiftyone.core.collections.SampleCollection

fiftyone.core.annotation.utils.get_supported_app_annotation_fields(sample_collection)#

Gets the supported App annotation fields for a fiftyone.core.collections.SampleCollection.

Currently supported media types for the collection are image and 3d. See fiftyone.core.collections.SampleCollection.media_type

All supported primitive and embedded.document primitives are supported as documented in generate_label_schemas()

The below fiftyone.core.labels.Label types are also resolved.

Supported image fiftyone.core.labels.Label types are:
Supported 3d label types are:
Parameters:

sample_collection โ€“ a fiftyone.core.collections.SampleCollection

Returns:

a list of supported fields

fiftyone.core.annotation.utils.list_valid_annotation_fields(sample_collection, require_app_support=False, flatten=False)#

Lists all valid annotation fields for a fiftyone.core.collections.SampleCollection.

A field may be valid, but not yet supported by the App for human annotation.

Parameters:
  • sample_collection โ€“ a fiftyone.core.collections.SampleCollection

  • require_app_support (False) โ€“ whether to only include fields supported by the App for annotation

  • flatten (False) โ€“ whether to flatten embedded documents with dot.notation

Returns:

a sorted list of valid annotation field names

fiftyone.core.annotation.utils.flatten_fields(collection, fields, require_app_support=False)#

Flattens embedded document fields into dot-separated paths.

Parameters:
  • collection โ€“ the sample collection

  • fields โ€“ iterable of field names to flatten

  • require_app_support (False) โ€“ whether to only include fields supported by the App for annotation

Returns:

sorted list of flattened field names

fiftyone.core.annotation.utils.get_type(field)#

Get the type of a field for a label schema

Parameters:

field โ€“ the field instance

Returns:

a label schema type