kd.summaries.ShowSegmentations

kd.summaries.ShowSegmentations#

class kauldron.summaries.ShowSegmentations(*, segmentations: typing.Annotated[typing.Any, <object object at 0x7824c478ba80>], num_images: int = 5, entropy: bool = False, rearrange: str | None = None, rearrange_kwargs: typing.Mapping[str, typing.Any] | None = None)[source]

Bases: kauldron.metrics.base.Metric

Show a set of segmentations with optional reshaping.

segmentations

Key to the segmentations to display.

Type:

Any

num_images

Number of segmentations to collect and display. Default 5.

Type:

int

entropy

Whether to scale the lightness of the segments in proportion to the (normalized) per-pixel entropy of the soft-segmentation.

Type:

bool

rearrange

Optional einops string to reshape the images.

Type:

str | None

rearrange_kwargs

Optional keyword arguments for the einops reshape.

Type:

Mapping[str, Any] | None

segmentations: Annotated[Any, <object object at 0x7824c478ba80>]
num_images: int = 5
entropy: bool = False
rearrange: str | None = None
rearrange_kwargs: Mapping[str, Any] | None = None
class State(
segmentations: Integer['*b h w 1'] | Float['*b h w k'],
*,
parent: _MetricT = _EMPTY_TYPE.EMPTY,
)[source]

Bases: kauldron.metrics.auto_state.AutoState[ShowSegmentations]

Collects the first num_images segmentations.

segmentations: Integer['*b h w 1'] | Float['*b h w k']
compute() jaxtyping.Float[Array, 'n h w #3'] | jaxtyping.Float[ndarray, 'n h w #3'][source]

Computes final metrics from intermediate values.

merge(
other: kauldron.metrics.auto_state._SelfT,
) kauldron.metrics.auto_state._SelfT[source]

Checks static fields for equality and merges data-fields.

replace(**updates)

Returns a new object replacing the specified fields with new values.

get_state(
segmentations: jaxtyping.Float[Array, '...'] | jaxtyping.Float[ndarray, '...'],
) kauldron.summaries.images.ShowSegmentations.State[source]
empty() kauldron.metrics.base.Metric.State[source]