Skip to content

Commit 013297d

Browse files
author
Jack Valmadre
committed
Add option to fail if preproc is ambiguous
1 parent 50954fe commit 013297d

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

trackeval/datasets/mot_challenge_2d_box.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def get_default_dataset_config():
4141
'MIN_VIS': -1.0, # Set to non-negative number to filter ground-truth by visibility.
4242
'DROP_EXTRA_TIMESTEPS': False, # Silently ignore extra timesteps.
4343
'DROP_OTHER_CLASSES': False, # Silently ignore predictions for other classes.
44+
'PREPROC_REQUIRE_UNIQUE': False, # Raise exception for identical boxes during preprocessing.
4445
}
4546
return default_config
4647

@@ -401,6 +402,20 @@ def get_preprocessed_seq_data(self, raw_data, cls):
401402
~(gt_vis[match_rows] >= self.config['MIN_VIS']))
402403
to_remove_tracker = match_cols[remove_mask]
403404

405+
if self.config['PREPROC_REQUIRE_UNIQUE']:
406+
# Check whether predictions to be removed were non-unique.
407+
identical_rows, identical_cols = np.where(np.any(
408+
((matching_scores[:, :, np.newaxis] == matching_scores[:, np.newaxis, :]) &
409+
np.logical_not(np.eye(matching_scores.shape[1], dtype=np.bool)) &
410+
(matching_scores[:, :, np.newaxis] != 0)),
411+
axis=-1))
412+
if np.size(identical_rows): # np.any(np.in1d(to_remove_tracker, identical_cols))
413+
raise TrackEvalException(
414+
'Multiple predicted tracks with identical similarity to ground-truth. '
415+
'Preprocessing cannot determine which to keep. '
416+
'The following pairs were indistinguishable in timestep ' + str(t) + ': ' +
417+
' '.join(map(str, zip(gt_ids[identical_rows], tracker_ids[identical_cols]))))
418+
404419
# Apply preprocessing to remove all unwanted tracker dets.
405420
data['tracker_ids'][t] = np.delete(tracker_ids, to_remove_tracker, axis=0)
406421
data['tracker_dets'][t] = np.delete(tracker_dets, to_remove_tracker, axis=0)

0 commit comments

Comments
 (0)