Tracker

class byotrack.api.tracker.PauseableTQDM(*_, **__)

Bases: tqdm_asyncio

Tqdm with a real pause mechanism.

update(n: float | None = 1) bool | None

Manually update the progress bar, useful for streams such as reading files. E.g.: >>> t = tqdm(total=filesize) # Initialise >>> for current_buffer in stream: … … … t.update(len(current_buffer)) >>> t.close() The last line is highly recommended, but possibly not necessary if t.update() will be called in such a way that filesize will be exactly reached and printed.

Parameters:

n (int or float, optional) – Increment to add to the internal counter of iterations [default: 1]. If using float, consider specifying {n:.3f} or similar in bar_format, or specifying unit_scale.

Returns:

out – True if a display() was triggered.

Return type:

bool or None

pause(*, refresh=True)

Pause the TQDM progress bar.

unpause()

Restart the TQDM progress bar.

class byotrack.api.tracker.Tracker

Bases: ABC

Base abstract tracker class.

A tracker can be run on a whole video and produces tracks

abstractmethod run(video: Sequence[np.ndarray] | np.ndarray) Collection[byotrack.Track]

Run the tracker on a whole video.

Parameters:

video (Sequence[np.ndarray] | np.ndarray) – Sequence of T frames (array). Each array is expected to have a shape ([D, ]H, W, C)

Returns:

Tracks of particles

Return type:

Collection[byotrack.Track]

class byotrack.api.tracker.MultiStepTracker(detector: byotrack.Detector, linker: byotrack.Linker, refiners: Iterable[byotrack.Refiner] = ())

Bases: Tracker

Multi step tracker: split the tracking task into Detect / Link / Refine.

detector

Performs the detection on the video

Type:

byotrack.Detector

linker

Links detections through time

Type:

byotrack.Linker

refiners

Optional refinement steps Empty by default

Type:

Sequence[byotrack.Refiner]

run(video: Sequence[np.ndarray] | np.ndarray) Collection[byotrack.Track]

Run the tracker on a whole video.

Parameters:

video (Sequence[np.ndarray] | np.ndarray) – Sequence of T frames (array). Each array is expected to have a shape ([D, ]H, W, C)

Returns:

Tracks of particles

Return type:

Collection[byotrack.Track]

class byotrack.api.tracker.BatchMultiStepTracker(detector: byotrack.BatchDetector, linker: byotrack.OnlineLinker, refiners: Iterable[byotrack.Refiner] = ())

Bases: MultiStepTracker

Online Tracking with detect/link/refine framework.

It only works with BatchDetector and OnlineLinker: it reduces RAM usage and computations by loading frames only by batch. Each batch is processed by the detector followed by the linker. Once a batch is processed, a new one is loaded. The detections are never fully stored, neither the video.

Tracks refining is done offline.

detector

Performs the detection on the video by batch It defines the batch size to use

Type:

byotrack.BatchDetector

linker

Links detections one frame at time

Type:

byotrack.OnlineLinker

refiners

Optional refinement steps Empty by default

Type:

Sequence[byotrack.Refiner]

run(video: Sequence[np.ndarray] | np.ndarray) Collection[byotrack.Track]

Run the tracker on a whole video.

Parameters:

video (Sequence[np.ndarray] | np.ndarray) – Sequence of T frames (array). Each array is expected to have a shape ([D, ]H, W, C)

Returns:

Tracks of particles

Return type:

Collection[byotrack.Track]