meddlr.ops.pred_to_categorical#

meddlr.ops.pred_to_categorical(pred_or_logits, activation, channel_dim: int = 1, threshold: float = 0.5)[source]#

Converts one-hot encoded predictions or logits to category.

Parameters
  • pred_or_logits – One-hot encoded predictions or logits. Shape BxCx…

  • activation (str) – Activation to use. Either 'sigmoid' or 'softmax' if pred_or_logits are logits. If None or ‘’, assumes that pred does not need to be passed through activation function. If ‘softmax’, should include a background class.

  • include_background (bool) – If True, the first slice of class dimension (C) will not be dropped.