class documentation

Importer for TF detection datasets stored on disk.

This class assumes that the input TFRecords only contain the images themselves and not their paths on disk, and, therefore, the images are read in-memory and written to the provided images_dir during import.

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

Parameters
dataset_dirthe dataset directory. If omitted, tf_records_path must be 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" or glob pattern like "*.records-*-of-*" specifying the location of the records in dataset_dir
  • an absolute filepath or glob pattern for the records. In this case, dataset_dir has no effect on the location of the records

If None, the parameter will default to *record*

images_dirthe directory in which the images will be written. If not provided, the images will be unpacked into dataset_dir
image_formatthe image format to use to write the images to disk. By default, fiftyone.config.default_image_ext is used
force_rgbwhether to force convert all images to RGB
max_samplesa maximum number of samples to import. By default, all samples are imported
Property label_cls The fiftyone.core.labels.Label class(es) returned by this importer.
Method _make_sample_parser Returns a TFRecordSampleParser instance for parsing TFRecords read by this importer.

Inherited from TFRecordsLabeledImageDatasetImporter:

Method __init__ Undocumented
Method __iter__ Undocumented
Method __next__ Returns information about the next sample in the dataset.
Method close Performs any necessary actions after the last sample has been imported.
Method setup Performs any necessary setup before importing the first sample in the dataset.
Property has_dataset_info Whether this importer produces a dataset info dictionary.
Property has_image_metadata Whether this importer produces fiftyone.core.metadata.ImageMetadata instances for each image.
Instance Variable _dataset_ingestor Undocumented
Instance Variable _iter_dataset_ingestor Undocumented
Instance Variable _sample_parser Undocumented

Inherited from DatasetImporter (via TFRecordsLabeledImageDatasetImporter, LabeledImageDatasetImporter):

Method __enter__ Undocumented
Method __exit__ Undocumented
Method __len__ The total number of samples that will be imported.
Method get_dataset_info Returns the dataset info for the dataset.
Method _preprocess_list Internal utility that preprocesses the given list---which is presumed to be a list defining the samples that should be imported---by applying the values of the shuffle, seed, and max_samples parameters of the importer.

Inherited from ImportPathsMixin (via TFRecordsLabeledImageDatasetImporter, LabeledImageDatasetImporter, DatasetImporter):

Static Method _load_data_map Helper function that parses either a data directory or a data manifest file into a UUID -> filepath map.
Static Method _parse_data_path Helper function that computes default values for the data_path parameter supported by many importers.
Static Method _parse_labels_path Helper function that computes default values for the labels_path parameter supported by many importers.

The fiftyone.core.labels.Label class(es) returned by this importer.

This can be any of the following:

  • a fiftyone.core.labels.Label class. In this case, the importer is guaranteed to return labels of this type
  • a list or tuple of fiftyone.core.labels.Label classes. In this case, the importer can produce a single label field of any of these types
  • a dict mapping keys to fiftyone.core.labels.Label classes. In this case, the importer will return label dictionaries with keys and value-types specified by this dictionary. Not all keys need be present in the imported labels
  • None. In this case, the importer makes no guarantees about the labels that it may return
def _make_sample_parser(self): (source)

Returns a TFRecordSampleParser instance for parsing TFRecords read by this importer.