跳转到内容

C301 第 4 课:质量控制、存储与文档

没有人检查过的素材还不算数据。本课跟随一段录制从采集设备走到一个有文档的数据集:它要通过的检查,承载它的文件,它需要的存储和网络,以及向任何用它训练的人解释它的那份记录。完整的论述见第一人称素材的质量控制、存储、上传与数据量、录制容器和为数据集撰写文档。

另见术语表的数据集、格式与存储一节。

术语 含义
质量控制(Quality control, QC) 一段录制在被使用之前要经过的自动检查和人工检查
数据整理(Curation) QC 之后的筛选,对已接受的小时数做打分、剪切和去重,形成一个训练集
文件清单(Manifest) 一份列出每个片段及其元数据和小时数的列表,使文件可以核对,小时数只计算一次
数据导出(Offload) 把一个班次的录制从采集设备复制到一台暂存机上,校验它们,并清空采集设备
上行链路(Uplink) 从采集站点到中心存储的上传带宽
录制容器(Recording container) 一种文件格式,把若干路传感器数据流及其时间戳和元数据交织存放在一个文件里
数据集说明书(Datasheet for a dataset) 一份文档,记录一个数据集为什么被制作、包含什么、如何采集,以及应该怎样使用

实用指南的参考表为每一项检查给出一个已发表的例子,它出自所列的来源,针对的是该来源的数据(质量控制)。其中没有一个是通用的设置。

检查项 测量什么 已发表的例子
文件完整性 每条记录都能解码 对 VRS 文件运行 vrs check
文件清单 每个片段都有它的元数据,每台设备都有它的标定文件 Egocentric-10K:每个 .mp4 一个 .json,每个工人文件夹一个 intrinsics.json
小时数统计 同一个 episode 没有被计算两次 EgoStandard:LeRobot 和 MCAP 两份副本是同一批 episode
帧时序 帧时间戳之间的间隔,与 1000 / fps ms 比较 每个文件的平均间隔、第 99 百分位间隔、最大间隔和慢帧数
亮度、清晰度、熵 平均灰度;拉普拉斯算子的方差;直方图熵 MBARI 的水下默认值,只是一个起点
运动 平均光流加上快速运动像素的占比 EgoVid-5M 的光流区间
手部姿态 逐关节的置信度,先看手腕 EgoDex:手腕置信度低意味着手指关节不可靠
相机间同步 每段录制开始和结束时的偏移 Ego-Exo4D:每台 GoPro 与 Aria RGB 相机相差在 1 帧以内
标定漂移 一对相机之间的对极残差 RoboCap:逐录制时段修正
隐私 在任何人观看素材之前人脸检测器的召回率 Claru 的指南:在留出数据集上召回率高于 98%
Quality-control checks at four levels Four columns of checks from the quality-control reference table, ordered from cheapest and most general to most specific. Every file, at offload and ingest: records decode, the manifest is complete, no episode is counted twice, and the gaps between frame timestamps match the frame rate. Every frame: cheap image metrics, brightness, sharpness as the variance of the Laplacian, and entropy to catch featureless frames. Every clip: a clarity score, motion from optical flow, hands in view and hand-pose confidence, wrist first. Every session: the sync offset at the start and end, the epipolar residual as a sign of calibration drift, and face-detector recall before anyone views footage. A note says thresholds are per source and must be set on your own footage. Every file at offload and ingest records decode manifest complete no episode counted twice frame-gap timing Every frame cheap image metrics brightness sharpness (variance of the Laplacian) entropy, to catch featureless frames Every clip content checks clarity score motion (optical flow) hands in view hand-pose confidence (wrist first) Every session rig health sync offset at start and end epipolar residual (calibration drift) face-detector recall Published thresholds belong to their own data: set yours on your own footage.
The checks in this page's reference table, grouped by what they run on: every file at ingest, every frame, every clip and every session. Cheap file and frame checks come first, so that expensive clip and session checks only see footage worth keeping. No published threshold transfers to your footage unchanged.

清晰度分数取决于分辨率、压缩和场景。MBARI 在它的水下素材上的典型范围是 20–100;一篇驾驶视频的论文把它的阈值定在 “usually”(意为:通常)300 到 1000 之间(质量控制)。一个数据集的数字不能照搬到另一个数据集。可以迁移的是 MBARI 的方法:在有代表性的素材上运行这些指标,查看百分位,选择一个档位(保守、适中或严格),然后检查 20–50 张被选中的帧并做调整(MBARI Triton)。每个站点、每种光照条件和每种设备都要抽样。

