detectionmetrics.datasets package

Submodules

detectionmetrics.datasets.dataset module

class detectionmetrics.datasets.dataset.ImageSegmentationDataset(dataset: DataFrame, dataset_dir: str, ontology: dict)

Bases: SegmentationDataset

Parent image segmentation dataset class

Parameters:
  • dataset (pd.DataFrame) – Image segmentation dataset as a pandas DataFrame

  • dataset_dir (str) – Dataset root directory

  • ontology (dict) – Dataset ontology definition

export(outdir: str)

Export dataset dataframe and image files

Parameters:

outdir (str) – Directory where Parquet and image files will be stored

make_fname_global()

Get all relative filenames in dataset and make global

class detectionmetrics.datasets.dataset.LiDARSegmentationDataset(dataset: DataFrame, dataset_dir: str, ontology: dict, is_kitti_format: bool = True)

Bases: SegmentationDataset

Parent lidar segmentation dataset class

Parameters:
  • dataset (pd.DataFrame) – LiDAR segmentation dataset as a pandas DataFrame

  • dataset_dir (str) – Dataset root directory

  • ontology (dict) – Dataset ontology definition

  • is_kitti_format (bool, optional) – Whether the linked files in the dataset are stored in SemanticKITTI format or not, defaults to True

export(outdir: str)

Export dataset dataframe and LiDAR files in SemanticKITTI format

Parameters:

outdir (str) – Directory where Parquet and LiDAR files will be stored

make_fname_global()

Get all relative filenames in dataset and make global

static read_label(fname: str) Tuple[ndarray, ndarray]

Read labels from a binary file in SemanticKITTI format

Parameters:

fname (str) – Binary file containing labels

Returns:

Numpy arrays containing semantic and instance labels

Return type:

Tuple[np.ndarray, np.ndarray]

static read_points(fname: str) ndarray

Read points from a binary file in SemanticKITTI format

Parameters:

fname (str) – Binary file containing points

Returns:

Numpy array containing points

Return type:

np.ndarray

class detectionmetrics.datasets.dataset.SegmentationDataset(dataset: DataFrame, dataset_dir: str, ontology: dict)

Bases: ABC

Abstract segmentation dataset class

Parameters:
  • dataset (pd.DataFrame) – Segmentation dataset as a pandas DataFrame

  • dataset_dir (str) – Dataset root directory

  • ontology (dict) – Dataset ontology definition

append(new_dataset: Self)

Append another dataset with common ontology

Parameters:

new_dataset (Self) – Dataset to be appended

abstract make_fname_global()

Get all relative filenames in dataset and make global

detectionmetrics.datasets.gaia module

class detectionmetrics.datasets.gaia.GaiaImageSegmentationDataset(dataset_fname: str)

Bases: ImageSegmentationDataset

Specific class for GAIA-styled image segmentation datasets

Parameters:

dataset_fname (str) – Parquet dataset filename

class detectionmetrics.datasets.gaia.GaiaLiDARSegmentationDataset(dataset_fname: str)

Bases: LiDARSegmentationDataset

Specific class for GAIA-styled LiDAR segmentation datasets

Parameters:

dataset_fname (str) – Parquet dataset filename

detectionmetrics.datasets.gaia.build_dataset(dataset_fname: str) Tuple[DataFrame, str, dict]

Build dataset and ontology dictionaries from GAIA-like dataset structure

Parameters:

dataset_fname (str) – Parquet dataset filename

Returns:

Dataset dataframe and directory, and onotology

Return type:

Tuple[pd.DataFrame, str, dict]

detectionmetrics.datasets.goose module

class detectionmetrics.datasets.goose.GOOSEImageSegmentationDataset(train_dataset_dir: str | None = None, val_dataset_dir: str | None = None, test_dataset_dir: str | None = None)

Bases: ImageSegmentationDataset

