Interpolater

Interpolate tracks based on propagation module.

class byotrack.implementation.refiner.interpolater.ForwardBackwardInterpolater(method: str | Callable[[...], Tensor] = 'constant', full=False, **kwargs)

Bases: Refiner

Interpolate tracks to fill out NaN values by averaging a forward estimation and a backward estimation.

We propose two modes for position propagation: constant and tps. Constant estimation propagates the last known position, whereas tps uses active tracks knowledge to estimate the elastic motion.

Forward and backward propagation are smoothly merged together in a weighted average. See propagation module

method

Method for directed propagation (“constant”, “tps” or your own callable) Default: “constant”

Type:

str | Callable[…, torch.Tensor]

full

Interpolate track on all frames or only on the track range Default: False (Will not extend partial tracks, but only fill out NaN values inside of them)

Type:

bool

\*\*kwargs

Additional arguments given to the method (For instance, alpha for tps)

run(video: Iterable[ndarray], tracks: Collection[Track]) List[Track]

Run the refiner on a whole video

Parameters:
  • video (Iterable[np.ndarray]) – Sequence of frames (video) Each array is expected to have a shape (H, W, C)

  • tracks (Collection[byotrack.Track]) – Tracks of particles

Returns:

Refined tracks of particles

Return type:

Collection[byotrack.Track]