«
class documentation

Exporter that writes an object detection dataset to disk as TFRecords in the TF Object Detection API format.

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

Parameters
export_dirthe directory to write the export. Can be omitted if tf_records_path is provided
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
classesthe list of possible class labels
Method __init__ Undocumented
Instance Variable classes Undocumented
Property label_cls The fiftyone.core.labels.Label class(es) exported by this exporter.
Method _make_example_generator Returns a TFExampleGenerator instance that will generate tf.train.Example protos for this exporter.

Inherited from TFRecordsDatasetExporter:

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.
Property requires_image_metadata Whether this exporter requires fiftyone.core.metadata.ImageMetadata instances for each sample being exported.
Instance Variable _example_generator Undocumented
Instance Variable _filename_maker Undocumented
Instance Variable _tf_records_writer Undocumented

Inherited from DatasetExporter (via TFRecordsDatasetExporter, 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 TFRecordsDatasetExporter, 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, classes=None): (source)

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
def _make_example_generator(self): (source)

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