module documentation

Sample parsers.

Copyright 2017-2025, Voxel51, Inc.

Class ExtractClipsMixin Mixin for sample parsers that extract clips from fiftyone.core.clips.ClipView instances.
Class FiftyOneImageClassificationSampleParser Parser for samples in FiftyOne image classification datasets.
Class FiftyOneImageDetectionSampleParser Parser for samples in FiftyOne image detection datasets.
Class FiftyOneImageLabelsSampleParser Parser for samples in FiftyOne image labels datasets.
Class FiftyOneLabeledImageSampleParser Parser for fiftyone.core.sample.Sample instances that contain labeled images.
Class FiftyOneLabeledVideoSampleParser Parser for fiftyone.core.sample.Sample instances that contain labeled videos.
Class FiftyOneTemporalDetectionSampleParser Parser for samples in FiftyOne temporal detection datasets.
Class FiftyOneUnlabeledImageSampleParser Parser for fiftyone.core.sample.Sample instances that contain images.
Class FiftyOneUnlabeledMediaSampleParser Parser for fiftyone.core.sample.Sample instances that contain unlabeled media.
Class FiftyOneUnlabeledVideoSampleParser Parser for fiftyone.core.sample.Sample instances that contain videos.
Class FiftyOneVideoLabelsSampleParser Parser for samples in FiftyOne video labels datasets.
Class ImageClassificationSampleParser Generic parser for image classification(s) samples whose labels are represented as fiftyone.core.labels.Classification instances.
Class ImageDetectionSampleParser Generic parser for image detection samples whose labels are represented as fiftyone.core.labels.Detections instances.
Class ImageLabelsSampleParser Generic parser for multitask image prediction samples whose labels are stored in eta.core.image.ImageLabels format.
Class ImageSampleParser Sample parser that parses unlabeled image samples.
Class LabeledImageSampleParser Interface for SampleParser instances that parse labeled image samples.
Class LabeledImageTupleSampleParser Generic sample parser that parses samples that are (image_or_path, label) tuples, where:
Class LabeledVideoSampleParser Interface for SampleParser instances that parse labeled video samples.
Class MediaSampleParser Sample parser that parses unlabeled media samples.
Class SampleParser Base interface for sample parsers.
Class UnlabeledImageSampleParser Interface for SampleParser instances that parse unlabeled image samples.
Class UnlabeledMediaSampleParser Interface for SampleParser instances that parse unlabeled media samples.
Class UnlabeledVideoSampleParser Interface for SampleParser instances that parse unlabeled video samples.
Class VideoLabelsSampleParser Generic parser for labeled video samples whose labels are represented in eta.core.video.VideoLabels format.
Class VideoSampleParser Sample parser that parses unlabeled video samples.
Function add_images Adds the given images to the dataset.
Function add_labeled_images Adds the given labeled images to the dataset.
Function add_labeled_videos Adds the given labeled videos to the dataset.
Function add_videos Adds the given videos to the dataset.
def add_images(dataset, samples, sample_parser, tags=None, progress=None): (source)

Adds the given images to the dataset.

This operation does not read the images.

See :ref:`this guide <custom-sample-parser>` for more details about adding images to a dataset by defining your own UnlabeledImageSampleParser.

Parameters
dataseta fiftyone.core.dataset.Dataset
samplesan iterable of samples that can be parsed by sample_parser
sample_parsera UnlabeledImageSampleParser instance to use to parse the samples
tags:Nonean optional tag or iterable of tags to attach to each 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
Returns
a list of IDs of the samples that were added to the dataset
def add_labeled_images(dataset, samples, sample_parser, label_field=None, tags=None, expand_schema=True, dynamic=False, progress=None): (source)

Adds the given labeled images to the dataset.

This operation will iterate over all provided samples, but the images will not be read (unless the sample parser requires it in order to compute image metadata).

See :ref:`this guide <custom-sample-parser>` for more details about adding labeled images to a dataset by defining your own LabeledImageSampleParser.

Parameters
dataseta fiftyone.core.dataset.Dataset
samplesan iterable of samples that can be parsed by sample_parser
sample_parsera LabeledImageSampleParser instance to use to parse the samples
label_field:Nonecontrols the field(s) in which imported labels are stored. If the parser produces a single fiftyone.core.labels.Label instance per sample, this argument specifies the name of the field to use; the default is "ground_truth". If the parser produces a dictionary of labels per sample, this argument can be either a string prefix to prepend to each label key or a dict mapping label keys to field names; the default in this case is to directly use the keys of the imported label dictionaries as field names
tags:Nonean optional tag or iterable of tags to attach to each sample
expand_schema:Truewhether to dynamically add new sample fields encountered to the dataset schema. If False, an error is raised if a sample's schema is not a subset of the dataset schema
dynamic:Falsewhether to declare dynamic attributes of embedded document fields that are encountered
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
Returns
a list of IDs of the samples that were added to the dataset
def add_labeled_videos(dataset, samples, sample_parser, label_field=None, tags=None, expand_schema=True, dynamic=False, progress=None): (source)

Adds the given labeled videos to the dataset.

This operation will iterate over all provided samples, but the videos will not be read/decoded/etc.

See :ref:`this guide <custom-sample-parser>` for more details about adding labeled videos to a dataset by defining your own LabeledVideoSampleParser.

Parameters
dataseta fiftyone.core.dataset.Dataset
samplesan iterable of samples that can be parsed by sample_parser
sample_parsera LabeledVideoSampleParser instance to use to parse the samples
label_field:Nonecontrols the field(s) in which imported labels are stored. If the parser produces a single fiftyone.core.labels.Label instance per sample/frame, this argument specifies the name of the field to use; the default is "ground_truth". If the parser produces a dictionary of labels per sample/frame, this argument can be either a string prefix to prepend to each label key or a dict mapping label keys to field names; the default in this case is to directly use the keys of the imported label dictionaries as field names
tags:Nonean optional tag or iterable of tags to attach to each sample
expand_schema:Truewhether to dynamically add new sample fields encountered to the dataset schema. If False, an error is raised if a sample's schema is not a subset of the dataset schema
dynamic:Falsewhether to declare dynamic attributes of embedded document fields that are encountered
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
Returns
a list of IDs of the samples that were added to the dataset
def add_videos(dataset, samples, sample_parser, tags=None, progress=None): (source)

Adds the given videos to the dataset.

This operation does not read the videos.

See :ref:`this guide <custom-sample-parser>` for more details about adding videos to a dataset by defining your own UnlabeledVideoSampleParser.

Parameters
dataseta fiftyone.core.dataset.Dataset
samplesan iterable of samples that can be parsed by sample_parser
sample_parsera UnlabeledVideoSampleParser instance to use to parse the samples
tags:Nonean optional tag or iterable of tags to attach to each 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
Returns
a list of IDs of the samples that were added to the dataset