Skip to content

Commit 764dcdf

Browse files
committed
update the TETA bdd evaluation, including the specific instance filtering which was not support in original TETA implementation
1 parent 672f290 commit 764dcdf

File tree

4 files changed

+31
-37
lines changed

4 files changed

+31
-37
lines changed

Diff for: teta/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# What packages are required for this module to be executed?
1717
REQUIRED = [
1818
'script_utils @ git+https://github.com/achalddave/[email protected]#egg=script_utils',
19-
'numpy==1.21', 'scipy'
19+
'numpy', 'scipy'
2020
]
2121

2222
# What packages are optional?

Diff for: teta/teta/datasets/bdd.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,11 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
296296
for t in range(raw_data["num_timesteps"]):
297297
# only extract relevant dets for this class for preproc and eval
298298
if cls == "all":
299-
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(np.bool)
299+
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(bool)
300300
else:
301301
gt_class_mask = np.atleast_1d(
302302
raw_data["gt_classes"][t] == cls_id
303-
).astype(np.bool)
303+
).astype(bool)
304304

305305
# For unmatched tracker dets, remove those that are greater than 50% within a crowd ignore region.
306306

@@ -353,7 +353,7 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
353353

354354
# add the track ids of exclusive annotated class to exh_class_tk_ids
355355
tk_exh_mask = np.atleast_1d(raw_data["tk_classes"][t] == cls_id)
356-
tk_exh_mask = tk_exh_mask.astype(np.bool)
356+
tk_exh_mask = tk_exh_mask.astype(bool)
357357
exh_class_tk_ids_t = raw_data["tk_ids"][t][tk_exh_mask]
358358
exh_class_tk_ids.append(exh_class_tk_ids_t)
359359
data["tk_exh_ids"][t] = exh_class_tk_ids_t
@@ -365,11 +365,11 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
365365
for t in range(raw_data["num_timesteps"]):
366366
# add gt to the data
367367
if cls == "all":
368-
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(np.bool)
368+
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(bool)
369369
else:
370370
gt_class_mask = np.atleast_1d(
371371
raw_data["gt_classes"][t] == cls_id
372-
).astype(np.bool)
372+
).astype(bool)
373373
data["gt_classes"][t] = cls_id
374374
data["gt_class_name"][t] = cls
375375

@@ -388,7 +388,6 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
388388
assume_unique=True,
389389
)
390390

391-
392391
tk_ids = raw_data["tk_ids"][t][tk_mask]
393392
tk_dets = raw_data["tk_dets"][t][tk_mask]
394393
tracker_classes = raw_data["tk_classes"][t][tk_mask]
@@ -398,7 +397,6 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
398397
# tracker_confidences = raw_data["tk_confidences"][t][tk_mask]
399398
sim_scores_masked = sim_scores[t][gt_class_mask, :][:, tk_mask]
400399

401-
402400
# add filtered prediction to the data
403401
data["tk_classes"][t] = tracker_classes
404402
data["tk_overlap_classes"][t] = tracker_overlap_classes
@@ -426,12 +424,12 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
426424
gt_id_map[unique_gt_ids] = np.arange(len(unique_gt_ids))
427425
data["gt_id_map"] = {}
428426
for gt_id in unique_gt_ids:
429-
new_gt_id = gt_id_map[gt_id].astype(np.int)
427+
new_gt_id = gt_id_map[gt_id].astype(int)
430428
data["gt_id_map"][new_gt_id] = gt_id
431429

432430
for t in range(raw_data["num_timesteps"]):
433431
if len(data["gt_ids"][t]) > 0:
434-
data["gt_ids"][t] = gt_id_map[data["gt_ids"][t]].astype(np.int)
432+
data["gt_ids"][t] = gt_id_map[data["gt_ids"][t]].astype(int)
435433

436434
if len(unique_tk_ids) > 0:
437435
unique_tk_ids = np.unique(unique_tk_ids)
@@ -440,16 +438,16 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
440438

441439
data["tk_id_map"] = {}
442440
for track_id in unique_tk_ids:
443-
new_track_id = tk_id_map[track_id].astype(np.int)
441+
new_track_id = tk_id_map[track_id].astype(int)
444442
data["tk_id_map"][new_track_id] = track_id
445443

446444
for t in range(raw_data["num_timesteps"]):
447445
if len(data["tk_ids"][t]) > 0:
448-
data["tk_ids"][t] = tk_id_map[data["tk_ids"][t]].astype(np.int)
446+
data["tk_ids"][t] = tk_id_map[data["tk_ids"][t]].astype(int)
449447
if len(data["tk_overlap_ids"][t]) > 0:
450448
data["tk_overlap_ids"][t] = tk_id_map[
451449
data["tk_overlap_ids"][t]
452-
].astype(np.int)
450+
].astype(int)
453451

