Overview
Time tracking utilities for computer vision applications. Provides comprehensive time tracking for object detection workflows including total detection time, zone occupancy duration, and line crossing analysis. Supports both frame-based timing for video processing and real-time clock-based timing for live streams. Provides comprehensive time tracking capabilities including total detection time, zone occupancy duration, and line crossing analysis. Automatically adapts between frame-based timing (for video processing) and real-time clock-based timing (for live streams). The tracker maintains internal state for all tracked objects and provides both simple integration through detection object modification and detailed analytics through comprehensive statistics methods.Class Overview
TheTimeTracker class provides structured data management for timetracker operations.
Parameters
Optional[float]
Frame rate for frame-based timing. If None, uses system clock timing. Frame-based timing provides more accurate results for video processing with consistent frame rates. Range: > 0.0. Default is None (clock-based timing). Attributes:
Optional[float]
Frame rate used for timing calculations.
int
required
Current frame number (frame-based timing only).
bool
required
Whether using system clock (True) or frame-based (False) timing.
Dict[int, Union[datetime, int]]
required
First detection time for each tracker ID.
Dict[tuple, Union[datetime, int]]
required
Zone entry times keyed by (tracker_id, zone_id).
Dict[tuple, Union[datetime, int]]
required
Line crossing times keyed by (tracker_id, line_id, direction).
Examples
Notes
- Detection objects are modified in-place with timing information
- Frame-based timing requires consistent FPS throughout processing
- Zone and line crossing data requires corresponding attributes in detection objects
- Memory usage scales with number of unique tracker IDs over time
- Use cleanup_inactive_trackers() periodically for long-running applications
- O(n) time complexity where n is number of detections per frame
- Memory usage grows with unique tracker count and zone/line complexity
- Frame-based timing is more CPU efficient than datetime calculations