Skip to content

fix(demo): trailing comma wraps bbox array in a tuple (+2 more) - #61

Draft
andrewwhitecdw wants to merge 1 commit into
NVlabs:mainfrom
andrewwhitecdw:bugfix/demo-assorted-413dbddb
Draft

fix(demo): trailing comma wraps bbox array in a tuple (+2 more)#61
andrewwhitecdw wants to merge 1 commit into
NVlabs:mainfrom
andrewwhitecdw:bugfix/demo-assorted-413dbddb

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

Small fixes in pose_est/hybrik_demo/demo.py:

fix: trailing comma wraps bbox array in a tuple

Fix: Replace:

        mot_bboxes[idx]['bbox'] = np.stack(bboxes[idx]),

with:

        mot_bboxes[idx]['bbox'] = np.stack(bboxes[idx])

fix: single-person branch skips frames and mismatches bbox/exist lengths

Fix: Apply patch:

--- a/pose_est/hybrik_demo/demo.py
+++ b/pose_est/hybrik_demo/demo.py
@@ -226,10 +226,11 @@
     prev_box = None
 
     out_dict = defaultdict(lambda: defaultdict(list))
     idx = 0   # single person id
 
-    frame_idx = 0
+    frame_idx = -1
 
     bbox_exist = []
-    bboxes = []
+    bboxes = [np.zeros(4) for _ in range(len(img_path_list))]
     for img_path in tqdm(img_path_list):
+        frame_idx += 1
         dirname = os.path.dirname(img_path)
         basename = os.path.basename(img_path)
 
@@ -294,7 +295,7 @@
         pts[:, 0] = pts[:, 0] + bbox_xywh[0]
         pts[:, 1] = pts[:, 1] + bbox_xywh[1]
 
-        bboxes.append(np.array(bbox_xywh))
+        bboxes[frame_idx] = np.array(bbox_xywh)
 
         new_princpt = np.array([image.shape[1], image.shape[0]]) * 0.5
         transl[:2] += (np.array(princpt) - new_princpt) * transl[2] / np.array(focal)
@@ -309,7 +310,6 @@
         out_dict[idx]['cam_K'].append(K.astype(np.float32))
 
         image_vis = cv2.cvtColor(image_vis, cv2.COLOR_RGB2BGR)
-        frame_idx += 1
         res_path = os.path.join(opt.out_dir, 'res_images', f'{frame_idx:06d}.jpg')
         cv2.imwrite(res_path, image_vis)

fix: multi-person bbox list length mismatches exist array

Fix: Apply patch:

--- a/pose_est/hybrik_demo/demo.py
+++ b/pose_est/hybrik_demo/demo.py
@@ -123,6 +123,7 @@
     # initialize
     for person_id in tracking_results:
         bbox_exist[person_id-1] = [0 for _ in range(len(img_path_list))]
+        bboxes[person_id-1] = [np.zeros(4) for _ in range(len(img_path_list))]
 
     for frame_idx in tqdm(range(len(img_path_list))):
 
@@ -169,7 +170,7 @@
                 pts[:, 0] = pts[:, 0] + bbox_xywh[0]
                 pts[:, 1] = pts[:, 1] + bbox_xywh[1]
 
-                bboxes[idx].append(np.array(bbox_xywh))
+                bboxes[idx][frame_idx] = np.array(bbox_xywh)
 
                 new_princpt = np.array([image.shape[1], image.shape[0]]) * 0.5
                 transl[:2] += (np.array(princpt) - new_princpt) * transl[2] / np.array(focal)

Files changed

  • pose_est/hybrik_demo/demo.py

Reconstructed from original sweep finding patch(es).
@andrewwhitecdw
andrewwhitecdw force-pushed the bugfix/demo-assorted-413dbddb branch from 73b4e09 to aeca608 Compare August 2, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant