Skip to content

module api.transforms.semseg


function LoadAnnotation

LoadAnnotation(
    seg_path,
    prefix=None,
    label_map=None,
    reduce_zero_label=False,
    imdecode_backend='pillow',
    file_client: FileClient = <ice.llutil.file_client.FileClient object at 0x7ff1eccdb850>
)

Load annotations for semantic segmentation.

Args:

- reduce_zero_label (bool): Whether reduce all label value by 1.

Usually used for datasets where 0 is background label. Default: False.

- imdecode_backend (str): Backend for `mmcv.imdecode`. Default: 'pillow'

- file_client : See [mmcv.fileio.FileClient](https://mmcv.readthedocs.io/en/latest/api.html#mmcv.fileio.FileClient) for details.

References:

- [mmseg.datasets.pipelines.LoadAnnotations](https://mmsegmentation.readthedocs.io/en/latest/api.html#mmseg.datasets.pipelines.LoadAnnotations)

function RandomCrop

RandomCrop(
    img=None,
    seg=None,
    dst_h: int,
    dst_w: int,
    cat_max_ratio=1.0,
    ignore_index=255,
    rng=Generator(PCG64) at 0x7FF1ECC47580
)

Crop a pair of images and segmentation labels such that the class is relatively balanced for training.


function LabelToTensor

LabelToTensor(src: ndarray)

Convert to tensor (as int64).

Args:

  • src (np.ndarray): (H, W)-shaped integer map.

Returns:

a torch.Tensor