@trillboards/edge-sdk 0.2.245 → 0.2.253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deploy/detector/bench/detect_frames.py +88 -0
- package/deploy/detector/bench/openvino_parity.py +152 -0
- package/deploy/detector/pyproject.toml +10 -1
- package/deploy/detector/tests/test_actor_tracking.py +168 -0
- package/deploy/detector/tests/test_actor_tracking_wire.py +22 -0
- package/deploy/detector/tests/test_loader.py +25 -0
- package/deploy/detector/tests/test_openvino_engines.py +251 -0
- package/deploy/detector/tests/test_registry.py +53 -0
- package/deploy/detector/tests/test_server.py +43 -0
- package/deploy/detector/tests/test_version_stamp.py +17 -4
- package/deploy/detector/trillboards_detector/_version.py +2 -2
- package/deploy/detector/trillboards_detector/actor_tracking.py +139 -2
- package/deploy/detector/trillboards_detector/cli.py +5 -0
- package/deploy/detector/trillboards_detector/detections.py +5 -0
- package/deploy/detector/trillboards_detector/execution.py +386 -0
- package/deploy/detector/trillboards_detector/loader.py +40 -1
- package/deploy/detector/trillboards_detector/registry.py +33 -1
- package/deploy/detector/trillboards_detector/server.py +43 -1
- package/deploy/detector/trillboards_detector/session.py +81 -3
- package/deploy/detector/trillboards_detector/track_records.py +113 -0
- package/deploy/windows/build-windows.ps1 +1 -0
- package/deploy/windows/ci/test-detector-looks-field.ps1 +15 -3
- package/deploy/windows/ci/test-detector-reinstall.ps1 +645 -0
- package/deploy/windows/ci/test-rollout-proofs.ps1 +3 -2
- package/deploy/windows/ensure-detector.ps1 +255 -0
- package/deploy/windows/install-update.ps1 +4 -3
- package/deploy/windows/setup-detector.ps1 +122 -29
- package/deploy/windows/stop-existing.ps1 +1 -0
- package/deploy/windows/trillboards-edge.cmd +10 -22
- package/dist/ActorTracking.d.ts +38 -0
- package/dist/ActorTracking.d.ts.map +1 -1
- package/dist/ActorTracking.js +40 -0
- package/dist/ActorTracking.js.map +1 -1
- package/dist/AlertClips.d.ts +4 -2
- package/dist/AlertClips.d.ts.map +1 -1
- package/dist/AlertClips.js +24 -9
- package/dist/AlertClips.js.map +1 -1
- package/dist/CloudSensingManager.d.ts +9 -0
- package/dist/CloudSensingManager.d.ts.map +1 -1
- package/dist/CloudSensingManager.js +52 -4
- package/dist/CloudSensingManager.js.map +1 -1
- package/dist/ConnectorStatusClient.d.ts +8 -0
- package/dist/ConnectorStatusClient.d.ts.map +1 -1
- package/dist/ConnectorStatusClient.js +3 -0
- package/dist/ConnectorStatusClient.js.map +1 -1
- package/dist/DurableVlmCandidateSpool.d.ts +11 -0
- package/dist/DurableVlmCandidateSpool.d.ts.map +1 -1
- package/dist/DurableVlmCandidateSpool.js +31 -2
- package/dist/DurableVlmCandidateSpool.js.map +1 -1
- package/dist/EdgeAgent.js +1 -1
- package/dist/FrameGroupingShadow.d.ts +57 -0
- package/dist/FrameGroupingShadow.d.ts.map +1 -1
- package/dist/FrameGroupingShadow.js +123 -5
- package/dist/FrameGroupingShadow.js.map +1 -1
- package/dist/LocalDetectorClient.d.ts +44 -1
- package/dist/LocalDetectorClient.d.ts.map +1 -1
- package/dist/LocalDetectorClient.js +88 -4
- package/dist/LocalDetectorClient.js.map +1 -1
- package/dist/LocalVideoBuffer.d.ts +14 -2
- package/dist/LocalVideoBuffer.d.ts.map +1 -1
- package/dist/LocalVideoBuffer.js +23 -3
- package/dist/LocalVideoBuffer.js.map +1 -1
- package/dist/NativeReadiness.d.ts +21 -2
- package/dist/NativeReadiness.d.ts.map +1 -1
- package/dist/NativeReadiness.js +25 -6
- package/dist/NativeReadiness.js.map +1 -1
- package/dist/OrderedReviewClient.d.ts +3 -0
- package/dist/OrderedReviewClient.d.ts.map +1 -1
- package/dist/OrderedReviewClient.js +3 -0
- package/dist/OrderedReviewClient.js.map +1 -1
- package/dist/SensingProfileClient.d.ts.map +1 -1
- package/dist/SensingProfileClient.js +3 -0
- package/dist/SensingProfileClient.js.map +1 -1
- package/dist/TemporalReviewClient.d.ts +3 -0
- package/dist/TemporalReviewClient.d.ts.map +1 -1
- package/dist/TemporalReviewClient.js +3 -0
- package/dist/TemporalReviewClient.js.map +1 -1
- package/dist/VideoSegmentUploader.d.ts +14 -7
- package/dist/VideoSegmentUploader.d.ts.map +1 -1
- package/dist/VideoSegmentUploader.js +34 -38
- package/dist/VideoSegmentUploader.js.map +1 -1
- package/dist/VlmCandidateBuffer.d.ts +13 -0
- package/dist/VlmCandidateBuffer.d.ts.map +1 -1
- package/dist/VlmCandidateBuffer.js.map +1 -1
- package/dist/autoSense.d.ts +4 -0
- package/dist/autoSense.d.ts.map +1 -1
- package/dist/autoSense.js +7 -0
- package/dist/autoSense.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/connectorUpdate.d.ts +18 -9
- package/dist/connectorUpdate.d.ts.map +1 -1
- package/dist/connectorUpdate.js +66 -3
- package/dist/connectorUpdate.js.map +1 -1
- package/dist/connectorUpdateApply.d.ts +20 -1
- package/dist/connectorUpdateApply.d.ts.map +1 -1
- package/dist/connectorUpdateApply.js +55 -1
- package/dist/connectorUpdateApply.js.map +1 -1
- package/dist/connectorUpdateApplyMac.d.ts +3 -1
- package/dist/connectorUpdateApplyMac.d.ts.map +1 -1
- package/dist/connectorUpdateApplyMac.js +6 -0
- package/dist/connectorUpdateApplyMac.js.map +1 -1
- package/dist/continuousReview.d.ts +6 -2
- package/dist/continuousReview.d.ts.map +1 -1
- package/dist/continuousReview.js.map +1 -1
- package/dist/detectorBackendRelay.d.ts +24 -0
- package/dist/detectorBackendRelay.d.ts.map +1 -0
- package/dist/detectorBackendRelay.js +70 -0
- package/dist/detectorBackendRelay.js.map +1 -0
- package/dist/detectorEndpointState.d.ts +30 -0
- package/dist/detectorEndpointState.d.ts.map +1 -0
- package/dist/detectorEndpointState.js +125 -0
- package/dist/detectorEndpointState.js.map +1 -0
- package/dist/detectorLauncher.d.ts +23 -0
- package/dist/detectorLauncher.d.ts.map +1 -0
- package/dist/detectorLauncher.js +94 -0
- package/dist/detectorLauncher.js.map +1 -0
- package/dist/diagnose.d.ts +1 -1
- package/dist/diagnose.js +1 -1
- package/dist/localSensing.d.ts +72 -0
- package/dist/localSensing.d.ts.map +1 -1
- package/dist/localSensing.js +280 -31
- package/dist/localSensing.js.map +1 -1
- package/dist/pipelineSwitches.d.ts +59 -0
- package/dist/pipelineSwitches.d.ts.map +1 -0
- package/dist/pipelineSwitches.js +240 -0
- package/dist/pipelineSwitches.js.map +1 -0
- package/package.json +4 -4
- package/retained/ProfileAuthorityClient.cjs +4 -0
- package/retained/RetainedCaptureClient.cjs +41 -2
- package/retained/WebsiteAdmissionCaptureClient.cjs +57 -2
- package/retained/__tests__/look-reuse.test.cjs +167 -0
- package/retained/manager.cjs +28 -2
|
@@ -33,7 +33,7 @@ from .decode import (
|
|
|
33
33
|
)
|
|
34
34
|
from .detections import Detection, DetectionBatch
|
|
35
35
|
from .errors import ModelContractError
|
|
36
|
-
from .execution import LocalOrtSession
|
|
36
|
+
from .execution import DetectorEngines, LocalOrtSession
|
|
37
37
|
from .labels import (ClassIndex, ModelVocabulary, PIL_IMAGENET_STRETCH, RGB_HALF_PIXEL_IMAGENET,
|
|
38
38
|
BGR_BYTES_STRETCH, YOLO_LETTERBOX, resolve_input_preprocessing)
|
|
39
39
|
|
|
@@ -383,6 +383,7 @@ class OnnxDetector:
|
|
|
383
383
|
vocabulary: ModelVocabulary,
|
|
384
384
|
intra_op_threads: "int | None" = None,
|
|
385
385
|
accelerator: str = "auto",
|
|
386
|
+
backend_policy=None,
|
|
386
387
|
):
|
|
387
388
|
self.model_path = model_path
|
|
388
389
|
self.vocabulary = vocabulary
|
|
@@ -406,6 +407,16 @@ class OnnxDetector:
|
|
|
406
407
|
self._session = LocalOrtSession(ort, model_bytes, opts, accelerator)
|
|
407
408
|
del model_bytes
|
|
408
409
|
self.spec = _read_graph_spec(self._session, vocabulary)
|
|
410
|
+
# Plan v7 W8: an RF-DETR graph may also run on OpenVINO (CPU, and the
|
|
411
|
+
# integrated GPU), each only after its parity probe against ORT passed on
|
|
412
|
+
# this host. Under the default policy ("ort") nothing else is built and
|
|
413
|
+
# every frame runs exactly as before. Other layouts stay on ORT.
|
|
414
|
+
self._engines = None
|
|
415
|
+
if backend_policy is not None and self.spec.output_layout == RFDETR_DETS_LABELS:
|
|
416
|
+
self._engines = DetectorEngines(self._session, self._verified_model_bytes, backend_policy,
|
|
417
|
+
self._compare_outputs, threads=intra_op_threads)
|
|
418
|
+
person = [slot for slot, name in vocabulary.slot_names.items() if name == "person"]
|
|
419
|
+
self._person_slot = person[0] if person else None
|
|
409
420
|
|
|
410
421
|
def detect(
|
|
411
422
|
self,
|
|
@@ -428,11 +439,19 @@ class OnnxDetector:
|
|
|
428
439
|
input_preprocessing=self.spec.preprocessing,
|
|
429
440
|
)
|
|
430
441
|
|
|
431
|
-
|
|
442
|
+
engine = None
|
|
443
|
+
if self._engines is not None:
|
|
432
444
|
infer_started = time.perf_counter()
|
|
433
|
-
outputs = self.
|
|
445
|
+
outputs, engine = self._engines.run(list(self.spec.output_names), {self.spec.input_name: blob},
|
|
446
|
+
min_confidence=min_confidence)
|
|
434
447
|
self.spec.providers = list(self._session.get_providers())
|
|
435
448
|
infer_ms = (time.perf_counter() - infer_started) * 1000.0
|
|
449
|
+
else:
|
|
450
|
+
with self._lock:
|
|
451
|
+
infer_started = time.perf_counter()
|
|
452
|
+
outputs = self._session.run(list(self.spec.output_names), {self.spec.input_name: blob})
|
|
453
|
+
self.spec.providers = list(self._session.get_providers())
|
|
454
|
+
infer_ms = (time.perf_counter() - infer_started) * 1000.0
|
|
436
455
|
|
|
437
456
|
if layout == RFDETR_DETS_LABELS:
|
|
438
457
|
batch = postprocess(
|
|
@@ -463,12 +482,71 @@ class OnnxDetector:
|
|
|
463
482
|
batch.inference_ms = infer_ms
|
|
464
483
|
batch.total_ms = (time.perf_counter() - started) * 1000.0
|
|
465
484
|
batch.model_hashes = {self.model_name: self.model_sha256}
|
|
485
|
+
if engine is not None:
|
|
486
|
+
batch.engine = engine
|
|
466
487
|
return batch
|
|
467
488
|
|
|
468
489
|
@property
|
|
469
490
|
def acceleration(self):
|
|
470
491
|
return self._session.acceleration
|
|
471
492
|
|
|
493
|
+
def backend_snapshot(self):
|
|
494
|
+
"""The `/health` engine view (plan v7 W8), or None for a model that runs on ORT only."""
|
|
495
|
+
return self._engines.snapshot() if self._engines is not None else None
|
|
496
|
+
|
|
497
|
+
def _verified_model_bytes(self) -> bytes:
|
|
498
|
+
"""The artifact ORT loaded, re-read and re-hashed: an OTA that replaced the
|
|
499
|
+
file since must not hand OpenVINO a different model under the same name."""
|
|
500
|
+
data = Path(self.model_path).read_bytes()
|
|
501
|
+
if hashlib.sha256(data).hexdigest() != self.model_sha256:
|
|
502
|
+
raise ModelContractError("the model file changed since ORT loaded it; OpenVINO not built")
|
|
503
|
+
return data
|
|
504
|
+
|
|
505
|
+
def _compare_outputs(self, reference, candidate) -> dict:
|
|
506
|
+
"""Grade one frame's candidate-engine outputs against ORT's (plan v7 W8).
|
|
507
|
+
|
|
508
|
+
Measured on the shipped artifact and Texas frames (2026-11-16): OpenVINO and ORT
|
|
509
|
+
agree on every query a detection floor of 0.2 or more can keep (person diff
|
|
510
|
+
<= 6.5e-4), and differ on rare sub-0.2 queries (one by 0.088 on 60 frames), so
|
|
511
|
+
parity is graded where detections live:
|
|
512
|
+
|
|
513
|
+
`person_diff`: the largest person-probability gap over queries either engine
|
|
514
|
+
scores at or above PARITY_FLOOR. `score_diff`: the same over every class.
|
|
515
|
+
`mismatches`: (query, class) pairs kept at an operating threshold
|
|
516
|
+
(OPERATING_THRESHOLDS) by one engine and not the other, selected exactly as
|
|
517
|
+
`postprocess` selects. `box_shift`: the largest box-coordinate gap among pairs
|
|
518
|
+
both keep, as a fraction of the frame.
|
|
519
|
+
"""
|
|
520
|
+
ref_boxes, ref_logits = reference
|
|
521
|
+
cand_boxes, cand_logits = candidate
|
|
522
|
+
p_ref = _sigmoid(np.asarray(ref_logits)[0])
|
|
523
|
+
p_cand = _sigmoid(np.asarray(cand_logits)[0])
|
|
524
|
+
live = (p_ref >= PARITY_FLOOR) | (p_cand >= PARITY_FLOOR)
|
|
525
|
+
diff = np.where(live, np.abs(p_ref - p_cand), 0.0)
|
|
526
|
+
person = getattr(self, "_person_slot", None)
|
|
527
|
+
person_diff = float(diff[:, person].max()) if person is not None else float(diff.max())
|
|
528
|
+
mismatches, box_shift = 0, 0.0
|
|
529
|
+
n_classes = p_ref.shape[1]
|
|
530
|
+
rb, cb = np.asarray(ref_boxes)[0], np.asarray(cand_boxes)[0]
|
|
531
|
+
for threshold in OPERATING_THRESHOLDS:
|
|
532
|
+
kept = []
|
|
533
|
+
for prob in (p_ref, p_cand):
|
|
534
|
+
flat = prob.reshape(-1)
|
|
535
|
+
order = np.argsort(-flat, kind="stable")[:NUM_SELECT]
|
|
536
|
+
kept.append({int(i) for i in order[flat[order] > threshold]})
|
|
537
|
+
mismatches += len(kept[0] ^ kept[1])
|
|
538
|
+
for index in kept[0] & kept[1]:
|
|
539
|
+
query = index // n_classes
|
|
540
|
+
box_shift = max(box_shift, float(np.abs(rb[query] - cb[query]).max()))
|
|
541
|
+
return {"person_diff": person_diff, "score_diff": float(diff.max()), "mismatches": mismatches,
|
|
542
|
+
"box_shift": box_shift}
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
#: Where the parity probe grades scores: no shipped request asks below it and OpenVINO serves.
|
|
546
|
+
PARITY_FLOOR = 0.2
|
|
547
|
+
#: The thresholds the connector counts at: its detection floor, the cascade gate, the counts.
|
|
548
|
+
OPERATING_THRESHOLDS = (0.25, 0.2939, 0.5)
|
|
549
|
+
|
|
472
550
|
|
|
473
551
|
def _read_graph_spec(
|
|
474
552
|
session: "ort.InferenceSession",
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""Per-track records: what the journal knows about each live actor, beside its identity.
|
|
2
|
+
|
|
3
|
+
ActorTrackerJournal assigns identities. A TrackRecord is the running record one
|
|
4
|
+
identity carries while it is live on one camera: when it was first and last
|
|
5
|
+
OBSERVED (capture time; a predicted box is never an observation), how many frames
|
|
6
|
+
observed it, its newest observed box and score, and one reserved slot for a face
|
|
7
|
+
vector. It is the per-track cache later work reads instead of re-deriving state
|
|
8
|
+
from the frame journal (plan v7 W8 decision, 2026-11-16).
|
|
9
|
+
|
|
10
|
+
Lifetime. A record is written in the same SQLite transaction as the frame that
|
|
11
|
+
observed its actor and deleted in the transaction that ends that actor (listed in
|
|
12
|
+
`endedActors`, or left behind by a new motion epoch). So a record never outlives
|
|
13
|
+
its track, a restart keeps it (it is committed, not cached), and a camera holds at
|
|
14
|
+
most MAX_RECORDS_PER_CAMERA of them.
|
|
15
|
+
|
|
16
|
+
The face slot. Empty everywhere today. Its one intended writer is the face
|
|
17
|
+
watchlist (plan v7 T1), through ActorTrackerJournal.record_face, which stores one
|
|
18
|
+
FaceSlot on a LIVE actor's record and refuses an ended or unknown actor. The face
|
|
19
|
+
vector therefore drops with the track it was read from; nothing here persists a
|
|
20
|
+
face beyond its track. Nothing in this module computes a face vector.
|
|
21
|
+
|
|
22
|
+
Wire (version 1), served as `tracks` beside `tracking` on a tracked /detect
|
|
23
|
+
response, one object per live actor of the camera, oldest first:
|
|
24
|
+
|
|
25
|
+
{"version": 1, "actorId": "pa_...", "kind": "person", "epoch": "te_...",
|
|
26
|
+
"firstSeenAtMs": int, "lastSeenAtMs": int, "frames": int,
|
|
27
|
+
"box": {"x", "y", "width", "height"}, # newest observed box, original-frame pixels
|
|
28
|
+
"confidence": float, # newest observed detector score
|
|
29
|
+
"face": null | {"modelId", "modelSha256", "dims", "vector": [float],
|
|
30
|
+
"frameId", "capturedAtMs", "quality"}}
|
|
31
|
+
|
|
32
|
+
Consumers: src/ActorTracking.ts parseActorTrackRecords (TypeScript twin of this
|
|
33
|
+
shape) and LocalDetectorClient.detect -> DetectResult.tracks.
|
|
34
|
+
"""
|
|
35
|
+
from __future__ import annotations
|
|
36
|
+
|
|
37
|
+
import math
|
|
38
|
+
import re
|
|
39
|
+
from dataclasses import dataclass
|
|
40
|
+
from typing import Optional
|
|
41
|
+
|
|
42
|
+
WIRE_VERSION = 1
|
|
43
|
+
MAX_RECORDS_PER_CAMERA = 256
|
|
44
|
+
MAX_FACE_DIMS = 1024
|
|
45
|
+
_ID = re.compile(r"[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}\Z")
|
|
46
|
+
_SHA = re.compile(r"[a-f0-9]{64}\Z")
|
|
47
|
+
_SAFE_INTEGER = 9007199254740991
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _finite(value) -> bool:
|
|
51
|
+
return not isinstance(value, bool) and isinstance(value, (int, float)) and math.isfinite(value)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@dataclass(frozen=True)
|
|
55
|
+
class FaceSlot:
|
|
56
|
+
"""One face vector read from a live actor's own crop (plan v7 T1 writes it).
|
|
57
|
+
|
|
58
|
+
vector the face model's embedding exactly as it emits it, `dims` long
|
|
59
|
+
quality the face model's own 0..1 quality for that crop
|
|
60
|
+
frameId / capturedAtMs the frame the crop came from (the actor's camera)
|
|
61
|
+
"""
|
|
62
|
+
model_id: str
|
|
63
|
+
model_sha256: str
|
|
64
|
+
vector: tuple
|
|
65
|
+
frame_id: str
|
|
66
|
+
captured_at_ms: int
|
|
67
|
+
quality: float
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def dims(self) -> int:
|
|
71
|
+
return len(self.vector)
|
|
72
|
+
|
|
73
|
+
def to_wire(self) -> dict:
|
|
74
|
+
return {"modelId": self.model_id, "modelSha256": self.model_sha256, "dims": self.dims,
|
|
75
|
+
"vector": list(self.vector), "frameId": self.frame_id,
|
|
76
|
+
"capturedAtMs": self.captured_at_ms, "quality": self.quality}
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_wire(cls, value) -> "FaceSlot":
|
|
80
|
+
if (not isinstance(value, dict)
|
|
81
|
+
or set(value) != {"modelId", "modelSha256", "dims", "vector", "frameId", "capturedAtMs", "quality"}
|
|
82
|
+
or not isinstance(value["modelId"], str) or not _ID.fullmatch(value["modelId"])
|
|
83
|
+
or not isinstance(value["modelSha256"], str) or not _SHA.fullmatch(value["modelSha256"])
|
|
84
|
+
or not isinstance(value["frameId"], str) or not _ID.fullmatch(value["frameId"])
|
|
85
|
+
or type(value["capturedAtMs"]) is not int or not 0 <= value["capturedAtMs"] <= _SAFE_INTEGER
|
|
86
|
+
or not _finite(value["quality"]) or not 0 <= value["quality"] <= 1
|
|
87
|
+
or not isinstance(value["vector"], list) or not 1 <= len(value["vector"]) <= MAX_FACE_DIMS
|
|
88
|
+
or type(value["dims"]) is not int or value["dims"] != len(value["vector"])
|
|
89
|
+
or any(not _finite(v) for v in value["vector"])):
|
|
90
|
+
raise ValueError("Invalid face slot")
|
|
91
|
+
return cls(value["modelId"], value["modelSha256"], tuple(float(v) for v in value["vector"]),
|
|
92
|
+
value["frameId"], value["capturedAtMs"], float(value["quality"]))
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@dataclass(frozen=True)
|
|
96
|
+
class TrackRecord:
|
|
97
|
+
"""A live actor's running record on one camera (see the module docstring)."""
|
|
98
|
+
actor_id: str
|
|
99
|
+
kind: str
|
|
100
|
+
epoch: str
|
|
101
|
+
first_seen_ms: int
|
|
102
|
+
last_seen_ms: int
|
|
103
|
+
frames: int
|
|
104
|
+
box: tuple # (x, y, width, height), original-frame pixels
|
|
105
|
+
confidence: float
|
|
106
|
+
face: Optional[FaceSlot] = None
|
|
107
|
+
|
|
108
|
+
def to_wire(self) -> dict:
|
|
109
|
+
x, y, width, height = self.box
|
|
110
|
+
return {"version": WIRE_VERSION, "actorId": self.actor_id, "kind": self.kind, "epoch": self.epoch,
|
|
111
|
+
"firstSeenAtMs": self.first_seen_ms, "lastSeenAtMs": self.last_seen_ms,
|
|
112
|
+
"frames": self.frames, "box": {"x": x, "y": y, "width": width, "height": height},
|
|
113
|
+
"confidence": self.confidence, "face": None if self.face is None else self.face.to_wire()}
|
|
@@ -274,6 +274,7 @@ Copy-Item -Force "$Here\register-litertlm-task.ps1" "$Payload\bin\register-liter
|
|
|
274
274
|
# regex over the whole file, so a comment naming it enrols a file that does not
|
|
275
275
|
# exist. This paragraph is deliberately phrased so it cannot match.)
|
|
276
276
|
Copy-Item -Force "$Here\setup-detector.ps1" "$Payload\bin\setup-detector.ps1"
|
|
277
|
+
Copy-Item -Force "$Here\ensure-detector.ps1" "$Payload\bin\ensure-detector.ps1"
|
|
277
278
|
Copy-Item -Force "$Here\register-detector-task.ps1" "$Payload\bin\register-detector-task.ps1"
|
|
278
279
|
# The Python package SOURCE that `uv tool install` builds into its own venv.
|
|
279
280
|
# Tens of KB; the 124 MB fp32 ONNX it runs is OTA'd, never bundled. Not matched
|
|
@@ -26,6 +26,14 @@
|
|
|
26
26
|
The connector's process tree is sampled every 10 s for its ffmpeg sessions
|
|
27
27
|
and CPU (receipt.json).
|
|
28
28
|
|
|
29
|
+
Then two detector-restart cases (plan v7 W8 item 2), judged apart from the
|
|
30
|
+
window above and still with no Gemma call: the connector process frozen for
|
|
31
|
+
-StallMs (16.5 s) across a readiness proof's renewal window, so the proof
|
|
32
|
+
lapses between two looks; and a detector swap (connections refused for
|
|
33
|
+
-SwapSeconds, then 503 while it loads) during which the alert cameras pause
|
|
34
|
+
with their sessions kept, retry every 2 s, and look again within 5 s of the
|
|
35
|
+
detector's first answer. -StallMs 0 -SwapSeconds 0 turns them off.
|
|
36
|
+
|
|
29
37
|
The install tree is assembled from the built workspace (bin\node.exe is the
|
|
30
38
|
runner's Node 22, bin\ffmpeg.exe the pinned static build, lib\edge-sdk a
|
|
31
39
|
junction to the built package) because a pull request has no published
|
|
@@ -36,7 +44,9 @@
|
|
|
36
44
|
param(
|
|
37
45
|
[ValidateRange(3, 30)][double]$ObserveMinutes = 6,
|
|
38
46
|
[ValidateRange(1, 12)][int]$IdleCameras = 6,
|
|
39
|
-
[ValidateRange(0, 2)][int]$MainCameras = 1
|
|
47
|
+
[ValidateRange(0, 2)][int]$MainCameras = 1,
|
|
48
|
+
[ValidateRange(0, 60000)][int]$StallMs = 16500,
|
|
49
|
+
[ValidateRange(0, 300)][int]$SwapSeconds = 100
|
|
40
50
|
)
|
|
41
51
|
$ErrorActionPreference = 'Stop'
|
|
42
52
|
Set-StrictMode -Version Latest
|
|
@@ -206,7 +216,7 @@ $paths
|
|
|
206
216
|
'--rtsp-base', ('rtsp://127.0.0.1:' + $rtspPort + '/'), '--mediamtx-api', ('http://127.0.0.1:' + $apiPort),
|
|
207
217
|
'--idle-cameras', $IdleCameras, '--main-cameras', $MainCameras, '--data-dir', $dataDir,
|
|
208
218
|
'--write-config', $configPath, '--ready-file', $readyFile,
|
|
209
|
-
'--minutes', $ObserveMinutes) | ForEach-Object { '"' + $_ + '"' }
|
|
219
|
+
'--minutes', $ObserveMinutes, '--stall-ms', $StallMs, '--swap-sec', $SwapSeconds) | ForEach-Object { '"' + $_ + '"' }
|
|
210
220
|
$proof = Start-Process -FilePath $systemNode -ArgumentList ($proofArgs -join ' ') -PassThru -WindowStyle Hidden `
|
|
211
221
|
-RedirectStandardOutput (Join-Path $root 'proof.log') -RedirectStandardError (Join-Path $root 'proof.err.log')
|
|
212
222
|
$owned.Add($proof)
|
|
@@ -229,7 +239,9 @@ $paths
|
|
|
229
239
|
$seen = 0
|
|
230
240
|
$lastTask = ''
|
|
231
241
|
$samples = New-Object System.Collections.Generic.List[object]
|
|
232
|
-
|
|
242
|
+
# The restart cases add up to three freezes (~1 min each) and the swap (~2.5 min).
|
|
243
|
+
$restartMinutes = if ($StallMs -gt 0 -or $SwapSeconds -gt 0) { 3 + [Math]::Ceiling($SwapSeconds / 60) + 4 } else { 0 }
|
|
244
|
+
$limit = [DateTime]::UtcNow.AddMinutes(12 + $ObserveMinutes + 6 + $restartMinutes)
|
|
233
245
|
while (-not $proof.HasExited -and [DateTime]::UtcNow -lt $limit) {
|
|
234
246
|
Start-Sleep -Seconds 10
|
|
235
247
|
$samples.Add((Get-ConnectorSample -Ffmpeg ([IO.Path]::GetFullPath($ffmpeg))))
|