chore: 加载时将图像缩放到224*224, resnet禁用crop

This commit is contained in:
gouhanke
2026-02-12 15:02:18 +08:00
parent 37a47ac2dd
commit 926d8cf894
2 changed files with 6 additions and 3 deletions

View File

@@ -86,6 +86,9 @@ class SimpleRobotDataset(Dataset):
h5_path = f'observations/images/{cam_name}'
if h5_path in f:
img = f[h5_path][meta["frame_idx"]]
# Resize图像到224x224减少内存和I/O负担
import cv2
img = cv2.resize(img, (224, 224), interpolation=cv2.INTER_LINEAR)
# 转换为float并归一化到 [0, 1]
img = torch.from_numpy(img).float() / 255.0
frame[f"observation.{cam_name}"] = img.permute(2, 0, 1) # HWC -> CHW