来源中提到的两个陷阱:

  • 不要把头部静止的片段筛掉。丢弃低光流的片段,会去掉那些头部静止而双手在做精细工作的片段;EgoVid-5M 在有足够多的像素快速运动时保留了低光流片段,并指出它们具有 “a static background while capturing detailed and extensive motion in hands”(意为:静止的背景,同时捕捉到手部细致而丰富的运动)(EgoVid-5M)。
  • 每段录制还要用眼睛看。Ego-1K 团队 “manually checked all videos and discarded 43 problematic recordings with dark images or an insufficient number of frames”(意为:人工检查了所有视频,丢弃了 43 段有问题的录制,它们图像过暗或帧数不足)(Ego-1K)。对每日复核,Claru 的指南建议抽查每天素材的 10–15%。另一家数据供应商 Unidata 给出了在操作员离开之前复核每个录制时段的理由:它 “catches systematic errors (camera drift, tracker disconnections, sync failures) before they compound across a full day”(意为:能在系统性错误(相机漂移、跟踪器断连、同步失败)累积一整天之前把它们抓住)(Unidata)。

同步和标定,每个录制时段都查

Section titled “同步和标定,每个录制时段都查”

时序和标定误差在单独一帧里不留痕迹(同步和标定检查)。Ego-Exo4D 在每次采集的开始和结束时向每台相机展示一个二维码时钟;两端都在一帧以内,就意味着全程都在一帧以内(Ego-Exo4D)。多相机采集设备会漂移:在 RoboCap 的设备队伍中,相机之间的旋转变化了 0.2–1.1°,RoboCap 每个录制时段重新估计一次,并且只有在修正改善了一个留出残差时才接受它(RoboCap)。课程 C201 和 C203 讲这些方法。

  • 隐私优先。Claru:“Run privacy processing BEFORE any annotation begins — annotators should never see unblurred faces.”(意为:在任何标注开始之前先做隐私处理,标注员绝不应该看到未模糊的人脸。)(Claru 指南)。素材里的旁观者从未同意被任何人看到,而一个标注手部动作的标注员需要的是手,不是脸;先模糊,能让看到这些脸的人数尽可能少(在入库时检测并模糊)。这些方法见匿名化,课程 C302。
  • 先做模糊筛选,再去重。Roychowdhury 和 Sato 警告说:“Altering the order of filtering or parallelizing the two processes may lead to uneven quality in retained/training data.”(意为:改变筛选的顺序或把这两个过程并行化,可能导致保留下来的数据或训练数据质量参差不齐。)(Video-Data Pipelines)。
  • 检查片段边界,以及片段与标签是否一致,如质量控制所述。

已发表的数据集采集设备都在本地录制。班次结束时,有人把录制从采集设备上复制下来,检查它们,并清空采集设备(班次结束时的导出)。

How recordings move from the rig to training storage Five steps left to right. One, record: the rig writes to its own storage with light lossless compression. Two, offload at the end of the shift over USB 3; RoboCap's paper gives 60 to 200 megabytes per second. Three, verify: check or checksum every file before the rig's copy is deleted. Four, upload from the site: raw and privacy-processed copies are stored apart with access controls, and the uplink is sized to the daily volume. Five, process centrally: quality control, time alignment, privacy processing and pose estimation, then tighter recompression and packaging into large shard files. Below, the uplink formula: required megabits per second equals daily gigabytes times 8,000, divided by the upload window in hours times 3,600, divided by the link efficiency. And a worked example from the page: at RoboCap's 10.8 gigabytes per rig-hour, an 8-hour day is 86.4 gigabytes, which takes 7.2 minutes to offload at 200 megabytes per second and 24 minutes at 60. 1. Record on the rig, to local storage, light lossless compression 2. Offload end of shift, over USB 3 (RoboCap: 60–200 MB/s) 3. Verify checksum or vrs check every file before wiping the rig 4. Upload raw and privacy copies kept apart; uplink sized to the day 5. Process QC, sync, privacy and pose; then recompress and pack into shards Uplink (Mbps) = daily GB × 8,000 / (upload window h × 3,600) / link efficiency Link efficiency is measured on your own line, not a constant. Worked example (RoboCap figures): 10.8 GB per rig-hour × 8 h = 86.4 GB a day Offload: 7.2 min at 200 MB/s, 24 min at 60 MB/s for each rig
How recordings move from the rig to training storage, step by step, with the page's uplink formula and its RoboCap worked example. Verifying every file before the rig is wiped is the step that protects the data; the uplink and the processing stage are where a growing fleet runs out of room.