454452
# record overview statistics.
455453
data["num_tk_cls_dets"] = num_tk_cls_dets

Diff for: teta/teta/datasets/bdd_mots.py

+10-14
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,11 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
296296
for t in range(raw_data["num_timesteps"]):
297297
# only extract relevant dets for this class for preproc and eval
298298
if cls == "all":
299-
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(np.bool)
299+
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(bool)
300300
else:
301301
gt_class_mask = np.atleast_1d(
302302
raw_data["gt_classes"][t] == cls_id
303-
).astype(np.bool)
303+
).astype(bool)
304304

305305
# For unmatched tracker dets, remove those that are greater than 50% within a crowd ignore region.
306306

@@ -312,9 +312,7 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
312312
match_rows, match_cols = linear_sum_assignment(-matching_scores)
313313
actually_matched_mask = matching_scores[match_rows, match_cols] > 0 + np.finfo('float').eps
314314
match_cols = match_cols[actually_matched_mask]
315-
316315
unmatched_indices = np.delete(unmatched_indices, match_cols, axis=0)
317-
318316
unmatched_tracker_dets = [raw_data['tk_dets'][t][i] for i in range(len(raw_data['tk_dets'][t])) if i in unmatched_indices]
319317
ignore_region = raw_data['gt_ignore_region'][t]
320318
intersection_with_ignore_region = self._calculate_mask_ious(unmatched_tracker_dets, [ignore_region],
@@ -355,7 +353,7 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
355353

356354
# add the track ids of exclusive annotated class to exh_class_tk_ids
357355
tk_exh_mask = np.atleast_1d(raw_data["tk_classes"][t] == cls_id)
358-
tk_exh_mask = tk_exh_mask.astype(np.bool)
356+
tk_exh_mask = tk_exh_mask.astype(bool)
359357
exh_class_tk_ids_t = raw_data["tk_ids"][t][tk_exh_mask]
360358
exh_class_tk_ids.append(exh_class_tk_ids_t)
361359
data["tk_exh_ids"][t] = exh_class_tk_ids_t
@@ -367,11 +365,11 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
367365
for t in range(raw_data["num_timesteps"]):
368366
# add gt to the data
369367
if cls == "all":
370-
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(np.bool)
368+
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(bool)
371369
else:
372370
gt_class_mask = np.atleast_1d(
373371
raw_data["gt_classes"][t] == cls_id
374-
).astype(np.bool)
372+
).astype(bool)
375373
data["gt_classes"][t] = cls_id
376374
data["gt_class_name"][t] = cls
377375

@@ -390,7 +388,6 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
390388
assume_unique=True,
391389
)
392390

393-
394391
tk_ids = raw_data["tk_ids"][t][tk_mask]
395392
tk_dets = [raw_data['tk_dets'][t][ind] for ind in range(len(tk_mask)) if
396393
tk_mask[ind]]
@@ -401,7 +398,6 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
401398
# tracker_confidences = raw_data["tk_confidences"][t][tk_mask]
402399
sim_scores_masked = sim_scores[t][gt_class_mask, :][:, tk_mask]
403400

404-
405401
# add filtered prediction to the data
406402
data["tk_classes"][t] = tracker_classes
407403
data["tk_overlap_classes"][t] = tracker_overlap_classes
@@ -429,12 +425,12 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
429425
gt_id_map[unique_gt_ids] = np.arange(len(unique_gt_ids))
430426
data["gt_id_map"] = {}
431427
for gt_id in unique_gt_ids:
432-
new_gt_id = gt_id_map[gt_id].astype(np.int)
428+
new_gt_id = gt_id_map[gt_id].astype(int)
433429
data["gt_id_map"][new_gt_id] = gt_id
434430

435431
for t in range(raw_data["num_timesteps"]):
436432
if len(data["gt_ids"][t]) > 0:
437-
data["gt_ids"][t] = gt_id_map[data["gt_ids"][t]].astype(np.int)
433+
data["gt_ids"][t] = gt_id_map[data["gt_ids"][t]].astype(int)
438434

439435
if len(unique_tk_ids) > 0:
440436
unique_tk_ids = np.unique(unique_tk_ids)
@@ -443,16 +439,16 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
443439

444440
data["tk_id_map"] = {}
445441
for track_id in unique_tk_ids:
446-
new_track_id = tk_id_map[track_id].astype(np.int)
442+
new_track_id = tk_id_map[track_id].astype(int)
447443
data["tk_id_map"][new_track_id] = track_id
448444

