Skip to main content

modelpack_segmentation_to_mask

Function modelpack_segmentation_to_mask 

Source
pub fn modelpack_segmentation_to_mask(
    segmentation: ArrayView3<'_, u8>,
) -> Array2<u8>
Expand description

Converts ModelPack segmentation into a 2D mask. The input segmentation is expected to have shape (H, W, num_classes).

The output mask will have shape (H, W), with values 0..num_classes based on the argmax across the channels.

ยงPanics

Panics if the input tensor does not have more than one channel.