pub fn decode_semantic(
input: &TensorDyn,
config: &SemanticConfig,
dst: &mut TensorDyn,
confidence: Option<&mut TensorDyn>,
options: &SemanticOptions,
) -> DecoderResult<()>Expand description
Decodes a semantic output into dst, an [H, W] class map of dtype
u8 (up to 256 classes) or u16 (up to 65 536).
confidence, when given, receives the winning class’s probability as an
[H, W] map of f32 in [0, 1] or u8 scaled to 255. It is computed at
the score map’s resolution and upsampled, so it is approximate and meant
for overlays. Class-map inputs have no confidence.
§Errors
DecoderError::InvalidShapeifinputdoes not have the configured shape, ordstandconfidenceare not matching[H, W]tensors.DecoderError::NotSupportedfor unsupported dtypes, or when the class count exceeds what the dtype ofdstholds.DecoderError::InvalidConfigfor an invalid letterbox or quantization, or a class-map valuedstcannot hold.DecoderError::TensorcarryingCpuAccessDeniedwheninputis not declared CPU-readable, ordstorconfidencenot CPU-writable.