时间: 2025-11-14 晚上 主题: 架构整改、模块通用性验证和数据模块清理
raw_frame_collector.py视频专用,online_frame_collector.py在线专用)compat.capture_screen()environment/compatibility.py)
video_path, skip_framesget_frame_metadata() - 统一获取帧元数据capture_screen() - 统一返回格式并更新计数器data/unified_frame_collector.py)
compat.capture_screen()--mode offline / --mode onlinedata/raw_frame_collector.py为 [DEPRECATED]data/online_frame_collector.py为 [DEPRECATED]quickstart.md - 使用unified_frame_collectordocs/ARCHITECTURE_REFACTOR_PLAN.md - 详细整改计划错误做法(已废弃):
├── raw_frame_collector.py(视频专用)
├── online_frame_collector.py(在线专用)
└── 代码重复,违反通用性原则
正确做法:
CompatibilityLayer(统一数据源)
├─ offline模式 → VideoReader
└─ online模式 → autowzry.lite_当前画面()
↓
UnifiedFrameCollector(通用)
└─ 只调用 compat.capture_screen()
# 离线模式(视频)
python data/unified_frame_collector.py --mode offline --video moive/1.mp4 --skip-frames 14
# 在线模式(设备)
python data/unified_frame_collector.py --mode online --config config.yaml --interval 0.5
data/per_frame_annotator.py - 只操作HDF5,完全通用data/flexible_frame_loader.py - 只加载HDF5,完全通用data/unified_frame_collector.py + per_frame_annotator.py - 正确使用兼容层data/unified_frame_collector.py - 新统一收集器,完全通用scripts/test_local_pipeline.py - 配置驱动,完全通用environment/compatibility.py - 兼容层本身environment/action_space.py - 纯数据定义scripts/collect_spectate.py:
compat.capture_screen())mode='online'(应用层脚本,可接受)--mode参数支持data/replay_buffer.py:
observations, actions, rewards, dones)frame_000000/image等)FlexibleReplayBuffer或添加格式适配data/raw_frame_collector.py - [DEPRECATED]data/online_frame_collector.py - [DEPRECATED]observations/actions/rewards/dones 数组frame_000000/image/action/reward/done 组ReplayBuffer 接口完全兼容FlexibleFrameLoader 加载逐帧数据ImageProcessor)[Test 1] 传统格式加载:
Loaded: 108 transitions
State shape: (4, 540, 960)
✅ 采样成功: (32, 4, 540, 960)
[Test 2] 逐帧格式加载:
Loaded: 19 transitions (from 20 frames, 100% annotated)
State shape: (540, 960, 3)
✅ 采样成功: (8, 540, 960, 3)
data/raw_frame_collector.py - 视频专用收集器(违反架构原则)data/online_frame_collector.py - 在线专用收集器(违反架构原则)data/unified_frame_collector.py - 统一收集器(支持在线/离线)data/
├── __init__.py
├── unified_frame_collector.py + per_frame_annotator.py # 传统格式收集
├── replay_buffer.py # 传统格式回放缓冲区
├── unified_frame_collector.py # 统一收集器(新架构)
├── per_frame_annotator.py # 逐帧标注器(新架构)
├── flexible_frame_loader.py # 逐帧加载器(新架构)
└── flexible_replay_buffer.py # 灵活回放缓冲区(新架构)
quickstart.md - 完全重写,添加数据格式说明和完整训练流程scripts/collect_spectate.py - 添加头部说明,说明生成传统格式数据unified_frame_collector.py HDF5 保存错误TypeError: Object dtype dtype('O') has no native HDF5 equivalentvideo_path 可能是 Path 对象或其他 Python 对象,HDF5 不支持直接保存 Python 对象类型video_path 转换为字符串