From da7fb54c64941773622bf0daf53dc3fd2718b111 Mon Sep 17 00:00:00 2001 From: Pepijn Date: Thu, 16 Apr 2026 21:13:18 +0200 Subject: [PATCH] fix(vlabench): resize images to declared observation_space shape VLABench's load_env doesn't always honor render_resolution, so the returned rgb frames may not match our declared (h, w, 3) observation space. gymnasium's SyncVectorEnv.concatenate then raises "Output array is the wrong shape". Resize to the declared (h, w). Made-with: Cursor --- src/lerobot/envs/vlabench.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lerobot/envs/vlabench.py b/src/lerobot/envs/vlabench.py index 3212fde14..a1dbe78e3 100644 --- a/src/lerobot/envs/vlabench.py +++ b/src/lerobot/envs/vlabench.py @@ -237,11 +237,16 @@ class VLABenchEnv(gym.Env): else: # HWC images["image"] = rgb.astype(np.uint8) - # Fill missing cameras with zeros + # VLABench's native render size may not match our declared observation_space. + # Resize each image to (h, w) so gymnasium's vector env concatenate succeeds. h, w = self.render_resolution for key in ["image", "second_image", "wrist_image"]: if key not in images: images[key] = np.zeros((h, w, 3), dtype=np.uint8) + elif images[key].shape[:2] != (h, w): + import cv2 + + images[key] = cv2.resize(images[key], (w, h), interpolation=cv2.INTER_AREA).astype(np.uint8) # Extract end-effector state ee_state = obs.get("ee_state", np.zeros(7, dtype=np.float64))