Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions trackeval/baselines/stp.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def track_sequence(seq_file):

# Initialize container for holding previously tracked objects.
prev = {'boxes': np.empty((0, 4)),
'ids': np.array([], np.int),
'ids': np.array([], int),
'timesteps': np.array([])}

# Run tracker for each timestep.
Expand Down Expand Up @@ -80,7 +80,7 @@ def track_sequence(seq_file):
match_cols = match_cols[actually_matched_mask]

# Assign the prev track ID to the current dets if they were matched.
ids = np.nan * np.ones((len(boxes),), np.int)
ids = np.nan * np.ones((len(boxes),), int)
ids[match_cols] = prev['ids'][match_rows]

# Create new track IDs for dets that were not matched to previous tracks.
Expand Down
8 changes: 4 additions & 4 deletions trackeval/datasets/bdd100k.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ def get_preprocessed_seq_data(self, raw_data, cls):

# Only extract relevant dets for this class for preproc and eval (cls)
gt_class_mask = np.atleast_1d(raw_data['gt_classes'][t] == cls_id)
gt_class_mask = gt_class_mask.astype(np.bool)
gt_class_mask = gt_class_mask.astype(np.bool_)
gt_ids = raw_data['gt_ids'][t][gt_class_mask]
gt_dets = raw_data['gt_dets'][t][gt_class_mask]

tracker_class_mask = np.atleast_1d(raw_data['tracker_classes'][t] == cls_id)
tracker_class_mask = tracker_class_mask.astype(np.bool)
tracker_class_mask = tracker_class_mask.astype(np.bool_)
tracker_ids = raw_data['tracker_ids'][t][tracker_class_mask]
tracker_dets = raw_data['tracker_dets'][t][tracker_class_mask]
similarity_scores = raw_data['similarity_scores'][t][gt_class_mask, :][:, tracker_class_mask]
Expand Down Expand Up @@ -276,14 +276,14 @@ def get_preprocessed_seq_data(self, raw_data, cls):
gt_id_map[unique_gt_ids] = np.arange(len(unique_gt_ids))
for t in range(raw_data['num_timesteps']):
if len(data['gt_ids'][t]) > 0:
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(np.int)
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(int)
if len(unique_tracker_ids) > 0:
unique_tracker_ids = np.unique(unique_tracker_ids)
tracker_id_map = np.nan * np.ones((np.max(unique_tracker_ids) + 1))
tracker_id_map[unique_tracker_ids] = np.arange(len(unique_tracker_ids))
for t in range(raw_data['num_timesteps']):
if len(data['tracker_ids'][t]) > 0:
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(np.int)
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(int)

# Record overview statistics.
data['num_tracker_dets'] = num_tracker_dets
Expand Down
10 changes: 5 additions & 5 deletions trackeval/datasets/burst_helpers/burst_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ def get_preprocessed_seq_data(self, raw_data, cls):

# Only extract relevant dets for this class for preproc and eval (cls)
gt_class_mask = np.atleast_1d(raw_data['gt_classes'][t] == cls_id)
gt_class_mask = gt_class_mask.astype(np.bool)
gt_class_mask = gt_class_mask.astype(np.bool_)
gt_ids = raw_data['gt_ids'][t][gt_class_mask]
gt_dets = raw_data['gt_dets'][t][gt_class_mask]

tracker_class_mask = np.atleast_1d(raw_data['tracker_classes'][t] == cls_id)
tracker_class_mask = tracker_class_mask.astype(np.bool)
tracker_class_mask = tracker_class_mask.astype(np.bool_)
tracker_ids = raw_data['tracker_ids'][t][tracker_class_mask]
tracker_dets = raw_data['tracker_dets'][t][tracker_class_mask]
tracker_confidences = raw_data['tracker_confidences'][t][tracker_class_mask]
Expand All @@ -349,7 +349,7 @@ def get_preprocessed_seq_data(self, raw_data, cls):
elif is_not_exhaustively_labeled:
to_remove_tracker = unmatched_indices
else:
to_remove_tracker = np.array([], dtype=np.int)
to_remove_tracker = np.array([], dtype=int)

# remove all unwanted unmatched tracker detections
data['tracker_ids'][t] = np.delete(tracker_ids, to_remove_tracker, axis=0)
Expand Down Expand Up @@ -377,14 +377,14 @@ def get_preprocessed_seq_data(self, raw_data, cls):
gt_id_map[unique_gt_ids] = np.arange(len(unique_gt_ids))
for t in range(raw_data['num_timesteps']):
if len(data['gt_ids'][t]) > 0:
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(np.int)
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(int)
if len(unique_tracker_ids) > 0:
unique_tracker_ids = np.unique(unique_tracker_ids)
tracker_id_map = np.nan * np.ones((np.max(unique_tracker_ids) + 1))
tracker_id_map[unique_tracker_ids] = np.arange(len(unique_tracker_ids))
for t in range(raw_data['num_timesteps']):
if len(data['tracker_ids'][t]) > 0:
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(np.int)
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(int)