449445
for t in range(raw_data["num_timesteps"]):
450446
if len(data["tk_ids"][t]) > 0:
451-
data["tk_ids"][t] = tk_id_map[data["tk_ids"][t]].astype(np.int)
447+
data["tk_ids"][t] = tk_id_map[data["tk_ids"][t]].astype(int)
452448
if len(data["tk_overlap_ids"][t]) > 0:
453449
data["tk_overlap_ids"][t] = tk_id_map[
454450
data["tk_overlap_ids"][t]
455-
].astype(np.int)
451+
].astype(int)
456452

457453
# record overview statistics.
458454
data["num_tk_cls_dets"] = num_tk_cls_dets

Diff for: teta/teta/datasets/coco_mots.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,11 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
296296
for t in range(raw_data["num_timesteps"]):
297297
# only extract relevant dets for this class for preproc and eval
298298
if cls == "all":
299-
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(np.bool)
299+
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(bool)
300300
else:
301301
gt_class_mask = np.atleast_1d(
302302
raw_data["gt_classes"][t] == cls_id
303-
).astype(np.bool)
303+
).astype(bool)
304304

305305
# select GT that is not in the evaluating classes
306306
if assignment is not None and assignment:
@@ -328,7 +328,7 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
328328

329329
# add the track ids of exclusive annotated class to exh_class_tk_ids
330330
tk_exh_mask = np.atleast_1d(raw_data["tk_classes"][t] == cls_id)
331-
tk_exh_mask = tk_exh_mask.astype(np.bool)
331+
tk_exh_mask = tk_exh_mask.astype(bool)
332332
exh_class_tk_ids_t = raw_data["tk_ids"][t][tk_exh_mask]
333333
exh_class_tk_ids.append(exh_class_tk_ids_t)
334334
data["tk_exh_ids"][t] = exh_class_tk_ids_t
@@ -340,11 +340,11 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
340340
for t in range(raw_data["num_timesteps"]):
341341
# add gt to the data
342342
if cls == "all":
343-
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(np.bool)
343+
gt_class_mask = np.ones_like(raw_data["gt_classes"][t]).astype(bool)
344344
else:
345345
gt_class_mask = np.atleast_1d(
346346
raw_data["gt_classes"][t] == cls_id
347-
).astype(np.bool)
347+
).astype(bool)
348348
data["gt_classes"][t] = cls_id
349349
data["gt_class_name"][t] = cls
350350

@@ -400,12 +400,12 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
400400
gt_id_map[unique_gt_ids] = np.arange(len(unique_gt_ids))
401401
data["gt_id_map"] = {}
402402
for gt_id in unique_gt_ids:
403-
new_gt_id = gt_id_map[gt_id].astype(np.int)
403+
new_gt_id = gt_id_map[gt_id].astype(int)
404404
data["gt_id_map"][new_gt_id] = gt_id
405405

406406
for t in range(raw_data["num_timesteps"]):
407407
if len(data["gt_ids"][t]) > 0:
408-
data["gt_ids"][t] = gt_id_map[data["gt_ids"][t]].astype(np.int)
408+
data["gt_ids"][t] = gt_id_map[data["gt_ids"][t]].astype(int)
409409

410410
if len(unique_tk_ids) > 0:
411411
unique_tk_ids = np.unique(unique_tk_ids)
@@ -414,16 +414,16 @@ def get_preprocessed_seq_data_thr(self, raw_data, cls, assignment=None):
414414

415415
data["tk_id_map"] = {}
416416
for track_id in unique_tk_ids:
417-
new_track_id = tk_id_map[track_id].astype(np.int)
417+
new_track_id = tk_id_map[track_id].astype(int)
418418
data["tk_id_map"][new_track_id] = track_id
419419

420420
for t in range(raw_data["num_timesteps"]):
421421
if len(data["tk_ids"][t]) > 0:
422-
data["tk_ids"][t] = tk_id_map[data["tk_ids"][t]].astype(np.int)
422+
data["tk_ids"][t] = tk_id_map[data["tk_ids"][t]].astype(int)
423423
if len(data["tk_overlap_ids"][t]) > 0:
424424
data["tk_overlap_ids"][t] = tk_id_map[
425425
data["tk_overlap_ids"][t]
426-
].astype(np.int)
426+
].astype(int)
427427

428428
# record overview statistics.
429429
data["num_tk_cls_dets"] = num_tk_cls_dets

0 commit comments

Comments
 (0)