🔧 Bypass raw-human IMU coverage gate for part boundaries

This commit is contained in:
eust-w 2026-09-11 18:48:46 +08:00
parent 62b5737d71
commit ab725bf8a8
4 changed files with 50 additions and 6 deletions

View File

@ -177,7 +177,9 @@ def _validate_fallback_pair(path, paired, entries, source_path, output_dir, para
if raw_human:
if not paired.get("imu"):
raise RuntimeError("原始数据人工版缺少 IMU")
_validate_raw_imu(materialize(paired["imu"]), validation["startTimestampUs"], validation["endTimestampUs"])
# Temporarily bypass the raw-human IMU content/coverage gate: source
# sensor streams can cross part boundaries. Keep the paired IMU intact.
# _validate_raw_imu(materialize(paired["imu"]), validation["startTimestampUs"], validation["endTimestampUs"])
return validation

View File

@ -20,7 +20,7 @@
## 数据检查
沿用目录齐全/稳定性检查;新模式在进入人工前核验视频解码帧数、PTS 行数与递增、已有 meta 帧数、IMU 必需列与时间覆盖。不新增人工转码确认开关,不重写设备时间戳。两份标定原样进入交付。
沿用目录齐全/稳定性检查;新模式在进入人工前核验视频解码帧数、PTS 行数与递增、已有 meta 帧数,并保留同 part 的 IMU 文件匹配要求。按用户要求,暂时注释掉 raw-human 专属 IMU 内容/全覆盖校验调用,允许视频与 IMU 的 part 边界不完全重合;这不代表 IMU 已通过覆盖校验。不新增人工转码确认开关,不重写设备时间戳。两份标定原样进入交付。
## 发布

View File

@ -177,7 +177,9 @@ def _validate_fallback_pair(path, paired, entries, source_path, output_dir, para
if raw_human:
if not paired.get("imu"):
raise RuntimeError("原始数据人工版缺少 IMU")
_validate_raw_imu(materialize(paired["imu"]), validation["startTimestampUs"], validation["endTimestampUs"])
# Temporarily bypass the raw-human IMU content/coverage gate: source
# sensor streams can cross part boundaries. Keep the paired IMU intact.
# _validate_raw_imu(materialize(paired["imu"]), validation["startTimestampUs"], validation["endTimestampUs"])
return validation

View File

@ -20,6 +20,46 @@ def test_raw_profile_validates_original_files_without_modifying_them(tmp_path, m
assert result["sourceDurationSeconds"]==0.2
assert all((tmp_path/name).read_text()==text for name,text in contents.items())
assert op._validate_fallback_pair(name,pairs,entries,str(tmp_path),tmp_path,{}, {}) is None
(tmp_path/"capture_imu_part0001.csv").write_text("timestamp_us,x,y,z,type\n90,0,0,1,accel\n")
with pytest.raises(RuntimeError,match="未覆盖"):
op._validate_fallback_pair(name,pairs,entries,str(tmp_path),tmp_path,{"PROCESSING_PROFILE":"raw_human"},{})
@pytest.mark.parametrize("side", ["left", "right"])
def test_raw_profile_bypasses_imu_gate_for_real_part_boundary(tmp_path, monkeypatch, side):
name = f"capture_camera_{side}_part0006_silent_480p_wm.mp4"
pts_name = f"capture_camera_{side}_part0006_pts.csv"
imu_name = "capture_imu_part0006.csv"
# Real part0006 boundaries: last video frame extends 3.471/3.472 ms
# beyond this part's IMU. The next samples belong to part0007.
end = 5647003209 if side == "left" else 5647003210
contents = {
name: "video",
pts_name: f"timestamp_us\n4747034637\n{end}\n",
imu_name: "timestamp_us,x,y,z,type\n4747000287,0,0,1,accel\n4747000287,0,0,1,gyro\n5646999738,0,0,1,accel\n5646999738,0,0,1,gyro\n",
}
entries = []
for filename, text in contents.items():
path = tmp_path / filename
path.write_text(text)
entries.append({"path": filename, "source": {"path": str(path)}})
monkeypatch.setattr(op.subprocess, "run", lambda *a, **k: SimpleNamespace(
stdout='{"streams":[{"nb_read_frames":"2","duration":"900"}]}', stderr=""))
def unexpected_imu_validation(*args):
pytest.fail("raw-human IMU gate must remain bypassed")
monkeypatch.setattr(op, "_validate_raw_imu", unexpected_imu_validation)
pairs = op._paired_files(name, entries)
validate = lambda: op._validate_fallback_pair(
name, pairs, entries, str(tmp_path), tmp_path, {"PROCESSING_PROFILE": "raw_human"}, {})
assert validate()["endTimestampUs"] == end
assert all((tmp_path / filename).read_text() == text for filename, text in contents.items())
# Bypassing the IMU gate must not bypass video/PTS alignment or required inputs.
(tmp_path / pts_name).write_text(f"timestamp_us\n4747034637\n5000000000\n{end}\n")
with pytest.raises(RuntimeError, match="视频与 PTS 数量不一致"):
validate()
(tmp_path / pts_name).write_text("timestamp_us\n4747034637\n4747034637\n")
with pytest.raises(RuntimeError, match="未严格递增"):
validate()
(tmp_path / pts_name).write_text(contents[pts_name])
pairs["imu"] = ""
with pytest.raises(RuntimeError, match="缺少 IMU"):
validate()