# Record overview statistics.
data['num_tracker_dets'] = num_tracker_dets
Expand Down
10 changes: 5 additions & 5 deletions trackeval/datasets/burst_helpers/burst_ow_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,12 @@ def get_preprocessed_seq_data(self, raw_data, cls):

# Only extract relevant dets for this class for preproc and eval (cls)
gt_class_mask = np.atleast_1d(raw_data['gt_classes'][t] == cls_id)
gt_class_mask = gt_class_mask.astype(np.bool)
gt_class_mask = gt_class_mask.astype(np.bool_)
gt_ids = raw_data['gt_ids'][t][gt_class_mask]
gt_dets = raw_data['gt_dets'][t][gt_class_mask]

tracker_class_mask = np.atleast_1d(raw_data['tracker_classes'][t] == cls_id)
tracker_class_mask = tracker_class_mask.astype(np.bool)
tracker_class_mask = tracker_class_mask.astype(np.bool_)
tracker_ids = raw_data['tracker_ids'][t][tracker_class_mask]
tracker_dets = raw_data['tracker_dets'][t][tracker_class_mask]
tracker_confidences = raw_data['tracker_confidences'][t][tracker_class_mask]
Expand All @@ -358,7 +358,7 @@ def get_preprocessed_seq_data(self, raw_data, cls):
elif is_not_exhaustively_labeled:
to_remove_tracker = unmatched_indices
else:
to_remove_tracker = np.array([], dtype=np.int)
to_remove_tracker = np.array([], dtype=int)

# remove all unwanted unmatched tracker detections
data['tracker_ids'][t] = np.delete(tracker_ids, to_remove_tracker, axis=0)
Expand All @@ -382,14 +382,14 @@ def get_preprocessed_seq_data(self, raw_data, cls):
gt_id_map[unique_gt_ids] = np.arange(len(unique_gt_ids))
for t in range(raw_data['num_timesteps']):
if len(data['gt_ids'][t]) > 0:
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(np.int)
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(int)
if len(unique_tracker_ids) > 0:
unique_tracker_ids = np.unique(unique_tracker_ids)
tracker_id_map = np.nan * np.ones((np.max(unique_tracker_ids) + 1))
tracker_id_map[unique_tracker_ids] = np.arange(len(unique_tracker_ids))
for t in range(raw_data['num_timesteps']):
if len(data['tracker_ids'][t]) > 0:
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(np.int)
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(int)

# Record overview statistics.
data['num_tracker_dets'] = num_tracker_dets
Expand Down
6 changes: 3 additions & 3 deletions trackeval/datasets/davis.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def get_preprocessed_seq_data(self, raw_data, cls):
rows, columns = np.where(void_mask_ious > 0)
for r in rows:
det = mask_utils.decode(raw_data['tracker_dets'][t][r])
void = mask_utils.decode(void_mask).astype(np.bool)
void = mask_utils.decode(void_mask).astype(np.bool_)
det[void] = 0
det = mask_utils.encode(np.array(det, order='F').astype(np.uint8))
raw_data['tracker_dets'][t][r] = det
Expand All @@ -253,14 +253,14 @@ def get_preprocessed_seq_data(self, raw_data, cls):
gt_id_map[unique_gt_ids] = np.arange(len(unique_gt_ids))
for t in range(raw_data['num_timesteps']):
if len(data['gt_ids'][t]) > 0:
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(np.int)
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(int)
if len(unique_tracker_ids) > 0:
unique_tracker_ids = np.unique(unique_tracker_ids)
tracker_id_map = np.nan * np.ones((np.max(unique_tracker_ids) + 1))
tracker_id_map[unique_tracker_ids] = np.arange(len(unique_tracker_ids))
for t in range(raw_data['num_timesteps']):
if len(data['tracker_ids'][t]) > 0:
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(np.int)
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(int)

