CamVid#

class torch_uncertainty.datasets.segmentation.CamVid(root, group_classes=True, split=None, transforms=None, download=False)[source]#

CamVid Dataset.

Parameters:
  • root (str | Path) – Root directory of dataset where camvid/ exists or will be saved to if download is set to True.

  • group_classes (bool, optional) – Whether to group the 32 classes into 11 superclasses. Defaults to True.

  • split (str, optional) – The dataset split, supports train, val and test. Defaults to None.

  • transforms (callable, optional) – A function/transform that takes input sample and its target as entry and returns a transformed version. Defaults to None.

  • download (bool, optional) – If True, downloads the dataset from the internet and puts it in root directory. If dataset is already downloaded, it is not downloaded again. Defaults to False.

property color_palette#

Return the color palette of the dataset.

decode_target(target)[source]#

Decode target tensor to image.

Parameters:

target (torch.Tensor) – Target tensor.

Returns:

Decoded target as a PIL.Image.

Return type:

Image.Image

download()[source]#

Download the CamVid data if it doesn’t exist already.

encode_target(target)[source]#

Encode target image to tensor.

Parameters:

target (Image.Image) – Target PIL image.

Returns:

Encoded target.

Return type:

torch.Tensor