module documentation

Dataset sample fields.

Copyright 2017-2025, Voxel51, Inc.

Class ArrayField An n-dimensional array field.
Class BooleanField A boolean field.
Class ClassesField A ListField that stores class label strings.
Class ColorField A string field that holds a hex color string like '#FF6D04'.
Class DateField A date field.
Class DateTimeField A datetime field.
Class DictField A dictionary field that wraps a standard Python dictionary.
Class EmbeddedDocumentField A field that stores instances of a given type of fiftyone.core.odm.BaseEmbeddedDocument object.
Class EmbeddedDocumentListField A field that stores a list of a given type of fiftyone.core.odm.BaseEmbeddedDocument objects.
Class Field A generic field.
Class FloatField A floating point number field.
Class FrameNumberField A video frame number field.
Class FrameSupportField A [first, last] frame support in a video.
Class GeoLineStringField A GeoJSON field storing a line of longitude and latitude coordinates.
Class GeoMultiLineStringField A GeoJSON field storing a list of lines.
Class GeoMultiPointField A GeoJSON field storing a list of points.
Class GeoMultiPolygonField A GeoJSON field storing a list of polygons.
Class GeoPointField A GeoJSON field storing a longitude and latitude coordinate point.
Class GeoPolygonField A GeoJSON field storing a polygon of longitude and latitude coordinates.
Class HeatmapRangeField A [min, max] range of the values in a fiftyone.core.labels.Heatmap.
Class IntField A 32 bit integer field.
Class KeypointsField A list of (x, y) coordinate pairs.
Class ListField A list field that wraps a standard Field, allowing multiple instances of the field to be stored as a list in the database.
Class MaskTargetsField A DictField that stores mapping between integer keys or RGB string hex keys and string targets.
Class ObjectIdField An Object ID field.
Class PolylinePointsField A list of lists of (x, y) coordinate pairs.
Class ReferenceField A reference field.
Class StringField A unicode string field.
Class UUIDField A UUID field.
Class VectorField A one-dimensional array field.
Function filter_schema Filters the schema according to the given constraints.
Function flatten_schema Returns a flat version of the given schema where all embedded document fields are included as top-level keys.
Function get_field_metadata Returns a dict of editable metadata for the given field.
Function hex_to_int Converts a hex string like "#ff6d04" to a hex integer.
Function int_array_to_rgb Converts a 2D hex integer mask array to an RGB mask array.
Function int_to_hex Converts an RRGGBB integer value to hex string like "#ff6d04".
Function is_integer_mask_targets Determines whether the provided mask targets use integer keys.
Function is_integer_target Determines whether the provided target is an integer.
Function is_rgb_mask_targets Determines whether the provided mask targets use RGB hex string keys.
Function is_rgb_target Determines whether the provided target is an RGB string.
Function matches_constraints Determines whether the field matches the given constraints.
Function rgb_array_to_int Converts an RGB mask array to a 2D hex integer mask array.
Function validate_constraints Validates the given field constraints.
Function validate_field Validates that the field matches the given constraints.
Class _GeoField Base class for GeoJSON fields.
Function _flatten Undocumented
Function _make_prefix Undocumented
Constant _ARRAY_FIELDS Undocumented
Constant _PRIMITIVE_FIELDS Undocumented
Constant _SUPPORTED_MODES Undocumented
def filter_schema(schema, ftype=None, embedded_doc_type=None, read_only=None, info_keys=None, created_after=None, include_private=False, flat=False, mode=None): (source)

Filters the schema according to the given constraints.

Parameters
schemaa dict mapping field names to Field instances
ftype:Nonean optional field type or iterable of types to which to restrict the returned schema. Must be subclass(es) of Field
embedded_doc_type:Nonean optional embedded document type or iterable of types to which to restrict the returned schema. Must be subclass(es) of fiftyone.core.odm.BaseEmbeddedDocument
read_only:Nonewhether to restrict to (True) or exclude (False) read-only fields. By default, all fields are included
info_keys:Nonean optional key or list of keys that must be in the field's info dict
created_after:Nonean optional datetime specifying a minimum creation date
include_private:Falsewhether to include fields that start with _ in the returned schema
flat:Falsewhether to return a flattened schema where all embedded document fields are included as top-level keys
mode:Nonewhether to apply the above constraints before and/or after flattening the schema. Only applicable when flat is True. Supported values are ("before", "after", "both"). The default is "after"
Returns
a dict mapping field names to Field instances
def flatten_schema(schema, ftype=None, embedded_doc_type=None, read_only=None, info_keys=None, created_after=None, include_private=False): (source)

Returns a flat version of the given schema where all embedded document fields are included as top-level keys.

