dice
Dice
¶
Bases: TensorOp
Calculate Element-Wise Dice Score.
Args:
inputs: A tuple or list of keys representing prediction and ground truth, like: ("y_pred", "y_true").
outputs: The key under which to save the output.
mode: What mode(s) to execute this Op in. For example, "train", "eval", "test", or "infer". To execute
regardless of mode, pass None. To execute in all modes except for a particular one, you can pass an argument
like "!infer" or "!train".
ds_id: What dataset id(s) to execute this Op in. To execute regardless of ds_id, pass None. To execute in all
ds_ids except for a particular one, you can pass an argument like "!ds1".
soft_dice: Whether to square elements. If True, square of elements is added.
sample_average: Whether to average the element-wise dice score.
channel_average: Whether to average the channel wise dice score.
negate: Whether to negate dice score.
epsilon: A small value to prevent numeric instability in the division.
Returns:
The dice loss between `y_pred` and `y_true`. A scalar if `average_sample` is True, else a
tensor with the shape (Batch).
Raises:
AssertionError: If `y_true` or `y_pred` are unacceptable data types.