class LabeledImageDatasetIngestor(LabeledImageDatasetImporter, ImageIngestor): (source)
Constructor: LabeledImageDatasetIngestor(dataset_dir, samples, sample_parser, image_format, max_samples)
Dataset importer that ingests labeled images into the provided dataset_dir during import.
The source images and labels are parsed from the provided samples using
the provided fiftyone.utils.data.parsers.LabeledImageSampleParser
.
If an image path is available via
fiftyone.utils.data.parsers.LabeledImageSampleParser.get_image_path
,
then the image is directly copied from its source location into
dataset_dir. In this case, the original filename is maintained, unless
a name conflict would occur, in which case an index of the form
"-%d" % count is appended to the base filename.
If no image path is available, the image is read in-memory via
fiftyone.utils.data.parsers.LabeledImageSampleParser.get_image
and
written to dataset_dir in the following format:
<dataset_dir>/<image_count><image_format>
where image_count is the number of files in dataset_dir.
Parameters | |
dataset | the directory where input images will be ingested into |
samples | an iterable of samples that can be parsed by sample_parser |
sample | an
fiftyone.utils.data.parsers.LabeledImageSampleParser to
use to parse the samples |
image | the image format to use when writing in-memory images to disk. By default, fiftyone.config.default_image_ext is used |
max | a maximum number of samples to import. By default, all samples are imported |
Method | __init__ |
Undocumented |
Method | __iter__ |
Undocumented |
Method | __len__ |
The total number of samples that will be imported. |
Method | __next__ |
Returns information about the next sample in the dataset. |
Method | setup |
Performs any necessary setup before importing the first sample in the dataset. |
Instance Variable | sample |
Undocumented |
Instance Variable | samples |
Undocumented |
Property | has |
Whether this importer produces a dataset info dictionary. |
Property | has |
Whether this importer produces fiftyone.core.metadata.ImageMetadata instances for each image. |
Property | label |
The fiftyone.core.labels.Label class(es) returned by this importer. |
Instance Variable | _iter |
Undocumented |
Instance Variable | _num |
Undocumented |
Instance Variable | _num |
Undocumented |
Inherited from DatasetImporter
(via LabeledImageDatasetImporter
):
Method | __enter__ |
Undocumented |
Method | __exit__ |
Undocumented |
Method | close |
Performs any necessary actions after the last sample has been imported. |
Method | get |
Returns the dataset info for the dataset. |
Method | _preprocess |
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 ImageIngestor
(via LabeledImageDatasetImporter
, DatasetImporter
):
Method | _ingest |
Undocumented |
Method | _ingest |
Undocumented |
Method | _ingest |
Undocumented |
Method | _setup |
Undocumented |
Instance Variable | _filename |
Undocumented |
Undocumented
Returns information about the next sample in the dataset.
Returns | |
an(image_path, image_metadata, label)tuple, where |
|
Raises | |
StopIteration | if there are no more samples to import |
Performs any necessary setup before importing the first sample in the dataset.
This method is called when the importer's context manager interface is
entered, DatasetImporter.__enter__
.
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