Parameters
schemaa dict mapping field names to Field instances
ftype:Nonean optional field type or iterable of types to which to restrict the returned schema. Must be subclass(es) of Field
embedded_doc_type:Nonean optional embedded document type or iterable of types to which to restrict the returned schema. Must be subclass(es) of fiftyone.core.odm.BaseEmbeddedDocument
read_only:Nonewhether to restrict to (True) or exclude (False) read-only fields. By default, all fields are included
info_keys:Nonean optional key or list of keys that must be in the field's info dict
created_after:Nonean optional datetime specifying a minimum creation date
include_private:Falsewhether to include fields that start with _ in the returned schema
Returns
a dict mapping flattened paths to Field instances
def get_field_metadata(field): (source)

Returns a dict of editable metadata for the given field.

Parameters
fielda Field
Returns
a dict of field metadata
def hex_to_int(hex_str): (source)

Converts a hex string like "#ff6d04" to a hex integer.

Parameters
hex_stra hex string
Returns
an integer
def int_array_to_rgb(mask): (source)

Converts a 2D hex integer mask array to an RGB mask array.

Parameters
maska 2D integer mask array
Returns
an RGB mask array
def int_to_hex(value): (source)

Converts an RRGGBB integer value to hex string like "#ff6d04".

Parameters
valuean integer value
Returns
a hex string
def is_integer_mask_targets(mask_targets): (source)

Determines whether the provided mask targets use integer keys.

Parameters
mask_targetsa mask targets dict
Returns
True/False
def is_integer_target(target): (source)

Determines whether the provided target is an integer.

Parameters
targetan integer or RGB hex string
Returns
True/False
def is_rgb_mask_targets(mask_targets): (source)

Determines whether the provided mask targets use RGB hex string keys.

Parameters
mask_targetsa mask targets dict
Returns
True/False
def is_rgb_target(target): (source)

Determines whether the provided target is an RGB string.

Parameters
targetan integer or RGB hex string
Returns
True/False
def matches_constraints(field, ftype=None, embedded_doc_type=None, read_only=None, info_keys=None, created_after=None): (source)

Determines whether the field matches the given constraints.

Parameters
fielda Field
ftype:Nonean optional field type or iterable of types to enforce. Must be subclass(es) of Field
embedded_doc_type:Nonean optional embedded document type or iterable of types to enforce. Must be subclass(es) of fiftyone.core.odm.BaseEmbeddedDocument
read_only:Nonewhether to optionally enforce that the field is read-only (True) or not read-only (False)
info_keys:Nonean optional key or list of keys that must be in the field's info dict
created_after:Nonean optional datetime specifying a minimum creation date
Returns
True/False
def rgb_array_to_int(mask): (source)

Converts an RGB mask array to a 2D hex integer mask array.

Parameters
maskan RGB mask array
Returns
a 2D integer mask array
def validate_constraints(ftype=None, embedded_doc_type=None, read_only=None, info_keys=None, created_after=None): (source)

Validates the given field constraints.

Parameters
ftype:Nonean optional field type or iterable of types to enforce. Must be subclass(es) of Field
embedded_doc_type:Nonean optional embedded document type or iterable of types to enforce. Must be subclass(es) of fiftyone.core.odm.BaseEmbeddedDocument
read_only:Nonewhether to optionally enforce that the field is read-only (True) or not read-only (False)
info_keys:Nonean optional key or list of keys that must be in the field's info dict
created_after:Nonean optional datetime specifying a minimum creation date
Returns
True/False whether any constraints were provided
Raises
ValueErrorif the constraints are not valid
def validate_field(field, path=None, ftype=None, embedded_doc_type=None, read_only=None): (source)

Validates that the field matches the given constraints.

Parameters
fielda Field
path:Nonethe field or embedded.field.name. Only used to generate more informative error messages
ftype:Nonean optional field type or iterable of types to enforce. Must be subclass(es) of Field
embedded_doc_type:Nonean optional embedded document type or iterable of types to enforce. Must be subclass(es) of fiftyone.core.odm.BaseEmbeddedDocument
read_only:Nonewhether to optionally enforce that the field is read-only (True) or not read-only (False)
Raises
ValueErrorif the constraints are not valid
def _flatten(schema, prefix, name, field, ftype, embedded_doc_type, read_only, info_keys, created_after, include_private): (source)

Undocumented

def _make_prefix(path): (source)

Undocumented

_ARRAY_FIELDS = (source)

Undocumented

Value
(VectorField, ArrayField)
_SUPPORTED_MODES: tuple[str, ...] = (source)

Undocumented

Value
('before', 'after', 'both')