kd.summaries.ShowDifferenceImages

kd.summaries.ShowDifferenceImages#

class kauldron.summaries.ShowDifferenceImages(*, images1: typing.Annotated[typing.Any, <object object at 0x76412092fb90>], images2: typing.Annotated[typing.Any, <object object at 0x76412092fb90>], num_images: int, vrange: tuple[float, float] | None = None, cmap: str = 'gray', rearrange: str | None = None, rearrange_kwargs: typing.Mapping[str, typing.Any] | None = None)[source]

Bases: kauldron.metrics.base.Metric

Show a set of difference images with optional reshaping.

images1

Key to the first set of images (from which images2 is subtracted).

Type:

Any

images2

Key to the second set of images (subtracted from images1).

Type:

Any

num_images

Number of images to collect and display. Default 5.

Type:

int

vrange

Optional value range of the input images. Used to clip and then rescale the images to [0, 1].

Type:

tuple[float, float] | None

cmap

A pyplot color map name, to map from 1D value to 3D color.

Type:

str

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

images1: Annotated[Any, <object object at 0x76412092fb90>]
images2: Annotated[Any, <object object at 0x76412092fb90>]
num_images: int
vrange: tuple[float, float] | None = None
cmap: str = 'gray'
rearrange: str | None = None
rearrange_kwargs: Mapping[str, Any] | None = None
class State(
diff_images: Float['n h w 1'],
*,
parent: _MetricT = _EMPTY_TYPE.EMPTY,
)[source]

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

Collects the first num_images images.

diff_images: Float['n h w 1']
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(
images1: jaxtyping.Float[Array, '...'] | jaxtyping.Float[ndarray, '...'],
images2: jaxtyping.Float[Array, '...'] | jaxtyping.Float[ndarray, '...'],
) kauldron.summaries.images.ShowDifferenceImages.State[source]
empty() kauldron.metrics.base.Metric.State[source]