refactor(actpred): 模型输入尺寸 image_size → image_width/image_height,默认 1920×1080

config/model/dataset/train/pretrain/predict/export 全链路适配非方形输入,
hailo_infer/onnx_infer 从模型元数据动态推导宽高;旧 224 checkpoint 配置键
不兼容(重训后替换)。Pi 5 CPU 冒烟验证 1080p 训练可行(~4.75s/步 batch=2)。
This commit is contained in:
qing committed 2026-08-13 02:19:30 +08:00
1 parent a240377ba1
commit 91b30040c7
11 files changed
+73 -56

No files matched your search

+4 -3
View File
@@ -127,14 +127,15 @@ class ActionPredictor(nn.Module):
self._frame_len = data_cfg.frame_len
self._history_len = data_cfg.history_len
self._action_dim = data_cfg.action_dim
self._image_size = data_cfg.image_size
self._image_width = data_cfg.image_width
self._image_height = data_cfg.image_height
self._cnn_feature_dim = model_cfg.cnn_feature_dim
def forward(self, images: torch.Tensor, action_history: torch.Tensor) -> torch.Tensor:
# images: (B, F, 3, S, S) action_history: (B, H, D)
# images: (B, F, 3, H, W) action_history: (B, H_len, D)
b = images.size(0)
frames = images.reshape(
b * self._frame_len, 3, self._image_size, self._image_size)
b * self._frame_len, 3, self._image_height, self._image_width)
img_feat = self.image_encoder(frames).reshape(
b, self._frame_len, self._cnn_feature_dim)
img_tokens = self.img_proj(img_feat)