super_gradients.training.datasets.segmentation_datasets package

Submodules

super_gradients.training.datasets.segmentation_datasets.cityscape_segmentation module

class super_gradients.training.datasets.segmentation_datasets.cityscape_segmentation.CityscapesDataset(root_dir: str, list_file: str, labels_csv_path: str, **kwargs)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

CityscapesDataset - Segmentation Data Set Class for Cityscapes Segmentation Data Set, main resolution of dataset: (2048 x 1024). Not all the original labels are used for training and evaluation, according to cityscape paper: “Classes that are too rare are excluded from our benchmark, leaving 19 classes for evaluation”. For more details about the dataset labels format see: https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/helpers/labels.py

target_loader(label_path: str)<module ‘PIL.Image’ from ‘/home/avi/git/super-gradients/venv/lib/python3.9/site-packages/PIL/Image.py’>[source]
Override target_loader function, load the labels mask image.
param label_path

Path to the label image.

return

The mask image created from the array, with converted class labels.

get_train_ids_color_palette()[source]
static target_transform(target)[source]

target_transform - Transforms the sample image This function overrides the original function from SegmentationDataSet and changes target pixels with value 255 to value = CITYSCAPES_IGNORE_LABEL. This was done since current IoU metric from torchmetrics does not support such a high ignore label value (crashed on OOM)

param target

The target mask to transform

return

The transformed target mask

super_gradients.training.datasets.segmentation_datasets.coco_segmentation module

exception super_gradients.training.datasets.segmentation_datasets.coco_segmentation.EmptyCoCoClassesSelectionException[source]

Bases: Exception

class super_gradients.training.datasets.segmentation_datasets.coco_segmentation.CoCoSegmentationDataSet(dataset_classes_inclusion_tuples_list: Optional[list] = None, *args, **kwargs)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

CoCoSegmentationDataSet - Segmentation Data Set Class for COCO 2017 Segmentation Data Set

target_loader(mask_metadata_tuple)<module ‘PIL.Image’ from ‘/home/avi/git/super-gradients/venv/lib/python3.9/site-packages/PIL/Image.py’>[source]
Parameters

mask_metadata_tuple – A tuple of (coco_image_id, original_image_height, original_image_width)

Returns

The mask image created from the array

super_gradients.training.datasets.segmentation_datasets.pascal_aug_segmentation module

class super_gradients.training.datasets.segmentation_datasets.pascal_aug_segmentation.PascalAUG2012SegmentationDataSet(*args, **kwargs)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

PascalAUG2012SegmentationDataSet - Segmentation Data Set Class for Pascal AUG 2012 Data Set

static target_loader(target_path: str)<module ‘PIL.Image’ from ‘/home/avi/git/super-gradients/venv/lib/python3.9/site-packages/PIL/Image.py’>[source]
Parameters

target_path – The path to the target data

Returns

The loaded target

super_gradients.training.datasets.segmentation_datasets.pascal_voc_segmentation module

class super_gradients.training.datasets.segmentation_datasets.pascal_voc_segmentation.PascalVOC2012SegmentationDataSet(sample_suffix=None, target_suffix=None, *args, **kwargs)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

PascalVOC2012SegmentationDataSet - Segmentation Data Set Class for Pascal VOC 2012 Data Set

decode_segmentation_mask(label_mask: numpy.ndarray)[source]
decode_segmentation_mask - Decodes the colors for the Segmentation Mask
param

label_mask: an (M,N) array of integer values denoting the class label at each spatial location.

Returns

super_gradients.training.datasets.segmentation_datasets.segmentation_dataset module

class super_gradients.training.datasets.segmentation_datasets.segmentation_dataset.SegmentationDataSet(root: str, list_file: str = None, samples_sub_directory: str = None, targets_sub_directory: str = None, img_size: int = 608, crop_size: int = 512, batch_size: int = 16, augment: bool = False, dataset_hyper_params: dict = None, cache_labels: bool = False, cache_images: bool = False, sample_loader: Callable = None, target_loader: Callable = None, collate_fn: Callable = None, target_extension: str = '.png', image_mask_transforms: torchvision.transforms.transforms.Compose = None, image_mask_transforms_aug: torchvision.transforms.transforms.Compose = None)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

static sample_loader(sample_path: str)<module ‘PIL.Image’ from ‘/home/avi/git/super-gradients/venv/lib/python3.9/site-packages/PIL/Image.py’>[source]
sample_loader - Loads a dataset image from path using PIL
param sample_path

The path to the sample image

return

The loaded Image

static sample_transform(image)[source]

sample_transform - Transforms the sample image

param image

The input image to transform

return

The transformed image

static target_loader(target_path: str)<module ‘PIL.Image’ from ‘/home/avi/git/super-gradients/venv/lib/python3.9/site-packages/PIL/Image.py’>[source]
Parameters

target_path – The path to the sample image

Returns

The loaded Image

static target_transform(target)[source]

target_transform - Transforms the sample image

param target

The target mask to transform

return

The transformed target mask

Module contents