Robotics
LeRobot
Safetensors
pi05
bimanual
arx
File size: 537 Bytes
25cf72f
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
"""Template for `fit_check_pi05_cups.py --client-fn example_client_fn:opencv_camera_to_tensor --client-frame-format bgr`.
Replace the body with YOUR robot-side code path (camera frame -> model image tensor). Must return float (3, H, W) in [0, 1]."""
import numpy as np
import torch


def opencv_camera_to_tensor(frame_bgr_uint8: np.ndarray) -> torch.Tensor:
    rgb = frame_bgr_uint8[:, :, ::-1]  # OpenCV delivers BGR; the model was trained on RGB
    return torch.from_numpy(np.ascontiguousarray(rgb)).permute(2, 0, 1).float() / 255.0