From b57dc58839a1aaf1a37249b6b8298bfd7da231e5 Mon Sep 17 00:00:00 2001 From: Artur <35294812+arturoptophys@users.noreply.github.com> Date: Thu, 4 Dec 2025 18:13:32 +0100 Subject: [PATCH] Fix frame_batch initialization in runner.py when low detection confidence --- dlclive/pose_estimation_pytorch/runner.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dlclive/pose_estimation_pytorch/runner.py b/dlclive/pose_estimation_pytorch/runner.py index 11188f1..2c59605 100644 --- a/dlclive/pose_estimation_pytorch/runner.py +++ b/dlclive/pose_estimation_pytorch/runner.py @@ -191,9 +191,8 @@ def get_pose(self, frame: np.ndarray) -> np.ndarray: frame_batch, offsets_and_scales = self._prepare_top_down(tensor, detections) if len(frame_batch) == 0: - offsets_and_scales = [(0, 0), 1] - else: - tensor = frame_batch # still CHW, batched + offsets_and_scales = [(0, 0), 1] + tensor = frame_batch # still CHW, batched if self.dynamic is not None: tensor = self.dynamic.crop(tensor) @@ -356,7 +355,7 @@ def _prepare_top_down( frame_batch = torch.stack(crops, dim=0) else: crop_w, crop_h = self.top_down_config.crop_size - frame_batch = torch.zeros((0, 3, crop_h, crop_w), device=frame.device) + frame_batch = torch.zeros((1, 3, crop_h, crop_w), device=frame.device) offsets_and_scales = [(0, 0), 1] return frame_batch, offsets_and_scales