# Record overview statistics.
data['num_tracker_dets'] = num_tracker_dets
Expand Down
8 changes: 4 additions & 4 deletions trackeval/datasets/head_tracking_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def _load_raw_file(self, tracker, seq, is_gt):
time_key = str(t+1)
if time_key in read_data.keys():
try:
time_data = np.asarray(read_data[time_key], dtype=np.float)
time_data = np.asarray(read_data[time_key], dtype=float)
except ValueError:
if is_gt:
raise TrackEvalException(
Expand Down Expand Up @@ -365,7 +365,7 @@ def get_preprocessed_seq_data(self, raw_data, cls):

# Match tracker and gt dets (with hungarian algorithm) and remove tracker dets which match with gt dets
# which are labeled as belonging to a distractor class.
to_remove_tracker = np.array([], np.int)
to_remove_tracker = np.array([], int)
if self.do_preproc and self.benchmark != 'MOT15' and gt_ids.shape[0] > 0 and tracker_ids.shape[0] > 0:

# Check all classes are valid:
Expand Down Expand Up @@ -432,14 +432,14 @@ def get_preprocessed_seq_data(self, raw_data, cls):
gt_id_map[unique_gt_ids] = np.arange(len(unique_gt_ids))
for t in range(raw_data['num_timesteps']):
if len(data['gt_ids'][t]) > 0:
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(np.int)
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(int)
if len(unique_tracker_ids) > 0:
unique_tracker_ids = np.unique(unique_tracker_ids)
tracker_id_map = np.nan * np.ones((np.max(unique_tracker_ids) + 1))
tracker_id_map[unique_tracker_ids] = np.arange(len(unique_tracker_ids))
for t in range(raw_data['num_timesteps']):
if len(data['tracker_ids'][t]) > 0:
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(np.int)
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(int)

# Record overview statistics.
data['num_tracker_dets'] = num_tracker_dets
Expand Down
14 changes: 7 additions & 7 deletions trackeval/datasets/kitti_2d_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _load_raw_file(self, tracker, seq, is_gt):
for t in range(num_timesteps):
time_key = str(t)
if time_key in read_data.keys():
time_data = np.asarray(read_data[time_key], dtype=np.float)
time_data = np.asarray(read_data[time_key], dtype=float)
raw_data['dets'][t] = np.atleast_2d(time_data[:, 6:10])
raw_data['ids'][t] = np.atleast_1d(time_data[:, 1]).astype(int)
raw_data['classes'][t] = np.atleast_1d(time_data[:, 2]).astype(int)
Expand All @@ -215,7 +215,7 @@ def _load_raw_file(self, tracker, seq, is_gt):
raw_data['tracker_confidences'][t] = np.empty(0)
if is_gt:
if time_key in ignore_data.keys():
time_ignore = np.asarray(ignore_data[time_key], dtype=np.float)
time_ignore = np.asarray(ignore_data[time_key], dtype=float)
raw_data['gt_crowd_ignore_regions'][t] = np.atleast_2d(time_ignore[:, 6:10])
else:
raw_data['gt_crowd_ignore_regions'][t] = np.empty((0, 4))
Expand Down Expand Up @@ -288,23 +288,23 @@ def get_preprocessed_seq_data(self, raw_data, cls):

# Only extract relevant dets for this class for preproc and eval (cls + distractor classes)
gt_class_mask = np.sum([raw_data['gt_classes'][t] == c for c in [cls_id] + distractor_classes], axis=0)
gt_class_mask = gt_class_mask.astype(np.bool)
gt_class_mask = gt_class_mask.astype(np.bool_)
gt_ids = raw_data['gt_ids'][t][gt_class_mask]
gt_dets = raw_data['gt_dets'][t][gt_class_mask]
gt_classes = raw_data['gt_classes'][t][gt_class_mask]
gt_occlusion = raw_data['gt_extras'][t]['occlusion'][gt_class_mask]
gt_truncation = raw_data['gt_extras'][t]['truncation'][gt_class_mask]

tracker_class_mask = np.atleast_1d(raw_data['tracker_classes'][t] == cls_id)
tracker_class_mask = tracker_class_mask.astype(np.bool)
tracker_class_mask = tracker_class_mask.astype(np.bool_)
tracker_ids = raw_data['tracker_ids'][t][tracker_class_mask]
tracker_dets = raw_data['tracker_dets'][t][tracker_class_mask]
tracker_confidences = raw_data['tracker_confidences'][t][tracker_class_mask]
similarity_scores = raw_data['similarity_scores'][t][gt_class_mask, :][:, tracker_class_mask]

# Match tracker and gt dets (with hungarian algorithm) and remove tracker dets which match with gt dets
# which are labeled as truncated, occluded, or belonging to a distractor class.
to_remove_matched = np.array([], np.int)
to_remove_matched = np.array([], int)
unmatched_indices = np.arange(tracker_ids.shape[0])
if gt_ids.shape[0] > 0 and tracker_ids.shape[0] > 0:
matching_scores = similarity_scores.copy()
Expand Down Expand Up @@ -362,14 +362,14 @@ def get_preprocessed_seq_data(self, raw_data, cls):
gt_id_map[unique_gt_ids] = np.arange(len(unique_gt_ids))
for t in range(raw_data['num_timesteps']):
if len(data['gt_ids'][t]) > 0:
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(np.int)
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(int)
if len(unique_tracker_ids) > 0:
unique_tracker_ids = np.unique(unique_tracker_ids)
tracker_id_map = np.nan * np.ones((np.max(unique_tracker_ids) + 1))
tracker_id_map[unique_tracker_ids] = np.arange(len(unique_tracker_ids))
for t in range(raw_data['num_timesteps']):
if len(data['tracker_ids'][t]) > 0:
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(np.int)
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(int)

# Record overview statistics.
data['num_tracker_dets'] = num_tracker_dets
Expand Down
8 changes: 4 additions & 4 deletions trackeval/datasets/kitti_mots.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,12 @@ def get_preprocessed_seq_data(self, raw_data, cls):

# Only extract relevant dets for this class for preproc and eval (cls)
gt_class_mask = np.atleast_1d(raw_data['gt_classes'][t] == cls_id)
gt_class_mask = gt_class_mask.astype(np.bool)
gt_class_mask = gt_class_mask.astype(np.bool_)
gt_ids = raw_data['gt_ids'][t][gt_class_mask]
gt_dets = [raw_data['gt_dets'][t][ind] for ind in range(len(gt_class_mask)) if gt_class_mask[ind]]

tracker_class_mask = np.atleast_1d(raw_data['tracker_classes'][t] == cls_id)
tracker_class_mask = tracker_class_mask.astype(np.bool)
tracker_class_mask = tracker_class_mask.astype(np.bool_)
tracker_ids = raw_data['tracker_ids'][t][tracker_class_mask]
tracker_dets = [raw_data['tracker_dets'][t][ind] for ind in range(len(tracker_class_mask)) if
tracker_class_mask[ind]]
Expand Down Expand Up @@ -363,14 +363,14 @@ def get_preprocessed_seq_data(self, raw_data, cls):
gt_id_map[unique_gt_ids] = np.arange(len(unique_gt_ids))
for t in range(raw_data['num_timesteps']):
if len(data['gt_ids'][t]) > 0:
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(np.int)
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(int)
if len(unique_tracker_ids) > 0:
unique_tracker_ids = np.unique(unique_tracker_ids)
tracker_id_map = np.nan * np.ones((np.max(unique_tracker_ids) + 1))
tracker_id_map[unique_tracker_ids] = np.arange(len(unique_tracker_ids))
for t in range(raw_data['num_timesteps']):
if len(data['tracker_ids'][t]) > 0:
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(np.int)
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(int)

# Record overview statistics.
data['num_tracker_dets'] = num_tracker_dets
Expand Down
8 changes: 4 additions & 4 deletions trackeval/datasets/mot_challenge_2d_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def _load_raw_file(self, tracker, seq, is_gt):
time_key = str(t+1)
if time_key in read_data.keys():
try:
time_data = np.asarray(read_data[time_key], dtype=np.float)
time_data = np.asarray(read_data[time_key], dtype=float)
except ValueError:
if is_gt:
raise TrackEvalException(
Expand Down Expand Up @@ -356,7 +356,7 @@ def get_preprocessed_seq_data(self, raw_data, cls):

# Match tracker and gt dets (with hungarian algorithm) and remove tracker dets which match with gt dets
# which are labeled as belonging to a distractor class.
to_remove_tracker = np.array([], np.int)
to_remove_tracker = np.array([], int)
if self.do_preproc and self.benchmark != 'MOT15' and gt_ids.shape[0] > 0 and tracker_ids.shape[0] > 0:

# Check all classes are valid:
Expand Down Expand Up @@ -410,14 +410,14 @@ def get_preprocessed_seq_data(self, raw_data, cls):
gt_id_map[unique_gt_ids] = np.arange(len(unique_gt_ids))
for t in range(raw_data['num_timesteps']):
if len(data['gt_ids'][t]) > 0:
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(np.int)
data['gt_ids'][t] = gt_id_map[data['gt_ids'][t]].astype(int)
if len(unique_tracker_ids) > 0:
unique_tracker_ids = np.unique(unique_tracker_ids)
tracker_id_map = np.nan * np.ones((np.max(unique_tracker_ids) + 1))
tracker_id_map[unique_tracker_ids] = np.arange(len(unique_tracker_ids))
for t in range(raw_data['num_timesteps']):
if len(data['tracker_ids'][t]) > 0:
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(np.int)
data['tracker_ids'][t] = tracker_id_map[data['tracker_ids'][t]].astype(int)

# Record overview statistics.
data['num_tracker_dets'] = num_tracker_dets
Expand Down
Loading