module documentation

Utilities for working with datasets in Berkeley DeepDrive (BDD) format.

Copyright 2017-2025, Voxel51, Inc.

Class BDDDatasetExporter Exporter that writes BDD datasets to disk.
Class BDDDatasetImporter Importer for BDD datasets stored on disk.
Function load_bdd_annotations Loads the BDD annotations from the given JSON file.
Function parse_bdd100k_dataset Parses the raw BDD100K download files in the specified directory into per-split directories in BDD format.
Variable logger Undocumented
Function _detection_to_bdd Undocumented
Function _ensure_bdd100k_dir Undocumented
Function _ensure_bdd100k_file Undocumented
Function _ensure_bdd100k_subdir Undocumented
Function _filter_attributes Undocumented
Function _get_attributes Undocumented
Function _make_bdd_annotation Undocumented
Function _parse_bdd_annotation Undocumented
Function _parse_bdd_detection Undocumented
Function _parse_bdd_polylines Undocumented
Function _parse_frame_labels Undocumented
Function _polyline_to_bdd Undocumented
Function _raise_bdd100k_error Undocumented
def load_bdd_annotations(json_path): (source)

Loads the BDD annotations from the given JSON file.

See :ref:`this page <BDDDataset-import>` for format details.

Parameters
json_paththe path to the annotations JSON file
Returns
a dict mapping filenames to BDD annotation dicts
def parse_bdd100k_dataset(source_dir, dataset_dir, copy_files=True, overwrite=False): (source)

Parses the raw BDD100K download files in the specified directory into per-split directories in BDD format.

This function assumes that the input source_dir contains the following contents:

source_dir/
    labels/
        bdd100k_labels_images_train.json
        bdd100k_labels_images_val.json
    images/
        100k/
            train/
            test/
            val/
    ...

and will populate dataset_dir as follows:

dataset_dir/
    train/
        data/
        labels.json
    validation/
        data/
        labels.json
    test/
        data/
Parameters
source_dirthe source directory containing the manually downloaded BDD100K files
dataset_dirthe directory to construct the output split directories
copy_files:Truewhether to move (False) or create copies (True) of the source files when populating dataset_dir
overwrite:Falsewhether to overwrite existing files/directories in the output location, if they exist
Raises
OSErrorif any required source files are not present

Undocumented

def _detection_to_bdd(detection, frame_size, extra_attrs): (source)

Undocumented

def _ensure_bdd100k_dir(source_dir): (source)

Undocumented

def _ensure_bdd100k_file(source_dir, filepath): (source)

Undocumented

def _ensure_bdd100k_subdir(source_dir, dirpath): (source)

Undocumented

def _filter_attributes(attributes, extra_attrs): (source)

Undocumented

def _get_attributes(label, extra_attrs): (source)

Undocumented

def _make_bdd_annotation(labels, metadata, filename, extra_attrs): (source)

Undocumented

def _parse_bdd_annotation(d, frame_size, extra_attrs): (source)

Undocumented

def _parse_bdd_detection(d, frame_size, extra_attrs): (source)

Undocumented

def _parse_bdd_polylines(d, frame_size, extra_attrs): (source)

Undocumented

def _parse_frame_labels(attrs_dict): (source)

Undocumented

def _polyline_to_bdd(polyline, frame_size, extra_attrs): (source)

Undocumented

def _raise_bdd100k_error(msg): (source)

Undocumented