-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathtracker_harness.py
More file actions
99 lines (74 loc) · 2.63 KB
/
tracker_harness.py
File metadata and controls
99 lines (74 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# SPDX-FileCopyrightText: (C) 2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Base class for tracker harness implementations."""
from abc import ABC, abstractmethod
from typing import Dict, Any, Iterator, List
from pathlib import Path
class TrackerHarness(ABC):
"""Base class for tracker harness implementations.
A tracker harness executes a tracking system and produces tracker outputs.
It consumes:
- Scene and camera configuration in canonical format
- Input detections or videos in canonical format
- Tracker-specific configuration
It produces:
- Tracker outputs (tracks) in canonical format
"""
@abstractmethod
def set_scene_config(self, config: Dict[str, Any]) -> 'TrackerHarness':
"""Set scene and camera configuration.
Args:
config: Scene configuration in canonical Scene Configuration Format
(see tools/tracker/evaluation/README.md#canonical-data-formats).
Returns:
Self for method chaining.
Raises:
ValueError: If configuration is invalid.
RuntimeError: On other errors.
"""
pass
@abstractmethod
def set_custom_config(self, config: Dict[str, Any]) -> 'TrackerHarness':
"""Set tracker-specific configuration.
Args:
config: Custom configuration dictionary (format depends on implementation).
Returns:
Self for method chaining.
Raises:
ValueError: If configuration is invalid.
RuntimeError: On other errors.
"""
pass
@abstractmethod
def set_output_folder(self, path: Path) -> 'TrackerHarness':
"""Set folder where harness-specific outputs should be stored.
Args:
path: Path to output folder. Will be created if it doesn't exist.
Returns:
Self for method chaining.
Raises:
ValueError: If path is invalid.
RuntimeError: On other errors.
"""
pass
@abstractmethod
def process_inputs(self, inputs: Iterator[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""Process input detections through the tracker synchronously.
This is the default (synchronous) mode. Processes all inputs and returns outputs.
Use this for batch processing, testing, and simple evaluation pipelines.
Args:
inputs: Iterator of detection dictionaries in canonical Input Detection Format
(see tools/tracker/evaluation/README.md#canonical-data-formats).
Returns:
List of tracker outputs in canonical Tracker Output Format.
Raises:
RuntimeError: If processing fails.
"""
pass
@abstractmethod
def reset(self) -> 'TrackerHarness':
"""Reset harness state to initial configuration.
Returns:
Self for method chaining.
"""
pass