fiftyone.utils.cityscapes#

Utilities for working with the Cityscapes dataset.

Copyright 2017-2025, Voxel51, Inc.

Functions:

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 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 format.

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

The source_dir should contain the following files:

source_dir/
    leftImg8bit_trainvaltest.zip
    gtFine_trainvaltest.zip             # optional
    gtCoarse.zip                        # optional
    gtBbox_cityPersons_trainval.zip     # optional
Parameters:
  • source_dir – the directory continaining 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 personn detections (True), or not (False), or only if the ZIP file exists (None)

Raises:

OSError – if any required source files are not present