Dataset importers.
Class |
|
Base interface for importers that load all of their samples in a single call to import_samples . |
Class |
|
Base interface for importing datasets stored on disk into FiftyOne. |
Class |
|
Importer for FiftyOne datasets stored on disk in serialized JSON format. |
Class |
|
Importer for image classification datasets stored on disk in a simple JSON format. |
Class |
|
Importer for image detection datasets stored on disk in a simple JSON format. |
Class |
|
Importer for labeled image datasets whose labels are stored in ETA ImageLabels format. |
Class |
|
Importer for temporal video detection datasets stored on disk in a simple JSON format. |
Class |
|
Importer for labeled video datasets whose labels are stored in ETA VideoLabels format. |
Class |
|
Interface for importing datasets that contain arbitrary fiftyone.core.sample.Sample instances. |
Class |
|
Interface for importing datasets that contain arbitrary grouped fiftyone.core.sample.Sample instances. |
Class |
|
Importer for an image classification directory tree stored on disk. |
Class |
|
Importer for a directory of images stored on disk. |
Class |
|
Importer for image segmentation datasets stored on disk. |
Class |
|
Mixin for DatasetImporter classes that provides convenience methods for parsing the data_path and labels_path parameters supported by many importers. |
Class |
|
Interface for importing datasets of labeled image samples. |
Class |
|
Interface for importing datasets of labeled video samples. |
Class |
|
Legacy importer for FiftyOne datasets stored on disk in a serialized JSON format. |
Class |
|
Importer for a directory of media files stored on disk. |
Class |
|
Interface for importing datasets of unlabeled image samples. |
Class |
|
Interface for importing datasets of unlabeled media samples. |
Class |
|
Interface for importing datasets of unlabeled video samples. |
Class |
|
Importer for a viideo classification directory tree stored on disk. |
Class |
|
Importer for a directory of videos stored on disk. |
Function | build |
Builds the DatasetImporter instance for the given parameters. |
Function | import |
Adds the samples from the given DatasetImporter to the dataset. |
Function | merge |
Merges the samples from the given DatasetImporter into the dataset. |
Function | parse |
Parses the info returned by DatasetImporter.get_dataset_info and stores it on the relevant properties of the dataset. |
Variable | logger |
Undocumented |
Function | _build |
Undocumented |
Function | _generate |
Undocumented |
Function | _get |
Undocumented |
Function | _handle |
Undocumented |
Function | _import |
Undocumented |
Function | _import |
Undocumented |
Function | _import |
Undocumented |
Function | _load |
Undocumented |
Function | _parse |
Undocumented |
Function | _parse |
Undocumented |
Function | _set |
Undocumented |
Function | _to |
Undocumented |
Function | _update |
Undocumented |
Builds the DatasetImporter
instance for the given parameters.
Parameters | |
dataset | the fiftyone.types.Dataset type |
stripTrue | whether to exclude None-valued items from kwargs |
warnTrue | whether to issue warnings for any non-None unused parameters encountered |
name:None | the name of the dataset being imported into, if known |
**kwargs | keyword arguments to pass to the dataset importer's constructor via DatasetImporter(**kwargs) |
Returns | |
a tuple of |
|
Adds the samples from the given DatasetImporter
to the dataset.
See :ref:`this guide <custom-dataset-importer>` for more details about
importing datasets in custom formats by defining your own
DatasetImporter
.
Parameters | |
dataset | a fiftyone.core.dataset.Dataset |
dataset | a DatasetImporter |
labelNone | controls the field(s) in which imported labels are
stored. Only applicable if dataset_importer is a
LabeledImageDatasetImporter or
LabeledVideoDatasetImporter . If the importer 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 importer 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:None | an optional tag or iterable of tags to attach to each sample |
expandTrue | whether 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:False | whether to declare dynamic attributes of embedded document fields that are encountered |
addTrue | whether to add dataset info from the importer (if any) to the dataset |
progress:None | whether 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 |
Merges the samples from the given DatasetImporter
into the
dataset.
See :ref:`this guide <custom-dataset-importer>` for more details about
importing datasets in custom formats by defining your own
DatasetImporter
.
By default, samples with the same absolute filepath are merged, but you can customize this behavior via the key_field and key_fcn parameters. For example, you could set key_fcn = lambda sample: os.path.basename(sample.filepath) to merge samples with the same base filename.
The behavior of this method is highly customizable. By default, all
top-level fields from the imported samples are merged in, overwriting any
existing values for those fields, with the exception of list fields
(e.g., tags) and label list fields (e.g.,
fiftyone.core.labels.Detections
fields), in which case the
elements of the lists themselves are merged. In the case of label list
fields, labels with the same id in both collections are updated rather
than duplicated.
To avoid confusion between missing fields and fields whose value is None, None-valued fields are always treated as missing while merging.
This method can be configured in numerous ways, including:
- Whether existing samples should be modified or skipped
- Whether new samples should be added or omitted
- Whether new fields can be added to the dataset schema
- Whether list fields should be treated as ordinary fields and merged as a whole rather than merging their elements
- Whether to merge only specific fields, or all but certain fields
- Mapping input fields to different field names of this dataset
Parameters | |
dataset | a fiftyone.core.dataset.Dataset |
dataset | a DatasetImporter |
labelNone | controls the field(s) in which imported labels are
stored. Only applicable if dataset_importer is a
LabeledImageDatasetImporter or
LabeledVideoDatasetImporter . If the importer 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 importer 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:None | an optional tag or iterable of tags to attach to each sample |
key | the sample field to use to decide whether to join with an existing sample |
keyNone | a function that accepts a
fiftyone.core.sample.Sample instance and computes a key to
decide if two samples should be merged. If a key_fcn is
provided, key_field is ignored |
skipFalse | whether to skip existing samples (True) or merge them (False) |
insertTrue | whether to insert new samples (True) or skip them (False) |
fields:None | an optional field or iterable of fields to which to restrict the merge. If provided, fields other than these are omitted from samples when merging or adding samples. One exception is that filepath is always included when adding new samples, since the field is required. This can also be a dict mapping field names of the input collection to field names of this dataset |
omitNone | an optional field or iterable of fields to exclude from the merge. If provided, these fields are omitted from imported samples, if present. One exception is that filepath is always included when adding new samples, since the field is required |
mergeTrue | whether to merge the elements of list fields
(e.g., tags) and label list fields (e.g.,
fiftyone.core.labels.Detections fields) rather than
merging the entire top-level field like other field types. For
label lists fields, existing fiftyone.core.label.Label
elements are either replaced (when overwrite is True) or kept
(when overwrite is False) when their id matches a label
from the provided samples |
overwrite:True | whether to overwrite (True) or skip (False) existing fields and label elements |
expandTrue | whether to dynamically add new 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:False | whether to declare dynamic attributes of embedded document fields that are encountered |
addTrue | whether to add dataset info from the importer (if any) to the dataset |
progress:None | whether 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 |
Parses the info returned by DatasetImporter.get_dataset_info
and
stores it on the relevant properties of the dataset.
Parameters | |
dataset | a fiftyone.core.dataset.Dataset |
info | an info dict |
overwrite:True | whether to overwrite existing dataset info fields |