kai0 icon indicating copy to clipboard operation
kai0 copied to clipboard

"action": state_qpos.reshape((epi_len, -1)),

Open RuiboLiu77 opened this issue 6 months ago • 1 comments

Hello, thank you very much for your open-source project. I got a question about the hdf5 data loading process, I notice that in function in below:

def load_hdf5_dataset( episode_path: str | Path, ) -> dict: """Load hdf5 dataset and return a dict with observations and actions"""

with h5py.File(episode_path) as f:
    state_images_cam_high = np.array(f["observations/images/cam_high"])
    state_images_cam_left_wrist = np.array(f["observations/images/cam_left_wrist"])
    state_images_cam_right_wrist = np.array(f["observations/images/cam_right_wrist"])
    state_qpos = np.array(f["observations/qpos"])

assert (
    state_images_cam_high.shape[0]
    == state_images_cam_left_wrist.shape[0]
    == state_images_cam_right_wrist.shape[0]
    == state_qpos.shape[0]
)

epi_len = state_images_cam_high.shape[0]
episode = {
    "observation.state": state_qpos.reshape((epi_len, -1)),
    "observation.images.top_head": state_images_cam_high,
    "observation.images.hand_left": state_images_cam_left_wrist,
    "observation.images.hand_right": state_images_cam_right_wrist,
    "action": state_qpos.reshape((epi_len, -1)),
    "epi_len": epi_len
}
return episode

you use state_qpos as action input, is that a special design or a mini bug? That cofuse me a bit Thank you for your attention.

RuiboLiu77 avatar May 26 '26 10:05 RuiboLiu77

Hi, thanks for your question. Yes, that's a co-design for both data collection and model training . During data collection stage, we save the slave joint angles as 'action' in HDF5, and the master joint angles as 'observation/qpos'. For ALOHA setup, the master joint angles('observation/qpos') are actually the action commands for slave joints, and we expect the model to predict action command rather than proprioceptions (which is 'action' in HDF5 in practice).

Tradewindycc avatar Jun 05 '26 09:06 Tradewindycc