class documentation

Exporter that writes YOLOv4 datasets to disk.

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

Parameters
export_dirthe directory to write the export. This has no effect if data_path, objects_path, and images_path are absolute paths
data_path

an optional parameter that enables explicit control over the location of the exported data and labels. Can be any of the following:

  • a folder name like "data" or "data/" specifying a subfolder of export_dir in which to export the data and labels
  • an absolute directory path in which to export the data and labels. In this case, the export_dir has no effect on the location of the data

If None, the data will be written into export_dir using the default folder name

labels_path

an optional parameter that enables explicit control over the location of the exported labels. Can be any of the following:

  • a folder name like "labels" or "labels/" specifying the location in export_dir in which to export the labels
  • an absolute folder path to which to export the labels. In this case, the export_dir has no effect on the location of the labels

If None, the labels will be written into the same directory as the exported media

objects_path

an optional parameter that enables explicit control over the location of the object names file. Can be any of the following:

  • a filename like "obj.names" specifying the location in export_dir in which to export the object names
  • an absolute filepath to which to export the object names. In this case, the export_dir has no effect on the location of the object names

If None, the object names will be written into export_dir using the default filename, unless no media is being exported, in which case this file will not be written

images_path

an optional parameter that enables explicit control over the location of the image listing file. Can be any of the following:

  • a filename like "images.txt" specifying the location in export_dir in which to export the image listing
  • an absolute filepath to which to export the image listing. In this case, the export_dir has no effect on the location of the image listing

If None, the image listing will be written into export_dir using the default filename, unless no media is being exported, in which case this file will not be written

export_media

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

  • True: copy all media files into the output directory
  • False: don't export media
  • "move": move all media files into the output directory
  • "symlink": create symlinks to the media files in the output directory

If None, the default value of this parameter will be chosen based on the value of the data_path parameter

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 data_path and labels_path to generate output paths for each exported image and labels file. 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
classesthe list of possible class labels
include_confidencewhether to include detection confidences in the export, if they exist
image_formatthe image format to use when writing in-memory images to disk. By default, fiftyone.config.default_image_ext is used
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 setup Performs any necessary setup before exporting the first sample in the dataset.
Instance Variable classes Undocumented
Instance Variable data_path Undocumented
Instance Variable export_media Undocumented
Instance Variable image_format Undocumented
Instance Variable images_path Undocumented
Instance Variable include_confidence Undocumented
Instance Variable labels_path Undocumented
Instance Variable objects_path 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.
Method _parse_classes Undocumented
Instance Variable _classes Undocumented
Instance Variable _dynamic_classes Undocumented
Instance Variable _images Undocumented
Instance Variable _labels_map_rev Undocumented
Instance Variable _media_exporter Undocumented
Instance Variable _rel_dir Undocumented
Instance Variable _writer Undocumented

Inherited from DatasetExporter (via LabeledImageDatasetExporter):

Method __enter__ Undocumented
Method __exit__ Undocumented
Method log_collection Logs any relevant information about the fiftyone.core.collections.SampleCollection whose samples will be exported.

Inherited from ExportPathsMixin (via LabeledImageDatasetExporter, DatasetExporter):

Static Method _parse_data_path Helper function that computes default values for the data_path and export_media parameters supported by many exporters.
Static Method _parse_labels_path Helper function that computes default values for the labels_path parameter supported by many exporters.
def __init__(self, export_dir=None, data_path=None, labels_path=None, objects_path=None, images_path=None, export_media=None, rel_dir=None, classes=None, include_confidence=False, image_format=None): (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, label, metadata=None): (source)

Exports the given sample to the dataset.

Parameters
image_or_pathan image or the path to the image on disk
labelan instance of label_cls, or a dictionary mapping field names to fiftyone.core.labels.Label instances, or None if the sample is unlabeled
metadata:Nonea fiftyone.core.metadata.ImageMetadata instance for the sample. Only required when requires_image_metadata is True
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__.

Undocumented

data_path: None = (source)

Undocumented

export_media: None = (source)

Undocumented

image_format: None = (source)

Undocumented

images_path: None = (source)

Undocumented

include_confidence: False = (source)

Undocumented

labels_path: None = (source)

Undocumented

objects_path: None = (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.

def _parse_classes(self): (source)

Undocumented

_classes: dict = (source)

Undocumented

_dynamic_classes = (source)

Undocumented

Undocumented

_labels_map_rev = (source)

Undocumented

_media_exporter = (source)

Undocumented

_rel_dir = (source)

Undocumented

Undocumented