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

# fiftyone.utils.cityscapes

Utilities for working with the
[Cityscapes dataset](https://www.cityscapes-dataset.com).

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

**Functions:**

| [`parse_cityscapes_dataset`](#fiftyone.utils.cityscapes.parse_cityscapes_dataset)(source_dir, ...[, ...])   | Parses the Cityscapes archive(s) in the specified directory and writes the requested splits in subdirectories of `dataset_dir` in [`fiftyone.types.FiftyOneDataset`](fiftyone.types.md#fiftyone.types.FiftyOneDataset) format.   |
|-------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|

### fiftyone.utils.cityscapes.parse_cityscapes_dataset(source_dir, dataset_dir, scratch_dir, splits, fine_annos=None, coarse_annos=None, person_annos=None)

Parses the Cityscapes archive(s) in the specified directory and writes
the requested splits in subdirectories of `dataset_dir` in
[`fiftyone.types.FiftyOneDataset`](fiftyone.types.md#fiftyone.types.FiftyOneDataset) format.

The archives must have been manually downloaded into the directory before
this method is called.

The `source_dir` should contain the following files:

```default
source_dir/
    leftImg8bit_trainvaltest.zip
    gtFine_trainvaltest.zip             # optional
    gtCoarse.zip                        # optional
    gtBbox_cityPersons_trainval.zip     # optional
```

* **Parameters:**
  * **source_dir** – the directory containing the manually downloaded
    Cityscapes files
  * **dataset_dir** – the directory in which to build the output dataset
  * **scratch_dir** – a scratch directory to use for temporary files
  * **splits** – a list of splits to parse. Supported values are
    `(train, test, validation)`
  * **fine_annos** (*None*) – whether to load the fine annotations (True), or not
    (False), or only if the ZIP file exists (None)
  * **coarse_annos** (*None*) – whether to load the coarse annotations (True), or
    not (False), or only if the ZIP file exists (None)
  * **person_annos** (*None*) – whether to load the person detections (True), or
    not (False), or only if the ZIP file exists (None)
* **Raises:**
  **OSError** – if any required source files are not present
