Reducer#

class deeptrack.statistics.Reducer(function: Callable, feature: Feature | None = None, distributed: bool = True, **kwargs: Any)#

Bases: Feature

Base class that reduce input dimensionality with a statistical function.

Parameters#

function: Callable

The function used to reduce the input.

feature: Feature, optional

If not None, the output of this feature is used as the input.

distributed: bool

Whether to apply the reducer to each image in the input list individually.

axis: int or tuple of int

The axis / axes to reduce over.

keepdims: bool

Whether to keep the singleton dimensions after reducing or squeezing them.

**kwargs

Additional keyword arguments passed to the parent class and the function.

Notes#

  • The distributed keyword is passed to the parent class to determine

    how to handle the input list of images. If distributed is True, the reducer will be applied to each image in the list individually. If False, the reducer will be applied to the entire list as a single array.

Methods Summary

get(image, axis[, keepdims])

Apply the reduction function to the input image.

Methods Documentation

get(image: ndarray | Tensor | list | tuple, axis: int | None, keepdims: bool | None = None, **kwargs: Any)#

Apply the reduction function to the input image.

Parameters#

image: array-like or list/tuple of array-like

The input image or list/tuple of images to reduce.

axis: int or None

The axis or axes along which the reduction is performed. If None, the reduction is performed over all axes.

keepdims: bool or None

Whether to keep the singleton dimensions after reducing or squeezing them. If None, the default behavior of the reduction function is used.

**kwargs

Additional keyword arguments passed to the parent class and the reduction function.

Returns#

array-like

The reduced image after applying the reduction function.