class documentation

Exporter that writes a labeled image dataset to disk with labels stored in ETA ImageLabels format.

See :ref:`this page <FiftyOneImageLabelsDataset-export>` for format details.

If the path to an image is provided, the image is directly copied to its destination, maintaining the original filename, unless a name conflict would occur, in which case an index of the form "-%d" % count is appended to the base filename.

Parameters
export_dirthe directory to write the export
export_media

controls how to export the raw media. The supported values are:

  • True (default): copy all media files into the output directory
  • "move": move all media files into the output directory
  • "symlink": create symlinks to the media files in the output directory
rel_diran optional relative directory to strip from each input filepath to generate a unique identifier for each image. When exporting media, this identifier is joined with export_dir to generate an output path for each exported image. This argument allows for populating nested subdirectories that match the shape of the input paths. The path is converted to an absolute path (if necessary) via fiftyone.core.storage.normalize_path
image_formatthe image format to use when writing in-memory images to disk. By default, fiftyone.config.default_image_ext is used
pretty_printwhether to render the JSON in human readable format with newlines and indentations
Method __init__ Undocumented
Method close Performs any necessary actions after the last sample has been exported.
Method export_sample Exports the given sample to the dataset.
Method log_collection Logs any relevant information about the fiftyone.core.collections.SampleCollection whose samples will be exported.
Method setup Performs any necessary setup before exporting the first sample in the dataset.
Instance Variable export_media Undocumented
Instance Variable image_format Undocumented
Instance Variable pretty_print Undocumented
Instance Variable rel_dir Undocumented
Property label_cls The fiftyone.core.labels.Label class(es) exported by this exporter.
Property requires_image_metadata Whether this exporter requires fiftyone.core.metadata.ImageMetadata instances for each sample being exported.
Instance Variable _data_dir Undocumented
Instance Variable _dataset_index Undocumented
Instance Variable _description Undocumented
Instance Variable _labels_dir Undocumented
Instance Variable _manifest_path Undocumented
Instance Variable _media_exporter Undocumented

Inherited from DatasetExporter (via LabeledImageDatasetExporter):

Method __enter__ Undocumented
Method __exit__ Undocumented
def __init__(self, export_dir, export_media=None, rel_dir=None, image_format=None, pretty_print=False): (source)
def close(self, *args): (source)

Performs any necessary actions after the last sample has been exported.

This method is called when the exporter's context manager interface is exited, DatasetExporter.__exit__.

Parameters
*argsthe arguments to DatasetExporter.__exit__
def export_sample(self, image_or_path, labels, metadata=None): (source)

Exports the given sample to the dataset.

Parameters
image_or_pathan image or the path to the image on disk
labelsUndocumented
metadata:Nonea fiftyone.core.metadata.ImageMetadata instance for the sample. Only required when requires_image_metadata is True
labelan instance of label_cls, or a dictionary mapping field names to fiftyone.core.labels.Label instances, or None if the sample is unlabeled
def log_collection(self, sample_collection): (source)

Logs any relevant information about the fiftyone.core.collections.SampleCollection whose samples will be exported.

Subclasses can optionally implement this method if their export format can record information such as the fiftyone.core.collections.SampleCollection.info of the collection being exported.

By convention, this method must be optional; i.e., if it is not called before the first call to export_sample, then the exporter must make do without any information about the fiftyone.core.collections.SampleCollection (which may not be available, for example, if the samples being exported are not stored in a collection).

Parameters
sample_collectionthe fiftyone.core.collections.SampleCollection whose samples will be exported
def setup(self): (source)

Performs any necessary setup before exporting the first sample in the dataset.

This method is called when the exporter's context manager interface is entered, DatasetExporter.__enter__.

export_media: None = (source)

Undocumented

image_format: None = (source)

Undocumented

pretty_print: False = (source)

Undocumented

Undocumented

The fiftyone.core.labels.Label class(es) exported by this exporter.

This can be any of the following:

  • a fiftyone.core.labels.Label class. In this case, the exporter directly exports labels of this type
  • a list or tuple of fiftyone.core.labels.Label classes. In this case, the exporter can export a single label field of any of these types
  • a dict mapping keys to fiftyone.core.labels.Label classes. In this case, the exporter can handle label dictionaries with value-types specified by this dictionary. Not all keys need be present in the exported label dicts
  • None. In this case, the exporter makes no guarantees about the labels that it can export
@property
requires_image_metadata = (source)

Whether this exporter requires fiftyone.core.metadata.ImageMetadata instances for each sample being exported.

_data_dir = (source)

Undocumented

_dataset_index = (source)

Undocumented

_description = (source)

Undocumented

_labels_dir = (source)

Undocumented

_manifest_path = (source)

Undocumented

_media_exporter = (source)

Undocumented