<!-- # hard line break macro for HTML -->

# fiftyone.utils.places

Utilities for working with the
[Places dataset](http://places2.csail.mit.edu/index.html).

Copyright 2017-2026, Voxel51, Inc.
<br/>
[voxel51.com](https://voxel51.com/)
<br/>
<br/>

**Functions:**

| [`download_places_dataset_split`](#fiftyone.utils.places.download_places_dataset_split)(dataset_dir, split)   | Utility that downloads splits of the `Places dataset <http://places2.csail.mit.edu/index.html>`.   |
|---------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|

**Classes:**

| [`PlacesDatasetImporter`](#fiftyone.utils.places.PlacesDatasetImporter)(dataset_dir[, ...])   | 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: [`LabeledImageDatasetImporter`](fiftyone.utils.data.importers.md#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:**

| [`has_image_metadata`](#fiftyone.utils.places.PlacesDatasetImporter.has_image_metadata)   | Whether this importer produces [`fiftyone.core.metadata.ImageMetadata`](fiftyone.core.metadata.md#fiftyone.core.metadata.ImageMetadata) instances for each image.   |
|-------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`has_dataset_info`](#fiftyone.utils.places.PlacesDatasetImporter.has_dataset_info)       | Whether this importer produces a dataset info dictionary.                                                                                                           |
| [`label_cls`](#fiftyone.utils.places.PlacesDatasetImporter.label_cls)                     | The [`fiftyone.core.labels.Label`](fiftyone.core.labels.md#fiftyone.core.labels.Label) class(es) returned by this importer.                                         |

**Methods:**

| [`setup`](#fiftyone.utils.places.PlacesDatasetImporter.setup)()                         | Performs any necessary setup before importing the first sample in the dataset.                      |
|-----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| [`close`](#fiftyone.utils.places.PlacesDatasetImporter.close)(\*args)                   | Performs any necessary actions after the last sample has been imported.                             |
| [`get_dataset_info`](#fiftyone.utils.places.PlacesDatasetImporter.get_dataset_info)()   | Returns the dataset info for the dataset.                                                           |
| [`get_media_sources`](#fiftyone.utils.places.PlacesDatasetImporter.get_media_sources)() | Returns the media-source entries the importing dataset records before any sample is added, or None. |

#### *property* has_image_metadata

Whether this importer produces
[`fiftyone.core.metadata.ImageMetadata`](fiftyone.core.metadata.md#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`](fiftyone.core.labels.md#fiftyone.core.labels.Label) class(es) returned by this
importer.

This can be any of the following:

- a [`fiftyone.core.labels.Label`](fiftyone.core.labels.md#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`](fiftyone.core.labels.md#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`](fiftyone.core.labels.md#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

#### 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

#### get_media_sources()

Returns the media-source entries the importing dataset records
before any sample is added, or None.

Only importers of media-reference-backed samples provide these; see
[`fiftyone.utils.lerobot.LeRobotDatasetImporter`](fiftyone.utils.lerobot.md#fiftyone.utils.lerobot.LeRobotDatasetImporter).
