Shortcuts

Cityscapes

class torch_uncertainty.datasets.segmentation.Cityscapes(root, split='train', mode='fine', target_type='instance', transform=None, target_transform=None, transforms=None)[source]
property color_palette

Return the color palette of the dataset.

decode_target(target)[source]

Decode target tensor to RGB tensor.

Parameters:

target (torch.Tensor) – Target RGB tensor.

Returns:

Decoded target.

Return type:

Image.Image

classmethod encode_target(target)[source]

Encode target image to tensor.

Parameters:

target (Image.Image) – Target PIL image.

Returns:

Encoded target.

Return type:

torch.Tensor

plot_sample(index, ax=None)[source]

Plot a sample from the dataset.

Parameters:
  • index – The index of the sample to plot.

  • ax – Optional matplotlib axis to plot on.

Returns:

The axis on which the sample was plotted.