Combine#
- class deeptrack.features.Combine(features: list[Feature], **kwargs: Any)#
Bases:
StructuralFeatureCombine multiple features into a single feature.
This feature applies a list of features to the same input and returns their outputs as a list. It is useful for computing multiple parallel outputs from the same data (e.g., branches in a feature graph).
Parameters#
- features: list[Feature]
A list of features to combine. Each feature will be applied in order, and their outputs collected into a list.
- **kwargs: Any
Additional keyword arguments passed to the parent StructuralFeature class.
Methods#
- get(inputs, **kwargs) -> list[Any]
Resolves each feature in the features list on the inputs and returns their results as a list.
Examples#
>>> import deeptrack as dt
Define a list of features:
>>> add_1 = dt.Add(b=1) >>> add_2 = dt.Add(b=2) >>> add_3 = dt.Add(b=3)
Combine the features:
>>> combined_feature = dt.Combine([add_1, add_2, add_3])
Define an input image:
>>> import numpy as np >>> >>> input_image = np.zeros((2, 3))
Apply the combined feature:
>>> output_list = combined_feature(input_image) >>> output_list [array([[1., 1., 1.], [1., 1., 1.]]), array([[2., 2., 2.], [2., 2., 2.]]), array([[3., 3., 3.], [3., 3., 3.]])]
Methods Summary
get(inputs, **kwargs)Resolve each feature in the features list on the inputs.
Methods Documentation
- get(inputs: Any, **kwargs: Any) list[Any]#
Resolve each feature in the features list on the inputs.
Parameters#
- image: Any
The input or list of inputs to process.
- **kwargs: Any
Additional arguments passed to each feature’s resolve method.
Returns#
- list[Any]
A list containing the outputs of each feature applied to the input.