«
class documentation

Base class for fiftyone.utils.data.exporters.LabeledImageDatasetExporter instances that export labeled images as TFRecords datasets on disk.

Parameters
export_dirthe directory to write the export. This has no effect if tf_records_path is an absolute path
tf_records_path

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

  • a filename like "tf.records" specifying the location of the records in export_dir
  • an absolute filepath for the records. In this case, export_dir has no effect on the location of the records

If None, the parameter will default to tf.records

num_shardsan optional number of shards to split the records into (using a round robin strategy). If specified, -%%05d-of-%%05d is appended to the records path
image_formatthe image format to use when writing in-memory images to disk. By default, fiftyone.config.default_image_ext is used
force_rgbwhether to force convert all images to RGB
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 force_rgb Undocumented
Instance Variable image_format Undocumented
Instance Variable num_shards Undocumented
Instance Variable tf_records_path Undocumented
Property requires_image_metadata Whether this exporter requires fiftyone.core.metadata.ImageMetadata instances for each sample being exported.
Method _make_example_generator Returns a TFExampleGenerator instance that will generate tf.train.Example protos for this exporter.
Instance Variable _example_generator Undocumented
Instance Variable _filename_maker Undocumented
Instance Variable _tf_records_writer Undocumented

Inherited from LabeledImageDatasetExporter:

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

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, tf_records_path=None, num_shards=None, image_format=None, force_rgb=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, 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__.

@property
requires_image_metadata = (source)

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

def _make_example_generator(self): (source)

Returns a TFExampleGenerator instance that will generate tf.train.Example protos for this exporter.

_example_generator = (source)

Undocumented

_filename_maker = (source)

Undocumented

_tf_records_writer = (source)

Undocumented