class ImageClassificationDirectoryTreeExporter(LabeledImageDatasetExporter): (source)
Constructor: ImageClassificationDirectoryTreeExporter(export_dir, export_media, rel_dir, image_format)
Exporter that writes an image classification directory tree to disk.
See :ref:`this page <ImageClassificationDirectoryTree-export>` for format details.
The filenames of the input images are maintained, unless a name conflict would occur, in which case an index of the form "-%d" % count is appended to the base filename.
Parameters | |
export | the directory to write the export |
export | controls how to export the raw media. The supported values are:
|
rel | an 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 | the 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 |
Exports the given sample to the dataset. |
Method | setup |
Performs any necessary setup before exporting the first sample in the dataset. |
Instance Variable | export |
Undocumented |
Instance Variable | image |
Undocumented |
Instance Variable | rel |
Undocumented |
Property | label |
The fiftyone.core.labels.Label class(es) exported by this exporter. |
Property | requires |
Whether this exporter requires fiftyone.core.metadata.ImageMetadata instances for each sample being exported. |
Instance Variable | _class |
Undocumented |
Instance Variable | _default |
Undocumented |
Instance Variable | _filename |
Undocumented |
Instance Variable | _media |
Undocumented |
Inherited from DatasetExporter
(via LabeledImageDatasetExporter
):
Method | __enter__ |
Undocumented |
Method | __exit__ |
Undocumented |
Method | log |
Logs any relevant information about the fiftyone.core.collections.SampleCollection whose samples will be exported. |
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 | |
*args | the arguments to DatasetExporter.__exit__ |
Exports the given sample to the dataset.
Parameters | |
image | an image or the path to the image on disk |
classification | Undocumented |
metadata:None | a fiftyone.core.metadata.ImageMetadata
instance for the sample. Only required when
requires_image_metadata is True |
label | an instance of label_cls , or a dictionary mapping
field names to fiftyone.core.labels.Label instances,
or None if the sample is unlabeled |
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__
.
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
Whether this exporter requires
fiftyone.core.metadata.ImageMetadata
instances for each sample
being exported.