data.datasets.segmentation package

Submodules

data.datasets.segmentation.ade20k module

class data.datasets.segmentation.ade20k.ADE20KDataset(opts: Namespace, *args, **kwargs)[source]

Bases: BaseImageSegmentationDataset

Dataset class for the ADE20K dataset

The structure of the dataset should be something like this:

ADEChallengeData2016/annotations/training/.png ADEChallengeData2016/annotations/validation/.png

ADEChallengeData2016/images/training/.jpg ADEChallengeData2016/images/validation/.jpg

Parameters:

opts – Command-line arguments

__init__(opts: Namespace, *args, **kwargs) None[source]
static adjust_mask_value() int[source]

Adjust the mask value by this factor

static color_palette() List[int][source]

Class index to RGB color mapping. The list index corresponds to class id. Note that the color list is flattened.

static class_names() List[str][source]

Class index (index of a list corresponds to class id) to class name

data.datasets.segmentation.base_segmentation module

class data.datasets.segmentation.base_segmentation.BaseImageSegmentationDataset(opts: Namespace, *args, **kwargs)[source]

Bases: BaseImageDataset

Base Dataset class for Image Segmentation datasets. Sub-classes must define ignore_label and background_idx variable.

Parameters:

opts – Command-line arguments

__init__(opts: Namespace, *args, **kwargs) None[source]
classmethod add_arguments(parser: ArgumentParser) ArgumentParser[source]

Add dataset-specific arguments

check_dataset() None[source]
static adjust_mask_value() int[source]

Adjust the mask value by this factor

static color_palette() List[int][source]

Class index to RGB color mapping. The list index corresponds to class id. Note that the color list is flattened.

static class_names() List[str][source]

Class index to name. The list index should correspond to class id

static read_mask_pil(path: str) Image | None[source]

Reads mask image and returns as a PIL image

static convert_mask_to_tensor(mask: Image) Tensor[source]

Convert PIL mask to Tensor

data.datasets.segmentation.coco_segmentation module

class data.datasets.segmentation.coco_segmentation.COCOSegmentationDataset(opts: Namespace, *args, **kwargs)[source]

Bases: BaseImageSegmentationDataset

Dataset class for the COCO dataset that maps classes to PASCAL VOC classes

Parameters:

opts – command-line arguments

__init__(opts: Namespace, *args, **kwargs) None[source]
static class_names() List[str][source]

PASCAL VOC classes names

static coco_to_pascal_mapping() List[int][source]

COCO to PASCAL VOC class mapping

data.datasets.segmentation.pascal_voc module

class data.datasets.segmentation.pascal_voc.PascalVOCDataset(opts: Namespace, *args, **kwargs)[source]

Bases: BaseImageSegmentationDataset

Dataset class for the PASCAL VOC 2012 dataset

The structure of PASCAL VOC dataset should be like this:

pascal_voc/VOCdevkit/VOC2012/Annotations
pascal_voc/VOCdevkit/VOC2012/JPEGImages
pascal_voc/VOCdevkit/VOC2012/SegmentationClass
pascal_voc/VOCdevkit/VOC2012/SegmentationClassAug_Visualization
pascal_voc/VOCdevkit/VOC2012/ImageSets
pascal_voc/VOCdevkit/VOC2012/list
pascal_voc/VOCdevkit/VOC2012/SegmentationClassAug
pascal_voc/VOCdevkit/VOC2012/SegmentationObject
Parameters:

opts – Command-line arguments

__init__(opts: Namespace, *args, **kwargs) None[source]
classmethod add_arguments(parser: ArgumentParser) ArgumentParser[source]

Add dataset-specific arguments

static color_palette() List[int][source]

Class index to RGB color mapping. The list index corresponds to class id. Note that the color list is flattened.

static class_names() List[str][source]

Class index to class name mapping. Class index corresponds to list index

Module contents