导出时间。RoboCap 的导出是 “via USB 3 at 60–200 MB/s”(意为:通过 USB 3,速度为 60–200 MB/s)。按它的 24 Mbps(每小时 10.8 GB)计算,一个 8 小时的工作日是 86.4 GB:200 MB/s 时需要 7.2 分钟,60 MB/s 时需要 24 分钟。十套采集设备按较慢的速度一套接一套地导出,需要 4 小时。在你的试点中给一次导出计时。

删除之前先查完整性。在删除采集设备上的副本之前检查每一个文件。对 VRS,vrs check “decodes every record in the VRS file and prints how many records were decoded successfully”(意为:解码 VRS 文件中的每一条记录,并打印成功解码了多少条记录),vrs checksum 给出一个逻辑校验和,它在重新压缩之后仍然一致(VRS CLI tool)。对其他格式,在采集设备上的副本和暂存副本之间比较一个文件级的哈希值,例如 SHA-256。实验里给出了命令。

上行链路。一个站点需要的持续上传速率是(估算上行链路):

Required uplink (Mbps) = daily volume (GB) × 8,000 / (upload window (h) × 3,600) / link efficiency

在实测效率为 0.8 时,在 8 小时的窗口内发送 1 TB 需要约 347 Mbps 的持续速率。如果线路不能在一个窗口内清完一天的数据,积压就会每天增长。

原始副本和隐私处理副本。Claru 建议:“Store raw and privacy-processed versions separately with access controls. Delete raw versions after privacy verification”(意为:把原始版本和隐私处理后的版本分开存放,并设访问控制。隐私核验之后删除原始版本)。原始副本必须等到核验完成,因为模糊无法撤销:一张漏掉的人脸,或者盖在佩戴者手上的模糊,只能从原件重做(原始素材、隐私处理副本与存储分层)。于是原始素材的积压量取决于核验能跟上多快;至于你到底可不可以保留原始素材,由你的知情同意条款决定。

三种容器覆盖了大部分公开的第一人称采集(录制容器):MCAP,ROS 2 bag 的默认存储格式;VRS,Meta 的按设备划分的格式,Aria 眼镜使用它;以及 GPMF,GoPro 在 MP4 内部的遥测轨道。QC 之后,许多团队把 episode 重新打包成一种训练格式,例如 LeRobotDataset v3.0。

Inside MCAP, VRS and GPMF files Three file layouts side by side, top of file to bottom. MCAP: magic bytes, a header, then the data section holding schema and channel records and chunks; each chunk batches messages, each with log_time and publish_time, and is compressed with zstd or lz4; a message index follows each chunk; attachments, which can hold calibration, and metadata records sit outside chunks; a data end record; then a summary section with indexes and statistics, a summary offset section, a footer and the magic bytes again. VRS: file tags readable on open, then streams, each identified by a device type and instance such as 200-1 for a camera and 372-1 for motion data; each stream has tags and three record types, configuration, state and data, and the index is written last at the end of the file, so an interrupted recording can have it rebuilt. GPMF: an MP4 file with four tracks, video, audio, timecode and a meta track whose data format is gpmd; the telemetry is key-length-value items with four-character keys, a DEVC device block nesting STRM streams, sticky modifier keys such as SCAL, SIUN and TYPE, and sensor data such as ACCL and GYRO. MCAP VRS GPMF in a GoPro MP4 Magic + Header Data section Schema, Channel records Chunk (zstd / lz4)Messages: log_time, publish_timeMessage Index Chunk (zstd / lz4)Messages: log_time, publish_timeMessage Index Attachment (calibration), Metadata Data End record Summary: indexes, statistics Summary Offset, Footer, Magic File tags (read on open) Stream 200-1 (camera) stream tags Configuration records State records (often empty) Data records: images, IMU Stream 372-1 (motion) stream tags Configuration records State records (often empty) Data records: images, IMU Index, written last cut off? vrs fix-index rebuilds it MP4 tracks vide: video soun: audio tmcd: timecode meta: telemetry (gpmd) KLV: FourCC, type, size, repeat DEVC (device) STRM (stream) SCAL, SIUN, TYPE (sticky) ACCL samples STRM (stream) SCAL, SIUN, TYPE (sticky) GYRO samples lens model FOVL, readout SROT in global metadata
What is inside each file, top to bottom. MCAP batches timestamped messages into compressed chunks and writes indexes in a summary at the end. VRS keeps one stream per device, each with configuration, state and data records, and writes its index last, so a cut-off file can be repaired. A GoPro MP4 carries telemetry as a fourth track of nested key-length-value items. From the MCAP spec, the VRS docs and the gpmf-parser README.

