Skip to content

Commit b57dc58

Browse files
Fix frame_batch initialization in runner.py when low detection confidence
1 parent 5731ebe commit b57dc58

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

dlclive/pose_estimation_pytorch/runner.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,8 @@ def get_pose(self, frame: np.ndarray) -> np.ndarray:
191191

192192
frame_batch, offsets_and_scales = self._prepare_top_down(tensor, detections)
193193
if len(frame_batch) == 0:
194-
offsets_and_scales = [(0, 0), 1]
195-
else:
196-
tensor = frame_batch # still CHW, batched
194+
offsets_and_scales = [(0, 0), 1]
195+
tensor = frame_batch # still CHW, batched
197196

198197
if self.dynamic is not None:
199198
tensor = self.dynamic.crop(tensor)
@@ -356,7 +355,7 @@ def _prepare_top_down(
356355
frame_batch = torch.stack(crops, dim=0)
357356
else:
358357
crop_w, crop_h = self.top_down_config.crop_size
359-
frame_batch = torch.zeros((0, 3, crop_h, crop_w), device=frame.device)
358+
frame_batch = torch.zeros((1, 3, crop_h, crop_w), device=frame.device)
360359
offsets_and_scales = [(0, 0), 1]
361360

362361
return frame_batch, offsets_and_scales

0 commit comments

Comments
 (0)