Specific class for GOOSE-styled image segmentation datasets. All data can be downloaded from the official webpage (https://goose-dataset.de): train -> https://goose-dataset.de/storage/goose_2d_train.zip val -> https://goose-dataset.de/storage/goose_2d_val.zip test -> https://goose-dataset.de/storage/goose_2d_test.zip

Parameters:
  • train_dataset_dir (str) – Directory containing training data

  • val_dataset_dir (str, optional) – Directory containing validation data, defaults to None

  • test_dataset_dir (str, optional) – Directory containing test data, defaults to None

class detectionmetrics.datasets.goose.GOOSELiDARSegmentationDataset(train_dataset_dir: str | None = None, val_dataset_dir: str | None = None, test_dataset_dir: str | None = None)

Bases: LiDARSegmentationDataset

Specific class for GOOSE-styled LiDAR segmentation datasets. All data can be downloaded from the official webpage (https://goose-dataset.de): train -> https://goose-dataset.de/storage/goose_3d_train.zip val -> https://goose-dataset.de/storage/goose_3d_val.zip test -> https://goose-dataset.de/storage/goose_3d_test.zip

Parameters:
  • train_dataset_dir (str) – Directory containing training data

  • val_dataset_dir (str, optional) – Directory containing validation data, defaults to None

  • test_dataset_dir (str, optional) – Directory containing test data, defaults to None

detectionmetrics.datasets.goose.build_dataset(data_type: str, data_suffix: str, label_suffix: str, train_dataset_dir: str | None = None, val_dataset_dir: str | None = None, test_dataset_dir: str | None = None) Tuple[dict, dict]

Build dataset and ontology dictionaries from GOOSE dataset structure

Parameters:
  • train_dataset_dir (str) – Directory containing training data

  • data_type (str) – Data to be read (e.g. images or lidar)

  • data_suffix (str) – File suffix to be used to filter data (e.g., windshield_vis.png or vls128.bin)

  • label_suffix (str) – File suffix to be used to filter labels (e.g., vis_labelids.png or goose.label)

  • val_dataset_dir (str, optional) – Directory containing validation data, defaults to None

  • test_dataset_dir (str, optional) – Directory containing test data, defaults to None

Returns:

Dataset and onotology

Return type:

Tuple[dict, dict]

detectionmetrics.datasets.rellis3d module

class detectionmetrics.datasets.rellis3d.Rellis3DImageSegmentationDataset(dataset_dir: str, split_dir: str, ontology_fname: str)

Bases: ImageSegmentationDataset

Specific class for Rellis3D-styled image segmentation datasets. All data can be downloaded from the official repo (https://github.com/unmannedlab/RELLIS-3D): images -> https://drive.google.com/file/d/1F3Leu0H_m6aPVpZITragfreO_SGtL2yV labels -> https://drive.google.com/file/d/16URBUQn_VOGvUqfms-0I8HHKMtjPHsu5 split -> https://drive.google.com/file/d/1zHmnVaItcYJAWat3Yti1W_5Nfux194WQ ontology -> https://drive.google.com/file/d/1K8Zf0ju_xI5lnx3NTDLJpVTs59wmGPI6

Parameters:
  • dataset_dir (str) – Directory where both RGB images and annotations have been extracted to

  • split_dir (str) – Directory where train, val, and test files (.lst) have been extracted to

  • ontology_fname (str) – YAML file contained in the ontology compressed directory

class detectionmetrics.datasets.rellis3d.Rellis3DLiDARSegmentationDataset(dataset_dir: str, split_dir: str, ontology_fname: str)

Bases: LiDARSegmentationDataset

Specific class for Rellis3D-styled LiDAR segmentation datasets. All data can be downloaded from the official repo (https://github.com/unmannedlab/RELLIS-3D): points -> https://drive.google.com/file/d/1lDSVRf_kZrD0zHHMsKJ0V1GN9QATR4wH labels -> https://drive.google.com/file/d/12bsblHXtob60KrjV7lGXUQTdC5PhV8Er split -> https://drive.google.com/file/d/1raQJPySyqDaHpc53KPnJVl3Bln6HlcVS ontology -> https://drive.google.com/file/d/1K8Zf0ju_xI5lnx3NTDLJpVTs59wmGPI6

Parameters:
  • dataset_dir (str) – Directory where both points and labels have been extracted to

  • split_dir (str) – Directory where train, val, and test files (.lst) have been extracted to

  • ontology_fname (str) – YAML file contained in the ontology compressed directory

detectionmetrics.datasets.rellis3d.build_dataset(dataset_dir: str, split_fnames: dict, ontology_fname: str) Tuple[dict, dict]

Build dataset and ontology dictionaries from Rellis3D dataset structure

Parameters:
  • dataset_dir (str) – Directory where both RGB images and annotations have been extracted to

  • split_fnames – Dictionary that contains the paths where train, val, and test split files (.lst) have been extracted to

  • ontology_fname (str) – YAML file contained in the ontology compressed directory

Returns:

Dataset and onotology

Return type:

Tuple[dict, dict]

Module contents