Skip to content

Commit

Permalink
Undo botched merge change
Browse files Browse the repository at this point in the history
  • Loading branch information
zhong-al committed Dec 10, 2024
1 parent 1dbd0b2 commit 5c59afb
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/kabr_tools/miniscene2behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,22 @@ def annotate_miniscene(cfg: CfgNode, model: torch.nn.Module,
tracks.append(track_id)
frames[track_id] = []

# find all frames
frames = []
for box in track.iterfind("box"):
frames.append(int(box.attrib['frame']))
# find all frames
for box in track.iterfind("box"):
frames[track_id].append(int(box.attrib["frame"]))

# run model on miniscene
for track in tracks:
video_file = f"{miniscene_path}/{track}.mp4"
cap = cv2.VideoCapture(video_file)
for frame in tqdm(frames, desc=f'{track} frames'):
inputs = get_input_clip(cap, cfg, frame)
index = 0
for frame in tqdm(frames[track], desc=f"{track} frames"):
try:
inputs = get_input_clip(cap, cfg, index)
except AssertionError as e:
print(e)
break
index += 1

if cfg.NUM_GPUS:
# transfer the data to the current GPU device.
Expand Down

0 comments on commit 5c59afb

Please sign in to comment.