Skip to content

Commit 6db4915

Browse files
authored
Small edits to 01 notebook (#591)
1 parent b838811 commit 6db4915

File tree

3 files changed

+111
-107
lines changed

3 files changed

+111
-107
lines changed

scenarios/tracking/01_training_introduction.ipynb

Lines changed: 94 additions & 98 deletions
Large diffs are not rendered by default.

scenarios/tracking/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ We provide several notebooks to show how multi-object-tracking algorithms can be
6060

6161
| Notebook name | Description |
6262
| --- | --- |
63-
| [00_webcam.ipynb](./00_webcam.ipynb)| Quick-start notebook that demonstrates how to build an object tracking system using a single video or webcam as input.
6463
| [01_training_introduction.ipynb](./01_training_introduction.ipynb)| Notebook that explains the basic concepts around model training, inferencing, and evaluation using typical tracking performance metrics.|
6564
| [02_mot_challenge.ipynb](./02_mot_challenge.ipynb) | Notebook that runs model inference on the commonly used MOT Challenge dataset. |
6665

utils_cv/tracking/model.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ def fit(
183183
"""
184184
if not self.dataset:
185185
raise Exception("No dataset provided")
186+
lr_step = str(lr_step)
186187

187188
opt_fit = deepcopy(self.opt) # copy opt to avoid bug
188189
opt_fit.lr = lr
@@ -319,42 +320,50 @@ def eval_mot(
319320
Returns:
320321
strsummary: str output by method in 'motmetrics' package, containing metrics scores
321322
"""
323+
accumulators = []
322324
eval_path = osp.join(result_root, exp_name)
323325
if not osp.exists(eval_path):
324326
os.makedirs(eval_path)
325-
accumulators = []
327+
328+
#Loop over all video sequences
326329
for seq in seqs:
327-
im_path = osp.join(data_root, seq, "img1")
328330
result_filename = "{}.txt".format(seq)
331+
im_path = osp.join(data_root, seq, "img1")
329332
result_path = osp.join(result_root, exp_name, result_filename)
330333
with open(osp.join(data_root, seq, "seqinfo.ini")) as seqinfo_file:
331334
meta_info = seqinfo_file.read()
335+
332336
# frame_rate is set from seqinfo.ini by frameRate
333337
frame_rate = int(
334338
meta_info[
335339
meta_info.find("frameRate")
336340
+ 10 : meta_info.find("\nseqLength")
337341
]
338342
)
343+
344+
# Run model inference
339345
if not osp.exists(result_path):
340-
# Run tracking.
341346
eval_results = self.predict(
342347
im_path, conf_thres, track_buffer, im_size, frame_rate
343348
)
344349
result_path = savetxt_results(
345350
eval_results, exp_name, result_root, result_filename
346351
)
347-
print(f"Saved tracking results to {result_path}")
352+
print(f"Saved tracking results to {result_path}")
353+
else:
354+
print(f"Loaded tracking results from {result_path}")
355+
356+
# Run evaluation
348357
if run_eval:
349-
# eval
350358
print(f"Evaluate seq: {seq}")
351359
mot_accumulator = evaluate_mot(data_root, seq, result_path)
352360
accumulators.append(mot_accumulator)
361+
353362
if run_eval:
354-
return None
355-
else:
356363
strsummary = mot_summary(accumulators, seqs)
357-
return strsummary
364+
return strsummary
365+
else:
366+
return None
358367

359368
def predict(
360369
self,

0 commit comments

Comments
 (0)