fix: VAE predicts next frame (paper: LVAE = MSE(õ_{t+1}, o_{t+1})), history excludes current obs
This commit is contained in:
@@ -335,11 +335,14 @@ class DreamWaQTask(Go1WalkTask):
|
|||||||
data.set_dof_pos(np.nan_to_num(np.array(dp), nan=0.0, posinf=0.0, neginf=0.0), self._model)
|
data.set_dof_pos(np.nan_to_num(np.array(dp), nan=0.0, posinf=0.0, neginf=0.0), self._model)
|
||||||
obs = self._get_obs(data, state.info)
|
obs = self._get_obs(data, state.info)
|
||||||
|
|
||||||
# 更新历史缓冲区
|
# 更新历史缓冲区:CENet 用不含当前帧的历史预测下一帧(论文 LVAE = MSE(õ_{t+1}, o_{t+1}))
|
||||||
old_history = state.info.get("obs_history",
|
full_hist = state.info.get("obs_history_full",
|
||||||
np.zeros((self._num_envs, self._cfg.num_history, 45), dtype=np.float32))
|
np.zeros((self._num_envs, self._cfg.num_history, 45), dtype=np.float32))
|
||||||
new_history = np.concatenate([old_history[:, 1:, :], obs[:, np.newaxis, :]], axis=1)
|
# 当前 CENet 输入:上一轮保存的历史(止于 o_{t-1})
|
||||||
state.info["obs_history"] = new_history
|
state.info["obs_history"] = full_hist
|
||||||
|
# 为下一轮准备新历史:滑窗 + 当前帧
|
||||||
|
new_full = np.concatenate([full_hist[:, 1:, :], obs[:, np.newaxis, :]], axis=1)
|
||||||
|
state.info["obs_history_full"] = new_full
|
||||||
|
|
||||||
current_step = state.info.get("steps", np.zeros(self._num_envs, dtype=np.int32))
|
current_step = state.info.get("steps", np.zeros(self._num_envs, dtype=np.int32))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user