Pool#

class deeptrack.math.Pool(pooling_function: Callable, ksize: int | Callable[[...], int] = 3, **kwargs)#

Bases: Feature

Downsamples the image by applying a function to local regions of the image.

This class reduces the resolution of an image by dividing it into non-overlapping blocks of size ksize and applying the specified pooling function to each block.

Parameters#

pooling_function: function

A function that is applied to each local region of the image. DOES NOT NEED TO BE WRAPPED IN A ANOTHER FUNCTION. Must support the axis argument. Examples include np.mean, np.max, np.min, etc.

ksize: int

Size of the pooling kernel.

cval: number

Value to pad edges with if necessary.

func_kwargs: dict

Additional parameters sent to the pooling function.

Methods Summary

get(image, ksize, **kwargs)

Transform an image [abstract method].

Methods Documentation

get(image, ksize, **kwargs)#

Transform an image [abstract method].

Abstract method that defines how the feature transforms the input. The current value of all properties will be passed as keyword arguments.

Parameters#

image: np.ndarray or list of np.ndarray or Image or list of Images

The image or list of images to transform.

**kwargs: dict of str to Any

The current value of all properties in properties, as well as any global arguments passed to the feature.

Returns#

Image or list of Images

The transformed image or list of images.

Raises#

NotImplementedError

Raised if this method is not overridden by subclasses.