Shortcuts

CamVid

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

CamVid Dataset.

Parameters:
  • root (str) – 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. Default: True.

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

  • transforms (callable, optional) – A function/transform that takes input sample and its target as entry and returns a transformed version. Default: 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.

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