feat(perception): add camera ego-motion evidence
This commit is contained in:
@@ -35,6 +35,7 @@ from .jobs import (
|
||||
validate_camera_compute_job,
|
||||
)
|
||||
from .lab_instances import (
|
||||
PublishedCameraEgoMotionLabInstance,
|
||||
PublishedIntegratedLabInstance,
|
||||
PublishedPersistentSupportLabInstance,
|
||||
PublishedTemporalLabInstance,
|
||||
@@ -44,6 +45,7 @@ from .lab_instances import (
|
||||
publish_e23_lab_instance,
|
||||
publish_e24_lab_instance,
|
||||
publish_e25_lab_instance,
|
||||
publish_e26_lab_instance,
|
||||
publish_integrated_lab_instance,
|
||||
)
|
||||
from .live_perception import (
|
||||
@@ -122,6 +124,7 @@ __all__ = [
|
||||
"LivePerceptionIngress",
|
||||
"IntegratedPerceptionOverlayStore",
|
||||
"PublishedIntegratedLabInstance",
|
||||
"PublishedCameraEgoMotionLabInstance",
|
||||
"PublishedPersistentSupportLabInstance",
|
||||
"PublishedTemporalLabInstance",
|
||||
"PublishedWorldMotionLabInstance",
|
||||
@@ -158,6 +161,7 @@ __all__ = [
|
||||
"publish_e23_lab_instance",
|
||||
"publish_e24_lab_instance",
|
||||
"publish_e25_lab_instance",
|
||||
"publish_e26_lab_instance",
|
||||
"publish_integrated_lab_instance",
|
||||
"validate_multirate_perception_qualification_result",
|
||||
"prepare_recorded_qualification_slice",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,10 @@ from k1link.sessions import (
|
||||
publish_lab_replay_cache,
|
||||
)
|
||||
|
||||
from .camera_ego_motion import (
|
||||
CameraEgoMotionBuild,
|
||||
build_camera_ego_motion_result,
|
||||
)
|
||||
from .inline_temporal import StreamingSemanticStabilizer, read_inline_profile
|
||||
from .integrated_perception import (
|
||||
IntegratedPerceptionResult,
|
||||
@@ -71,6 +75,14 @@ class PublishedPersistentSupportLabInstance:
|
||||
build: PersistentSupportBuild
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class PublishedCameraEgoMotionLabInstance:
|
||||
binding: LabSessionBinding
|
||||
job: CameraComputeJob
|
||||
result: IntegratedPerceptionResult
|
||||
build: CameraEgoMotionBuild
|
||||
|
||||
|
||||
def publish_integrated_lab_instance(
|
||||
*,
|
||||
repository_root: Path,
|
||||
@@ -709,6 +721,144 @@ def publish_e25_lab_instance(
|
||||
)
|
||||
|
||||
|
||||
def publish_e26_lab_instance(
|
||||
*,
|
||||
repository_root: Path,
|
||||
lidar_result_root: Path,
|
||||
camera_result_root: Path,
|
||||
profile_path: Path,
|
||||
benchmark_path: Path,
|
||||
lab_session_id: str,
|
||||
lab_id: str,
|
||||
display_name: str,
|
||||
) -> PublishedCameraEgoMotionLabInstance:
|
||||
"""Derive and publish one bounded camera/ego-motion evidence LAB run."""
|
||||
|
||||
root = repository_root.expanduser().resolve(strict=True)
|
||||
jobs_root = root / ".runtime" / "compute-jobs"
|
||||
results_root = root / ".runtime" / "compute-experiments" / "e10" / "worker-results"
|
||||
packs_root = root / ".runtime" / "compute-experiments" / "e10" / "lidar-packs"
|
||||
|
||||
def source(path: Path, label: str) -> IntegratedPerceptionResult:
|
||||
resolved = path.expanduser().resolve(strict=True)
|
||||
document = _read_object(resolved / "result.json", resolved)
|
||||
identity = document.get("identity")
|
||||
if not isinstance(identity, dict) or not isinstance(identity.get("job_id"), str):
|
||||
raise SessionIntegrityError(f"E26 {label} source has no job identity")
|
||||
validated = validate_integrated_perception_result(
|
||||
jobs_root / identity["job_id"],
|
||||
resolved,
|
||||
packs_root,
|
||||
)
|
||||
if not validated.accepted:
|
||||
raise SessionIntegrityError(f"E26 {label} source result is not accepted")
|
||||
return validated
|
||||
|
||||
lidar_source = source(lidar_result_root, "LiDAR")
|
||||
camera_source = source(camera_result_root, "camera")
|
||||
if lidar_source.job.source_id != camera_source.job.source_id:
|
||||
raise SessionIntegrityError("E26 source camera identities differ")
|
||||
|
||||
lab_job = _publish_lab_job(lidar_source.job, jobs_root, lab_session_id)
|
||||
lab_pack = _publish_lab_pack(
|
||||
lidar_source,
|
||||
lab_job,
|
||||
packs_root,
|
||||
lab_session_id,
|
||||
)
|
||||
build = build_camera_ego_motion_result(
|
||||
lidar_source=lidar_source,
|
||||
camera_source=camera_source,
|
||||
lab_job=lab_job,
|
||||
lab_pack=lab_pack,
|
||||
results_root=results_root,
|
||||
profile_path=profile_path,
|
||||
benchmark_path=benchmark_path,
|
||||
)
|
||||
validated = validate_integrated_perception_result(
|
||||
lab_job.job_root,
|
||||
build.result_root,
|
||||
packs_root,
|
||||
)
|
||||
if not validated.accepted:
|
||||
failed = [
|
||||
name
|
||||
for name, accepted in build.report["acceptance"]["checks"].items()
|
||||
if not accepted
|
||||
]
|
||||
raise SessionIntegrityError(
|
||||
f"E26 camera/ego-motion artifact acceptance failed: {', '.join(failed)}"
|
||||
)
|
||||
|
||||
store = SessionStore(root)
|
||||
source_lab = store.get_lab_instance(lidar_source.job.session_id)
|
||||
source_session_id = (
|
||||
lidar_source.job.session_id
|
||||
if source_lab is None
|
||||
else source_lab.source_session_id
|
||||
)
|
||||
publish_lab_replay_cache(
|
||||
store.data_dir,
|
||||
source_session_id=source_session_id,
|
||||
lab_session_id=lab_session_id,
|
||||
timeline_start_ns=round(
|
||||
validated.timeline_start_seconds * 1_000_000_000
|
||||
),
|
||||
timeline_end_ns=round(
|
||||
validated.timeline_end_seconds * 1_000_000_000
|
||||
),
|
||||
)
|
||||
metrics = build.report["metrics"]
|
||||
binding = store.publish_lab_instance(
|
||||
session_id=lab_session_id,
|
||||
source_session_id=source_session_id,
|
||||
display_name=display_name,
|
||||
lab_id=lab_id,
|
||||
result_kind="e26-camera-ego-motion-fusion",
|
||||
result_id=validated.result_id,
|
||||
source_result_id=lidar_source.result_id,
|
||||
config_sha256=build.profile_sha256,
|
||||
run_created_at_utc=validated.created_at_utc,
|
||||
duration_seconds=(
|
||||
validated.timeline_end_seconds
|
||||
- validated.timeline_start_seconds
|
||||
),
|
||||
include_recorded_media=False,
|
||||
provenance={
|
||||
"schema_version": "missioncore.e26-lab-publication/v1",
|
||||
"storage_mode": (
|
||||
"bounded-camera-ego-motion-and-immutable-lidar-source-replay"
|
||||
),
|
||||
"source_result_id": lidar_source.result_id,
|
||||
"camera_source_result_id": camera_source.result_id,
|
||||
"source_lab_session_id": (
|
||||
None if source_lab is None else source_lab.session_id
|
||||
),
|
||||
"source_payloads_mutated": False,
|
||||
"coordinate_frame": "k1-map",
|
||||
"camera_measurement": "kb4-multiview-static-world-hypothesis",
|
||||
"metric_measurement": "e25-persistent-lidar-support",
|
||||
"lookahead_frames": 0,
|
||||
"benchmark_sha256": build.benchmark_sha256,
|
||||
"benchmark_passed": metrics["benchmark"]["passed"],
|
||||
"benchmark_passed_events": metrics["benchmark"]["passed_events"],
|
||||
"benchmark_total_events": metrics["benchmark"]["total_events"],
|
||||
"camera_ego_motion_processing_p95_ms": metrics["runtime"][
|
||||
"camera_ego_motion_frame_processing_ms"
|
||||
]["p95"],
|
||||
"peak_tracks": metrics["runtime"]["peak_tracks"],
|
||||
"camera_only_metric_velocity_valid": False,
|
||||
"navigation_or_safety_accepted": False,
|
||||
},
|
||||
)
|
||||
return PublishedCameraEgoMotionLabInstance(
|
||||
binding=binding,
|
||||
job=lab_job,
|
||||
result=validated,
|
||||
build=build,
|
||||
)
|
||||
|
||||
|
||||
def _validate_e23_inputs(
|
||||
worker_root: Path,
|
||||
source_report_path: Path,
|
||||
|
||||
Reference in New Issue
Block a user