如果你用两种格式发布同一批 episode,要说明这一点。Lightwheel 的卡片:“LeRobot and MCAP are alternative representations of the same episodes and must not be counted as additional hours”(意为:LeRobot 和 MCAP 是同一批 episode 的不同封装形式,不得算作额外的小时数)(EgoStandard)。把小时数记在文件清单里,这样一种封装形式永远不会被当作新数据来计算。

数据集说明书是一份规划文档,不是发布时的杂务。Gebru et al. 说,构成和采集两部分的问题要在 “prior to any data collection”(意为:任何数据采集之前)阅读,并在采集完成后作答(Datasheets for Datasets)。论文给出的尽早阅读采集部分问题的理由是 “to flag potential issues”(意为:标出潜在的问题):有些答案,例如知情同意的措辞或时序是怎样建立的,只能在数据采集的过程中记录下来。

When to read and answer each datasheet section A timeline of when to read and when to answer each of the seven Datasheets for Datasets sections (Gebru et al.), across five stages: plan, capture, process, release and after release. Motivation is answered while planning, before capture. Composition and Collection process are read while planning, before any data is collected, and answered once collection is complete. Preprocessing, cleaning and labelling is read before processing and answered after it. Uses and Distribution are answered before release. Maintenance is answered before release and kept up to date afterwards. So the datasheet is opened during planning, not after the last upload. plan capture process release after release Motivation Composition Collection process Preprocessing, labelling Uses Distribution Maintenance read the questions answer them keep updated
When Datasheets for Datasets (Gebru et al.) says to read and to answer each of its seven sections. Composition and Collection process are read before any data is collected and answered once collection is complete; Preprocessing, cleaning and labelling is read before processing and answered after; Uses, Distribution and Maintenance are answered before the dataset is distributed, and Maintenance stays current afterwards. Motivation is answered before capture, as in the table on this page. Open the datasheet while planning, not after the last upload.

实用指南的来源中有两条规则(为数据集撰写文档):“the process of creating a datasheet is not intended to be automated”(意为:创建数据集说明书的过程本意就不是要自动化的),以及已知的未知项也算数。Data Cards 的研究参与者说 “‘known unknowns’ were as important as known facets of the dataset in decision making”(意为:在决策中,“已知的未知项”与数据集的已知方面同样重要)(Data Cards):如果你没有在每个录制时段测量相机间的时间偏差,就照实说。一份第一人称数据集卡片必须写明采集设备、投影模型和标定所适用的分辨率,时序是怎样建立的,哪些标注层是预测值,以及知情同意和许可协议。

  1. 一个文件报告的平均帧率是 30 fps。为什么仍然要记录帧间隔,记录哪四个数字?
  2. 一位同事把 MBARI 的清晰度阈值 25 照搬进你的流程。你应该改为怎样做?
  3. 十套采集设备每套每天录制 86.4 GB,共用一台 60 MB/s 的暂存机。导出要多久,由此应该怎么办?
  4. 你的发布版把每个 episode 同时以 MCAP 和 LeRobot 两种格式提供。卡片必须说明什么?
  5. 数据集说明书中采集部分的问题应该在什么时候第一次阅读?
  1. 一个文件可以平均 30 fps,却仍然卡住或跳帧。记录平均间隔、第 99 百分位间隔、最大间隔和慢帧的数量。
  2. 在来自每个站点和每种设备的有代表性的素材上运行这个指标,读出百分位,选一个档位,检查 20–50 张被选中的帧并做调整。MBARI 的默认值是针对水下素材的。
  3. 一套接一套地导出约需 4 小时,依据是实用指南用 RoboCap 的数字做的算术。增加暂存机或用更快的链路,并在试点中计时。
  4. 说明它们是同一批 episode 的不同封装形式,不得算作额外的小时数。
  5. 在采集任何数据之前;它们在采集完成后作答。