-
Notifications
You must be signed in to change notification settings - Fork 14
/
evaluator.py
36 lines (31 loc) · 1.4 KB
/
evaluator.py
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
from pathlib import Path
import trackeval
from .config import Evaluator
def evaluate(
tracker_name: str, data_path: Path, output_path: Path, eval_conf: Evaluator
):
eval_config = trackeval.Evaluator.get_default_eval_config()
eval_config['DISPLAY_LESS_PROGRESS'] = False
eval_config['PLOT_CURVES'] = True
if eval_conf.num_cores > 1:
eval_config['USE_PARALLEL'] = True
eval_config['NUM_PARALLEL_CORES'] = eval_conf.num_cores
eval_config['LOG_ON_ERROR'] = './eval_error_log.txt'
evaluator = trackeval.Evaluator(eval_config)
dataset_config = trackeval.datasets.MotChallenge2DBox.get_default_dataset_config()
dataset_config['GT_FOLDER'] = str(data_path)
dataset_config['SKIP_SPLIT_FOL'] = True
dataset_config['SEQ_INFO'] = {
sub.name: None for sub in data_path.iterdir() if sub.is_dir()
}
dataset_config['TRACKERS_FOLDER'] = str(output_path)
dataset_config['TRACKERS_TO_EVAL'] = [tracker_name]
dataset_list = [trackeval.datasets.MotChallenge2DBox(dataset_config)]
metrics_list = [
# trackeval.metrics.HOTA(),
# Similarity score threshold required for a TP match. Default 0.5.
trackeval.metrics.CLEAR(config={'THRESHOLD': 0.5}),
# Similarity score threshold required for a IDTP match. Default 0.5.
trackeval.metrics.Identity(config={'THRESHOLD': 0.5}),
]
evaluator.evaluate(dataset_list, metrics_list)