feat(perception): prewarm RF-DETR before source admission
This commit is contained in:
@@ -24,6 +24,7 @@ from k1link.perception.contracts import MotionState, ObjectProposal2D
|
||||
from k1link.perception.detector import (
|
||||
DetectorFrameTiming,
|
||||
DetectorProviderSnapshot,
|
||||
DetectorWarmupSnapshot,
|
||||
RfDetrShadowDetectorProvider,
|
||||
)
|
||||
from k1link.perception.geometry import Ravnoves00GeometryAssociationProvider
|
||||
@@ -51,7 +52,7 @@ from k1link.perception.reference_graph_runtime import ReferenceGraphRuntimePaths
|
||||
from k1link.perception.rolling_map import RollingLocalObstacleMapProvider
|
||||
from k1link.perception.temporal import BoundedSpatialTemporalProvider
|
||||
|
||||
SCHEMA_VERSION: Final = "missioncore.m48s-reference-graph-shadow-load/v2"
|
||||
SCHEMA_VERSION: Final = "missioncore.m48s-reference-graph-shadow-load/v3"
|
||||
FRAME_EVIDENCE_SCHEMA: Final = "missioncore.m48s-reference-graph-frame-evidence/v1"
|
||||
PIPELINE_TIMING_SCHEMA: Final = "missioncore.m48s-frame-pipeline-timing/v0"
|
||||
GC_POLICY_SCHEMA: Final = "missioncore.cyclic-gc-hot-loop-policy/v0"
|
||||
@@ -443,6 +444,7 @@ def main() -> int:
|
||||
gc_telemetry,
|
||||
),
|
||||
)
|
||||
detector_warmup = runtime.warm_up_detector()
|
||||
gc_policy = CyclicGcHotLoopPolicy()
|
||||
with gc_policy:
|
||||
loop_started_ns = time.monotonic_ns()
|
||||
@@ -496,6 +498,7 @@ def main() -> int:
|
||||
wall_seconds=loop_wall_seconds,
|
||||
setup_seconds=setup_seconds,
|
||||
gc_policy=gc_policy.to_dict(),
|
||||
detector_warmup=detector_warmup,
|
||||
)
|
||||
loop_documents.append(loop_document)
|
||||
completion_ages_ms.extend(value / 1_000_000.0 for value in loop_completion_ages_ns)
|
||||
@@ -578,6 +581,11 @@ def main() -> int:
|
||||
is cast(dict[str, object], loop["cyclic_gc_hot_loop"])["enabled_after"]
|
||||
for loop in loop_documents
|
||||
),
|
||||
"detector_warmup_completed_before_source_admission": all(
|
||||
cast(dict[str, object], loop["detector_warmup"])["completed"] is True
|
||||
and cast(dict[str, object], loop["detector_warmup"])["inference_passes"] == 1
|
||||
for loop in loop_documents
|
||||
),
|
||||
"authority_remains_false": all(value is False for value in AUTHORITY.values()),
|
||||
}
|
||||
integrated_runtime_gate_passed = all(checks.values())
|
||||
@@ -604,6 +612,10 @@ def main() -> int:
|
||||
"terminal_outcomes": dict(sorted(accounting.items())),
|
||||
"queue_high_watermarks": queue_high_watermarks,
|
||||
"loops": loop_documents,
|
||||
"startup_warmup_inference_passes": sum(
|
||||
cast(int, cast(dict[str, object], loop["detector_warmup"])["inference_passes"])
|
||||
for loop in loop_documents
|
||||
),
|
||||
"frame_evidence": {
|
||||
"schema_version": FRAME_EVIDENCE_SCHEMA,
|
||||
"path": frame_ledger.name,
|
||||
@@ -690,6 +702,7 @@ def _loop_document(
|
||||
wall_seconds: float,
|
||||
setup_seconds: float,
|
||||
gc_policy: dict[str, object],
|
||||
detector_warmup: DetectorWarmupSnapshot,
|
||||
) -> dict[str, object]:
|
||||
outcomes = Counter(item.outcome.value for item in result.terminal_outcomes)
|
||||
outcome_stages = Counter(
|
||||
@@ -701,6 +714,7 @@ def _loop_document(
|
||||
"wall_seconds": round(wall_seconds, 6),
|
||||
"setup_seconds": round(setup_seconds, 6),
|
||||
"cyclic_gc_hot_loop": gc_policy,
|
||||
"detector_warmup": asdict(detector_warmup),
|
||||
"admitted_count": result.admitted_count,
|
||||
"delivered_count": len(result.deliveries),
|
||||
"effective_world_state_fps": round(len(result.deliveries) / wall_seconds, 6),
|
||||
|
||||
Reference in New Issue
Block a user