Skip to content

Commit 3034cb5

Browse files
committed
chore: fix nitpicks
1 parent 390a342 commit 3034cb5

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

trackers/dataset/mot_challenge.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
] # person_on_vehicle, static_person, distractor, reflection
2121
MOT_IGNORE_IDS = [2, 7, 8, 12, 13] # Includes crowd (13) for ignore, adjust as needed
2222
ZERO_MARKED_EPSILON = 1e-5
23-
# --- End MOT Constants ---
23+
2424

2525
logger = get_logger(__name__)
2626

@@ -141,7 +141,7 @@ def _parse_mot_file(
141141
"frame_idx": frame_idx,
142142
"obj_id": obj_id,
143143
"xyxy": [x, y, x + width, y + height],
144-
"confidence": confidence, # Correctly assigned
144+
"confidence": confidence,
145145
"class_id": class_id,
146146
}
147147

@@ -254,7 +254,6 @@ def get_sequence_info(self, sequence_name: str) -> Dict[str, Any]:
254254
info: Dict[str, Union[int, float, str]] = {}
255255
for key, value in config["Sequence"].items():
256256
try:
257-
# Attempt to convert to int, then float, else keep as string
258257
info[key] = int(value)
259258
except ValueError:
260259
try:
@@ -528,7 +527,6 @@ def preprocess(
528527
gt_out_list = []
529528
pred_out_list = []
530529

531-
# --- Input Validation ---
532530
if (
533531
gt_dets.data is None
534532
or "frame_idx" not in gt_dets.data
@@ -563,8 +561,7 @@ def preprocess(
563561

564562
pred_dets_t_filtered = pred_dets_t
565563

566-
# --- TrackEval Preprocessing Step 1 & 2:
567-
# Optionally remove tracker dets matching distractor GTs ---
564+
# Optionally remove tracker dets matching distractor GTs
568565
if remove_distractor_matches:
569566
to_remove_tracker_indices = np.array([], dtype=int)
570567
if len(gt_dets_t) > 0 and len(pred_dets_t) > 0:
@@ -598,9 +595,8 @@ def preprocess(
598595
pred_keep_mask = np.ones(len(pred_dets_t), dtype=bool)
599596
pred_keep_mask[to_remove_tracker_indices] = False
600597
pred_dets_t_filtered = pred_dets_t[pred_keep_mask]
601-
# else: pred_dets_t_filtered remains pred_dets_t
602598

603-
# --- TrackEval Preprocessing Step 4: Remove unwanted GT dets ---
599+
# Remove unwanted GT dets
604600
gt_is_pedestrian = gt_dets_t.class_id == MOT_PEDESTRIAN_ID
605601

606602
# Refined check for zero_marked: Check if confidence is very close to 0
@@ -632,7 +628,7 @@ def preprocess(
632628
else sv.Detections.empty()
633629
)
634630

635-
# --- TrackEval Preprocessing Step 6: Relabel IDs using the utility function ---
631+
# Relabel IDs using the utility function
636632
gt_processed = relabel_ids(gt_processed)
637633
pred_processed = relabel_ids(pred_processed)
638634

trackers/dataset/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import numpy as np
22
import supervision as sv
33

4-
from trackers.log import get_logger # Added import
4+
from trackers.log import get_logger
55

6-
logger = get_logger(__name__) # Added logger instance
6+
logger = get_logger(__name__)
77

88

99
def relabel_ids(detections: sv.Detections) -> sv.Detections:
@@ -24,13 +24,13 @@ def relabel_ids(detections: sv.Detections) -> sv.Detections:
2424
if len(detections) == 0 or detections.tracker_id is None:
2525
return detections
2626

27-
# 1. Filter out potential NaN values first
27+
# Filter out potential NaN values
2828
valid_ids_mask = ~np.isnan(detections.tracker_id)
2929
if not np.any(valid_ids_mask):
3030
# All IDs were NaN or array was empty after filtering
3131
return detections
3232

33-
# 2. Get unique integer IDs
33+
# Get unique integer IDs
3434
try:
3535
unique_ids = np.unique(detections.tracker_id[valid_ids_mask].astype(int))
3636
except ValueError:

0 commit comments

Comments
 (0)