module documentation

Metadata stored in dataset samples.

Copyright 2017-2025, Voxel51, Inc.

Class ImageMetadata Class for storing metadata about image samples.
Class Metadata Base class for storing metadata about generic samples.
Class SceneMetadata Class for storing metadata about 3D scene samples.
Class VideoMetadata Class for storing metadata about video samples.
Function compute_metadata Populates the metadata field of all samples in the collection.
Function compute_sample_metadata Populates the metadata field of the sample.
Function get_image_info Retrieves the dimensions and number of channels of the given image from a file-like object that is streaming its contents.
Function get_metadata_cls Get the metadata class for a media_type
Variable logger Undocumented
Function _compute_metadata Undocumented
Function _compute_metadata_multi Undocumented
Function _compute_sample_metadata Undocumented
Function _do_compute_metadata Undocumented
Function _get_metadata Undocumented
Function _image_has_flipped_dimensions Returns True if image has flipped width/height dimensions
Function _parse_assets Undocumented
def compute_metadata(sample_collection, overwrite=False, num_workers=None, skip_failures=True, warn_failures=False, progress=None): (source)

Populates the metadata field of all samples in the collection.

Any samples with existing metadata are skipped, unless overwrite == True.

Parameters
sample_collectiona fiftyone.core.collections.SampleCollection
overwrite:Falsewhether to overwrite existing metadata
num_workers:Nonea suggested number of threads to use
skip_failures:Truewhether to gracefully continue without raising an error if metadata cannot be computed for a sample
warn_failures:Falsewhether to log a warning if metadata cannot be computed for a sample
progress:Nonewhether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead
def compute_sample_metadata(sample, overwrite=False, skip_failures=False): (source)

Populates the metadata field of the sample.

Parameters
samplea fiftyone.core.sample.Sample
overwrite:Falsewhether to overwrite existing metadata
skip_failures:Falsewhether to gracefully continue without raising an error if metadata cannot be computed
def get_image_info(f): (source)

Retrieves the dimensions and number of channels of the given image from a file-like object that is streaming its contents.

Parameters
fa file-like object that supports read(), seek(), tell()
Returns
(width, height, num_channels)
def get_metadata_cls(media_type): (source)

Get the metadata class for a media_type

Parameters
media_type:stra media type value
Returns
a Metadata class

Undocumented

def _compute_metadata(sample_collection, overwrite=False, batch_size=1000, progress=None): (source)

Undocumented

def _compute_metadata_multi(sample_collection, num_workers, overwrite=False, batch_size=1000, progress=None): (source)

Undocumented

def _compute_sample_metadata(filepath, media_type, skip_failures=False, cache=None): (source)

Undocumented

def _do_compute_metadata(args): (source)

Undocumented

def _get_metadata(filepath, media_type, cache=None): (source)

Undocumented

def _image_has_flipped_dimensions(img): (source)

Returns True if image has flipped width/height dimensions

EXIF Orientation metadata can specify that an image be rotated or otherwise transposed. PIL.Image does not handle this by default so we have to inspect the EXIF info. See PIL.ImageOps.exif_transpose() for the basis of this function, except we don't actually want to transpose the image when we only need the dimensions.

Tag name reference: https://exiftool.org/TagNames/EXIF.html PIL.ImageOps reference: https://github.com/python-pillow/Pillow/blob/main/src/PIL/ImageOps.py

Parameters
imga PIL.Image
Returns
True if image width/height should be flipped
def _parse_assets(scene, scene_path, cache=None): (source)

Undocumented