Reuse#

class deeptrack.augmentations.Reuse(feature, uses=2, storage=1, **kwargs)#

Bases: Feature

Acts like cache.

Reuse stores the output of a feature and reuses it for subsequent calls, even if it is updated. This is can be used after a time-consuming feature to augment the output of the feature without recalculating it. For example:

pipeline = dt.Reuse(pipeline, uses=2) >> dt.FlipLR()

Here, the output of pipeline is used twice, augmented randomly by FlipLR.

Parameters#

featureFeature

The feature to reuse.

usesint

Number of each stored image uses before evaluating feature. Note that the actual total number of uses is uses * storage. Should be constant.

storageint

Number of instances of the output of feature to cache. Should be constant.

Methods Summary

get(image, uses, storage, **kwargs)

Transform an image [abstract method].

Methods Documentation

get(image, uses, storage, **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‘Image’ or List[‘Image’]

The Image or list of images to transform.

**kwargsDict[str, Any]

The current value of all properties in properties as well as any global arguments.

Returns#

‘Image’ or List[‘Image’]

The transformed image or list of images.

Raises#

NotImplementedError

Must be overridden by subclasses.