vista.algorithms.trackers.simple_tracker.run_simple_tracker

vista.algorithms.trackers.simple_tracker.run_simple_tracker(detectors, config)[source]

Run simple nearest-neighbor tracker with adaptive parameters.

This tracker automatically adapts to the data and requires minimal configuration. It uses Hungarian algorithm for detection-to-track association and automatically computes search radius and maximum track age if not provided.

Parameters:
  • detectors (list of Detector) – List of Detector objects to use as input. Each detector should have frames, columns, and rows attributes containing detection data.

  • config (dict) –

    Dictionary containing tracker configuration with the following keys:

    • tracker_namestr, optional

      Name for the resulting tracker. Default is ‘Simple Tracker’.

    • max_search_radiusfloat, optional

      Maximum distance to search for associations. If not provided, automatically computed from detection nearest-neighbor statistics.

    • min_track_lengthint, optional

      Minimum number of detections for a valid track. Default is 5.

    • max_ageint, optional

      Maximum frames a track can go without detection before deletion. If not provided, automatically computed based on frame gaps.

Returns:

List of track data dictionaries, each containing:

  • ’frames’ndarray

    Array of frame numbers where track appears.

  • ’rows’ndarray

    Array of row (y) coordinates for each frame.

  • ’columns’ndarray

    Array of column (x) coordinates for each frame.

Return type:

list of dict

Notes

The tracker performs the following steps:

  1. Collects all detections organized by frame

  2. Auto-computes max_search_radius using 90th percentile of nearest-neighbor distances if not provided

  3. Auto-computes max_age based on average frame gaps if not provided

  4. Associates detections to tracks using Hungarian algorithm

  5. Creates new tracks from unassociated detections

  6. Marks missed detections for tracks without associations

  7. Deletes tracks that exceed max_age or have poor quality scores

  8. Returns tracks that meet minimum length requirement

Examples

>>> config = {
...     'tracker_name': 'My Tracker',
...     'min_track_length': 5,
...     'max_search_radius': 10.0
... }
>>> tracks = run_simple_tracker(detectors, config)
>>> print(f"Found {len(tracks)} tracks")