Skip to content
Merged
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
192 changes: 94 additions & 98 deletions scenarios/tracking/01_training_introduction.ipynb

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion scenarios/tracking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ We provide several notebooks to show how multi-object-tracking algorithms can be

| Notebook name | Description |
| --- | --- |
| [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.
| [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.|
| [02_mot_challenge.ipynb](./02_mot_challenge.ipynb) | Notebook that runs model inference on the commonly used MOT Challenge dataset. |

Expand Down
25 changes: 17 additions & 8 deletions utils_cv/tracking/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def fit(
"""
if not self.dataset:
raise Exception("No dataset provided")
lr_step = str(lr_step)

opt_fit = deepcopy(self.opt) # copy opt to avoid bug
opt_fit.lr = lr
Expand Down Expand Up @@ -319,42 +320,50 @@ def eval_mot(
Returns:
strsummary: str output by method in 'motmetrics' package, containing metrics scores
"""
accumulators = []
eval_path = osp.join(result_root, exp_name)
if not osp.exists(eval_path):
os.makedirs(eval_path)
accumulators = []

#Loop over all video sequences
for seq in seqs:
im_path = osp.join(data_root, seq, "img1")
result_filename = "{}.txt".format(seq)
im_path = osp.join(data_root, seq, "img1")
result_path = osp.join(result_root, exp_name, result_filename)
with open(osp.join(data_root, seq, "seqinfo.ini")) as seqinfo_file:
meta_info = seqinfo_file.read()

# frame_rate is set from seqinfo.ini by frameRate
frame_rate = int(
meta_info[
meta_info.find("frameRate")
+ 10 : meta_info.find("\nseqLength")
]
)

# Run model inference
if not osp.exists(result_path):
# Run tracking.
eval_results = self.predict(
im_path, conf_thres, track_buffer, im_size, frame_rate
)
result_path = savetxt_results(
eval_results, exp_name, result_root, result_filename
)
print(f"Saved tracking results to {result_path}")
print(f"Saved tracking results to {result_path}")
else:
print(f"Loaded tracking results from {result_path}")

# Run evaluation
if run_eval:
# eval
print(f"Evaluate seq: {seq}")
mot_accumulator = evaluate_mot(data_root, seq, result_path)
accumulators.append(mot_accumulator)

if run_eval:
return None
else:
strsummary = mot_summary(accumulators, seqs)
return strsummary
return strsummary
else:
return None

def predict(
self,
Expand Down