fiftyone.utils.places¶
Utilities for working with the Places dataset.
Functions:
|
Utility that downloads splits of the Places dataset <http://places2.csail.mit.edu/index.html>. |
Classes:
|
Class for importing datasets written by :meth:download_places_dataset_split`. |
-
fiftyone.utils.places.
download_places_dataset_split
(dataset_dir, split, raw_dir=None)¶ Utility that downloads splits of the Places dataset <http://places2.csail.mit.edu/index.html>.
Any existing files are not re-downloaded.
- Parameters
dataset_dir – the directory to download the dataset
split – the split to download. Supported values are
("train", "validation", "test")
raw_dir (None) – a directory in which full annotations files may be stored to avoid re-downloads in the future
- Returns
num_samples: the total number of downloaded images
classes: the list of all classes
did_download: whether any content was downloaded (True) or if all necessary files were already downloaded (False)
- Return type
a tuple of
-
class
fiftyone.utils.places.
PlacesDatasetImporter
(dataset_dir, shuffle=False, seed=None, max_samples=None)¶ Bases:
fiftyone.utils.data.importers.LabeledImageDatasetImporter
Class for importing datasets written by :meth:download_places_dataset_split`.
- Parameters
dataset_dir – the dataset directory
shuffle (False) – whether to randomly shuffle the order in which the samples are imported
seed (None) – a random seed to use when shuffling
max_samples (None) – a maximum number of samples to load. By default, all samples are imported
Attributes:
Whether this importer produces
fiftyone.core.metadata.ImageMetadata
instances for each image.Whether this importer produces a dataset info dictionary.
The
fiftyone.core.labels.Label
class(es) returned by this importer.Methods:
setup
()Performs any necessary setup before importing the first sample in the dataset.
close
(*args)Performs any necessary actions after the last sample has been imported.
Returns the dataset info for the dataset.
-
property
has_image_metadata
¶ Whether this importer produces
fiftyone.core.metadata.ImageMetadata
instances for each image.
-
property
has_dataset_info
¶ Whether this importer produces a dataset info dictionary.
-
property
label_cls
¶ 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 typea list or tuple of
fiftyone.core.labels.Label
classes. In this case, the importer can produce a single label field of any of these typesa 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 labelsNone
. In this case, the importer makes no guarantees about the labels that it may return
-
setup
()¶ 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__()
.
-
close
(*args)¶ Performs any necessary actions after the last sample has been imported.
This method is called when the importer’s context manager interface is exited,
DatasetImporter.__exit__()
.- Parameters
*args – the arguments to
DatasetImporter.__exit__()
-
get_dataset_info
()¶ Returns the dataset info for the dataset.
By convention, this method should be called after all samples in the dataset have been imported.
- Returns
a dict of dataset info