完善 Autocal 多测点标定流程及会话复核
统一测点坐标、保持窗口和试验目录,补齐逐点初步分析。定向测试与真实视频闭环通过;两项轮询失败在修改前版本同样复现。
This commit is contained in:
@@ -147,6 +147,9 @@ class RecordConfig:
|
||||
#: ``preroll_bytes`` so a large frame does not turn into a large buffer.
|
||||
preroll_frames: int = 30
|
||||
preroll_bytes: int = 192 * 1024 * 1024
|
||||
#: Keep each delivered image for calibration. Container fps then describes
|
||||
#: nominal playback; frames.csv carries the actual acquisition timing.
|
||||
preserve_all_frames: bool = False
|
||||
|
||||
def as_dict(self) -> dict:
|
||||
return {
|
||||
@@ -159,6 +162,7 @@ class RecordConfig:
|
||||
"max_queue_bytes": int(self.max_queue_bytes),
|
||||
"preroll_frames": int(self.preroll_frames),
|
||||
"preroll_bytes": int(self.preroll_bytes),
|
||||
"preserve_all_frames": bool(self.preserve_all_frames),
|
||||
"lossy_note": (
|
||||
"MP4 is a lossy container: this is the pre-processing camera "
|
||||
"image, not a lossless record of the raw sensor data."
|
||||
@@ -346,13 +350,12 @@ class ExperimentRecorder:
|
||||
calibration_version: str = "",
|
||||
preroll=(),
|
||||
directory_label: str = "",
|
||||
directory_name: str = "",
|
||||
) -> Path:
|
||||
"""Create the experiment directory and start the writer thread."""
|
||||
if directory_label and (
|
||||
directory_label in {".", ".."}
|
||||
or not all(char.isalnum() or char in "-_" for char in directory_label)
|
||||
):
|
||||
raise ValueError("directory label must contain only letters, numbers, - or _")
|
||||
for value in (directory_label, directory_name):
|
||||
if value and not all(char.isalnum() or char in "-_" for char in value):
|
||||
raise ValueError("directory names must contain only letters, numbers, - or _")
|
||||
# A previous writer that has not reached a terminal state still owns the
|
||||
# files and the statistics; reusing it would silently mix two sessions.
|
||||
if self._thread is not None and self._thread.is_alive():
|
||||
@@ -370,7 +373,9 @@ class ExperimentRecorder:
|
||||
self.config = replace(config if config is not None else self.config)
|
||||
stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
|
||||
label = f"_{directory_label}" if directory_label else ""
|
||||
directory = Path(root) / f"{stamp}{label}_session{session_id:04d}_{uuid4().hex}"
|
||||
directory = Path(root) / (
|
||||
directory_name or f"{stamp}{label}_session{session_id:04d}_{uuid4().hex}"
|
||||
)
|
||||
try:
|
||||
directory.mkdir(parents=True, exist_ok=False)
|
||||
except Exception as exc: # noqa: BLE001 - reported to the caller
|
||||
@@ -599,7 +604,11 @@ class ExperimentRecorder:
|
||||
|
||||
A skipped frame is not lost data: every row is still in
|
||||
``frames.csv``/``forces.csv``, and the count is reported separately.
|
||||
Calibration may preserve every image instead and use the frame index's
|
||||
host timestamps for time alignment rather than container playback time.
|
||||
"""
|
||||
if self.config.preserve_all_frames:
|
||||
return True
|
||||
try:
|
||||
stamp = float(mono_t)
|
||||
except (TypeError, ValueError):
|
||||
|
||||
Reference in New Issue
Block a user