MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / prob2class

Function prob2class

monai/utils/misc.py:708–716  ·  view source on GitHub ↗

Compute the lab from the probability of predicted feature maps Args: sigmoid: If the sigmoid function should be used. threshold: threshold value to activate the sigmoid function.

(x: torch.Tensor, sigmoid: bool = False, threshold: float = 0.5, **kwargs: Any)

Source from the content-addressed store, hash-verified

706
707
708def prob2class(x: torch.Tensor, sigmoid: bool = False, threshold: float = 0.5, **kwargs: Any) -> torch.Tensor:
709 """
710 Compute the lab from the probability of predicted feature maps
711
712 Args:
713 sigmoid: If the sigmoid function should be used.
714 threshold: threshold value to activate the sigmoid function.
715 """
716 return torch.argmax(x, **kwargs) if not sigmoid else (x > threshold).int()
717
718
719def path_to_uri(path: PathLike) -> str:

Callers 1

ensemble_predMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…