LeapImageMask

code_loader.contract.visualizer_classes.LeapImageMask

import numpy.typing as npt
from code_loader.contract.enums import LeapDataType

@dataclass
class LeapImageMask:
    mask: npt.NDArray[np.float32]
    image: npt.NDArray[np.float32]
    labels: List[str]
    type: LeapDataType = LeapDataType.ImageMask

Examples

Basic Usage

import numpy as np
from code_loader.contract.visualizer_classes import LeapImageMask
from code_loader import leap_binder
...

def segmentation_visualizer(image: np.ndarray, segmentation_prediction: np.ndarray) -> LeapHLeapImageMaskorizontalBar:
    labels = ['background', 'vehicle', 'tree', 'road', 'pavement']
    return LeapImageMask(mask=segmentation_prediction, image=image, labels=labels)
    
leap_binder.set_visualizer(
    name='segmentation',
    function=segmentation_visualizer,
    visualizer_type=LeapImageMask.type
)

Last updated