kd.summaries.ShowBoxes

kd.summaries.ShowBoxes#

class kauldron.summaries.ShowBoxes(
*,
images: typing.Annotated[typing.Any,
<object object at 0x7824c478ba80>] = '__KEY_REQUIRED__',
boxes: typing.Annotated[typing.Any,
<object object at 0x7824c478ba80>] = '__KEY_REQUIRED__',
boxes_mask: typing.Annotated[typing.Any,
<object object at 0x7824c478ba80>] | None = None,
num_images: int = 5,
num_colors: int = 16,
in_vrange: tuple[float,
float] | None = None,
rearrange: str | None = None,
rearrange_kwargs: typing.Mapping[str,
typing.Any] | None = None,
)[source]

Bases: kauldron.metrics.base.Metric

Show a set of boxes with optional image reshaping.

images

Key to the images to display.

Type:

Any

boxes

Key to the boxes to display as Float[“*b k 4”]. The coordinates of each bounding box in boxes is encoded as [y_min, x_min, y_max, x_max]. The bounding box coordinates are floats in [0.0, 1.0] relative to the width and the height of the underlying image.

Type:

Any

boxes_mask

Optional key to the boxes mask in the form Bool[“*b k 1”]. The mask is used to mask out boxes that should not be displayed.

Type:

Any | None

num_images

Number of images to collect and display. Default 5.

Type:

int

num_colors

Number of different colors to use for the boxes. Default 16.

Type:

int

in_vrange

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

Type:

tuple[float, float] | None

rearrange

Optional einops string to reshape the images AFTER the boxes have been drawn.

Type:

str | None

rearrange_kwargs

Optional keyword arguments for the einops reshape.

Type:

Mapping[str, Any] | None

images: Annotated[Any, <object object at 0x7824c478ba80>] = '__KEY_REQUIRED__'
boxes: Annotated[Any, <object object at 0x7824c478ba80>] = '__KEY_REQUIRED__'
boxes_mask: Annotated[Any, <object object at 0x7824c478ba80>] | None = None
num_images: int = 5
num_colors: int = 16
in_vrange: tuple[float, float] | None = None
rearrange: str | None = None
rearrange_kwargs: Mapping[str, Any] | None = None
class State(
images: Float['n h w #3'],
boxes: Float['n k 4'],
*,
parent: _MetricT = _EMPTY_TYPE.EMPTY,
)[source]

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

Collects the first num_images images and boxes.

images: Float['n h w #3']
boxes: Float['n k 4']
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(
images: jaxtyping.Float[Array, '...'] | jaxtyping.Float[ndarray, '...'],
boxes: jaxtyping.Float[Array, '*b k 4'] | jaxtyping.Float[ndarray, '*b k 4'],
boxes_mask: jaxtyping.Bool[Array, '*b k 1'] | jaxtyping.Bool[ndarray, '*b k 1'] | None = None,
) kauldron.summaries.images.ShowBoxes.State[source]
empty() kauldron.metrics.base.Metric.State[source]