Repeat#

class deeptrack.features.Repeat(feature: Feature, N: int, **kwargs: Dict[str, Any])#

Bases: Feature

Repeats the evaluation of the input feature a certain number of times.

The Repeat feature allows iterative application of another feature, passing the output of each iteration as the input to the next. Each iteration operates with its own set of properties, and the index of the current iteration is available as _ID or replicate_index. This enables dynamic behavior across iterations.

Parameters#

featureFeature

The feature to be repeated.

Nint

The number of times to repeat the feature evaluation.

**kwargsDict[str, Any]

Additional keyword arguments passed to the parent Feature class.

Attributes#

__distributed__bool

Indicates whether this feature distributes computation across inputs. Always False for Repeat, as it processes sequentially.

Example#

Start by creating a pipeline using Repeat:

>>> from deeptrack.features import Add, Repeat
>>> pipeline = Repeat(Add(value=10), N=3)
>>> print(pipeline.resolve([1, 2, 3]))
[31, 32, 33]

Equivalently, this pipeline can be created using:

>>> pipeline = Add(value=10) ^ 3

Methods Summary

get(image, N[, _ID])

Apply sequentially the feature a set number of times.

Methods Documentation

get(image: Any, N: int, _ID: Tuple[int, ...] = (), **kwargs: Dict[str, Any])#

Apply sequentially the feature a set number of times.

Sequentially applies the feature N times, passing the output of each iteration as the input to the next.

Parameters#

imageAny

The input data to be transformed by the repeated feature.

Nint

The number of repetitions.

_IDTuple[int, …], optional

A unique identifier for the current computation, which tracks the iteration index for caching and reproducibility.

**kwargsDict[str, Any]

Additional keyword arguments passed to the feature.

Returns#

Any

The final output after N repetitions of the feature.