@camstack/addon-pipeline 1.2.43 → 1.2.45
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/dist/audio-analyzer/index.js +1 -1
- package/dist/audio-analyzer/index.mjs +1 -1
- package/dist/detection-pipeline/index.js +158 -81
- package/dist/detection-pipeline/index.mjs +158 -81
- package/dist/{dist-B-VVBzrL.mjs → dist-BDkEhx4Z.mjs} +1315 -127
- package/dist/{dist-UHbKZiSa.js → dist-QyZ7QSRP.js} +1386 -126
- package/dist/{event-loop-stall-monitor-C7_L6vHO.js → event-loop-stall-monitor-COEKVBQK.js} +53 -8
- package/dist/{event-loop-stall-monitor-DfKdC7G4.mjs → event-loop-stall-monitor-IAuNEdmG.mjs} +53 -8
- package/dist/motion-wasm/index.js +1 -1
- package/dist/motion-wasm/index.mjs +1 -1
- package/dist/pipeline-runner/index.js +342 -69
- package/dist/pipeline-runner/index.mjs +342 -69
- package/dist/recorder/index.js +189 -6
- package/dist/recorder/index.mjs +189 -6
- package/dist/session-decode/decode-worker-child.js +197 -24
- package/dist/session-decode/decode-worker-child.mjs +197 -24
- package/dist/stream-broker/_stub.js +2 -2
- package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-D7iQbuKY.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-C68YfSUH.mjs} +2 -2
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CT2bGWqM.mjs +26 -0
- package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-54IklEep.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-B3GxBnXM.mjs} +1 -1
- package/dist/stream-broker/{hostInit-CKYS9yZO.mjs → hostInit-BMCrULpc.mjs} +2 -2
- package/dist/stream-broker/index.js +4602 -1442
- package/dist/stream-broker/index.mjs +4601 -1442
- package/dist/stream-broker/remoteEntry.js +1 -1
- package/dist/worker-protocol-DFH_z2-q.mjs +244 -0
- package/dist/worker-protocol-le27Mw_8.js +279 -0
- package/embed-dist/assets/{MaskShapeCanvas-DI4BY7W2-DxZ75vB8.js → MaskShapeCanvas-DI4BY7W2-C7bsz4cP.js} +1 -1
- package/embed-dist/assets/{MotionZonesSettings-NcxxQN8r-BBY2Ztz5.js → MotionZonesSettings-NcxxQN8r-BmhLinUd.js} +1 -1
- package/embed-dist/assets/{PrivacyMaskSettings-APgPLF7p-BC-3QmHa.js → PrivacyMaskSettings-APgPLF7p-BJjyGWFy.js} +1 -1
- package/embed-dist/assets/index-DC63og2c.css +2 -0
- package/embed-dist/assets/{index-on1wyOnd.js → index-a4CMt-Uc.js} +12 -12
- package/embed-dist/index.html +2 -2
- package/package.json +1 -1
- package/python/postprocessors/__init__.py +2 -0
- package/python/postprocessors/rfdetr.py +161 -0
- package/python/postprocessors/test_rfdetr.py +193 -0
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CCC9fqHH.mjs +0 -26
- package/dist/worker-protocol-D7RzZIla.mjs +0 -77
- package/dist/worker-protocol-DextwlTX.js +0 -94
- package/embed-dist/assets/index-CGdwTcwE.css +0 -2
package/embed-dist/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>CamStack Embed</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-a4CMt-Uc.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="./assets/index-DC63og2c.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-pipeline",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.45",
|
|
4
4
|
"description": "Pipeline bundle — runner, detection, motion, audio + stream broker. Multi-entry npm package shipping pipeline addons under a single bundle.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -13,6 +13,7 @@ from .ctc import postprocess_ctc
|
|
|
13
13
|
from .saliency import postprocess_saliency
|
|
14
14
|
from .yamnet import postprocess_yamnet
|
|
15
15
|
from .ssd import postprocess_ssd
|
|
16
|
+
from .rfdetr import postprocess_rfdetr
|
|
16
17
|
|
|
17
18
|
POSTPROCESSORS = {
|
|
18
19
|
"yolo": postprocess_yolo,
|
|
@@ -25,4 +26,5 @@ POSTPROCESSORS = {
|
|
|
25
26
|
"saliency": postprocess_saliency,
|
|
26
27
|
"yamnet": postprocess_yamnet,
|
|
27
28
|
"ssd": postprocess_ssd,
|
|
29
|
+
"rfdetr": postprocess_rfdetr,
|
|
28
30
|
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"""RF-DETR postprocessor (DETR-style query decode).
|
|
2
|
+
|
|
3
|
+
Used by the `rfdetr-package` parcel detector on the `package-detection` step
|
|
4
|
+
(per-model `postprocessor: 'rfdetr'` override — the step default is `yolo`).
|
|
5
|
+
|
|
6
|
+
Model contract, verified on the shipped export (onnx / openvino / coreml all
|
|
7
|
+
agree to |d| <= 0.005 in sigmoid space):
|
|
8
|
+
|
|
9
|
+
input "input" [1, 3, 576, 576] float, square RESIZE (no letterbox),
|
|
10
|
+
ImageNet mean/std normalised
|
|
11
|
+
(catalog: preprocessMode 'resize' +
|
|
12
|
+
inputNormalization 'imagenet')
|
|
13
|
+
output "dets" [1, 300, 4] cxcywh, NORMALISED to the input image
|
|
14
|
+
output "labels" [1, 300, 2] RAW logits; sigmoid -> per-query prob.
|
|
15
|
+
|
|
16
|
+
Three things differ from the `yolo` postprocessor and every one of them is a
|
|
17
|
+
way to get zero detections while looking correct:
|
|
18
|
+
|
|
19
|
+
1. **Column 0 is the no-object slot; the real classes start at 1.**
|
|
20
|
+
The upstream rfdetr helper slices `logits[..., :-1]` — it drops the LAST
|
|
21
|
+
column. On this checkpoint (`num_classes=1` ⇒ head width 2) that would throw
|
|
22
|
+
away the `package` column and keep the background one, so every frame
|
|
23
|
+
decodes as "nothing, forever". We slice `[..., 1:]`. Measured: the
|
|
24
|
+
background column never exceeded 0.003 on any test frame, parcel or not.
|
|
25
|
+
|
|
26
|
+
2. **No letterbox, so `scale`/`pad` are unused.** Boxes map onto the original
|
|
27
|
+
crop by multiplying the normalised cxcywh by orig_w / orig_h directly. The
|
|
28
|
+
normalised coords are NOT sigmoid-bounded and DO exceed 1.0 (and go below 0)
|
|
29
|
+
on edge queries — they are clamped to the frame, and a box that clamps to
|
|
30
|
+
nothing is dropped.
|
|
31
|
+
|
|
32
|
+
3. **300 independent queries, no objectness.** NMS still runs (near-duplicate
|
|
33
|
+
queries do occur) but the model is not anchor-based, so the default IoU is
|
|
34
|
+
looser (0.50) than the yolo default on purpose.
|
|
35
|
+
|
|
36
|
+
DEGENERATE-BOX GUARD (measured, not theoretical): on a parcel-free crop
|
|
37
|
+
dominated by one large dark rectangle (the doormat) the top query becomes a box
|
|
38
|
+
spanning ~the whole crop at 0.33. Every real parcel detection was <= 25% of the
|
|
39
|
+
crop area. Rejecting boxes covering more than `maxAreaFraction` of the crop
|
|
40
|
+
removes that failure mode without touching a single true positive.
|
|
41
|
+
|
|
42
|
+
Output matches the yolo postprocessor:
|
|
43
|
+
``{"kind": "detections", "detections": [{"class", "score", "bbox":[x1,y1,x2,y2]}]}``
|
|
44
|
+
with pixel bboxes in ORIGINAL frame coordinates.
|
|
45
|
+
"""
|
|
46
|
+
from __future__ import annotations
|
|
47
|
+
|
|
48
|
+
import numpy as np
|
|
49
|
+
|
|
50
|
+
# Fraction of the input crop above which a box is treated as the degenerate
|
|
51
|
+
# whole-crop query rather than a parcel. Config key: `maxAreaFraction`.
|
|
52
|
+
DEFAULT_MAX_AREA_FRACTION = 0.60
|
|
53
|
+
# DETR queries are not anchors, so duplicates overlap less tightly than a yolo
|
|
54
|
+
# grid does. Config key: `nmsIouThreshold` (shared with the yolo decoder).
|
|
55
|
+
DEFAULT_NMS_IOU = 0.50
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _iou(a: tuple, b: tuple) -> float:
|
|
59
|
+
"""IoU between two boxes (x1, y1, x2, y2)."""
|
|
60
|
+
ix1 = max(a[0], b[0])
|
|
61
|
+
iy1 = max(a[1], b[1])
|
|
62
|
+
ix2 = min(a[2], b[2])
|
|
63
|
+
iy2 = min(a[3], b[3])
|
|
64
|
+
inter = max(0.0, ix2 - ix1) * max(0.0, iy2 - iy1)
|
|
65
|
+
if inter == 0:
|
|
66
|
+
return 0.0
|
|
67
|
+
union = (a[2] - a[0]) * (a[3] - a[1]) + (b[2] - b[0]) * (b[3] - b[1]) - inter
|
|
68
|
+
return inter / union if union > 0 else 0.0
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _nms(boxes: list, iou_threshold: float) -> list:
|
|
72
|
+
"""Greedy non-maximum suppression over `_xyxy`, highest score first."""
|
|
73
|
+
kept: list = []
|
|
74
|
+
for box in sorted(boxes, key=lambda b: b["score"], reverse=True):
|
|
75
|
+
if all(_iou(box["_xyxy"], k["_xyxy"]) <= iou_threshold for k in kept):
|
|
76
|
+
kept.append(box)
|
|
77
|
+
return kept
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _resolve_outputs(predictions: dict) -> tuple:
|
|
81
|
+
"""(dets, labels) by NAME, falling back to shape when the names are stripped.
|
|
82
|
+
|
|
83
|
+
The onnx / openvino / coreml exports all keep the `dets` + `labels` names;
|
|
84
|
+
the shape fallback covers a re-export that renames them (the boxes tensor is
|
|
85
|
+
the one whose last dim is 4).
|
|
86
|
+
"""
|
|
87
|
+
if "dets" in predictions and "labels" in predictions:
|
|
88
|
+
return np.asarray(predictions["dets"]), np.asarray(predictions["labels"])
|
|
89
|
+
arrays = [np.asarray(v) for v in predictions.values()]
|
|
90
|
+
dets = next((a for a in arrays if a.shape[-1] == 4), None)
|
|
91
|
+
labels = next((a for a in arrays if a.shape[-1] != 4), None)
|
|
92
|
+
return dets, labels
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def postprocess_rfdetr(
|
|
96
|
+
predictions: dict,
|
|
97
|
+
config: dict,
|
|
98
|
+
orig_w: int,
|
|
99
|
+
orig_h: int,
|
|
100
|
+
scale: float,
|
|
101
|
+
pad: tuple,
|
|
102
|
+
) -> dict:
|
|
103
|
+
"""Decode RF-DETR query output to original-frame detections.
|
|
104
|
+
|
|
105
|
+
`scale` / `pad` are accepted for signature parity with the other
|
|
106
|
+
postprocessors and deliberately UNUSED: this model is a square resize, not a
|
|
107
|
+
letterbox, so there is no padding to invert.
|
|
108
|
+
"""
|
|
109
|
+
conf_threshold = float(config.get("confidence", 0) or 0)
|
|
110
|
+
labels_map = config.get("labels") or ["package"]
|
|
111
|
+
nms_iou = float(config.get("nmsIouThreshold", DEFAULT_NMS_IOU) or DEFAULT_NMS_IOU)
|
|
112
|
+
max_area = float(config.get("maxAreaFraction", DEFAULT_MAX_AREA_FRACTION) or DEFAULT_MAX_AREA_FRACTION)
|
|
113
|
+
|
|
114
|
+
dets, logits = _resolve_outputs(predictions)
|
|
115
|
+
if dets is None or logits is None:
|
|
116
|
+
return {"kind": "detections", "detections": []}
|
|
117
|
+
|
|
118
|
+
dets = dets[0] if dets.ndim == 3 else dets
|
|
119
|
+
logits = logits[0] if logits.ndim == 3 else logits
|
|
120
|
+
if dets.ndim != 2 or logits.ndim != 2 or logits.shape[1] < 2:
|
|
121
|
+
# A single-column `labels` would be the no-object slot alone — nothing
|
|
122
|
+
# to decode, and slicing it would raise instead of saying so.
|
|
123
|
+
return {"kind": "detections", "detections": []}
|
|
124
|
+
|
|
125
|
+
probs = 1.0 / (1.0 + np.exp(-logits.astype(np.float32)))
|
|
126
|
+
# Column 0 is the DETR background / no-object slot — NOT the last column.
|
|
127
|
+
# See the module docstring: dropping the wrong end silently yields zero
|
|
128
|
+
# detections on every frame.
|
|
129
|
+
class_probs = probs[:, 1:]
|
|
130
|
+
best_class = class_probs.argmax(axis=1)
|
|
131
|
+
best_score = class_probs.max(axis=1)
|
|
132
|
+
|
|
133
|
+
frame_area = float(orig_w * orig_h)
|
|
134
|
+
if frame_area <= 0:
|
|
135
|
+
return {"kind": "detections", "detections": []}
|
|
136
|
+
|
|
137
|
+
candidates: list = []
|
|
138
|
+
for i in np.nonzero(best_score >= conf_threshold)[0]:
|
|
139
|
+
cx, cy, w, h = (float(v) for v in dets[i][:4])
|
|
140
|
+
# Normalised, NOT sigmoid-bounded: edge queries exceed [0,1] and are
|
|
141
|
+
# clamped to the frame rather than dropped.
|
|
142
|
+
x1 = max(0.0, (cx - w / 2.0) * orig_w)
|
|
143
|
+
y1 = max(0.0, (cy - h / 2.0) * orig_h)
|
|
144
|
+
x2 = min(float(orig_w), (cx + w / 2.0) * orig_w)
|
|
145
|
+
y2 = min(float(orig_h), (cy + h / 2.0) * orig_h)
|
|
146
|
+
if x2 <= x1 or y2 <= y1:
|
|
147
|
+
continue
|
|
148
|
+
if ((x2 - x1) * (y2 - y1)) / frame_area > max_area:
|
|
149
|
+
continue # degenerate whole-crop query (the doormat failure mode)
|
|
150
|
+
cls = int(best_class[i])
|
|
151
|
+
candidates.append({
|
|
152
|
+
"class": labels_map[cls] if cls < len(labels_map) else str(cls),
|
|
153
|
+
"score": round(float(best_score[i]), 4),
|
|
154
|
+
"bbox": [round(x1, 1), round(y1, 1), round(x2, 1), round(y2, 1)],
|
|
155
|
+
"_xyxy": (x1, y1, x2, y2),
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
kept = _nms(candidates, nms_iou)
|
|
159
|
+
for box in kept:
|
|
160
|
+
box.pop("_xyxy", None)
|
|
161
|
+
return {"kind": "detections", "detections": kept}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"""RF-DETR decode contract — the four ways this postprocessor silently breaks.
|
|
2
|
+
|
|
3
|
+
Run (from `packages/addon-pipeline/python/postprocessors`):
|
|
4
|
+
|
|
5
|
+
python -m pytest test_rfdetr.py -q
|
|
6
|
+
|
|
7
|
+
Each test pins one property that produced (or would produce) an empty/wrong
|
|
8
|
+
detection list without any error being raised.
|
|
9
|
+
"""
|
|
10
|
+
import math
|
|
11
|
+
|
|
12
|
+
import numpy as np
|
|
13
|
+
|
|
14
|
+
from rfdetr import postprocess_rfdetr
|
|
15
|
+
|
|
16
|
+
# One query, one real class ⇒ `labels` is [1, N, 2]: column 0 = no-object,
|
|
17
|
+
# column 1 = package.
|
|
18
|
+
_CONFIG = {"labels": ["package"], "confidence": 0.5}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _logit(p: float) -> float:
|
|
22
|
+
return math.log(p / (1.0 - p))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _outputs(boxes: list, logits: list) -> dict:
|
|
26
|
+
"""`dets` [1,N,4] cxcywh normalised + `labels` [1,N,2] RAW logits."""
|
|
27
|
+
return {
|
|
28
|
+
"dets": np.array([boxes], dtype=np.float32),
|
|
29
|
+
"labels": np.array([logits], dtype=np.float32),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_decodes_a_package_query_to_pixel_bbox():
|
|
34
|
+
# Centred box, half the frame per side ⇒ 25% of the area (a real parcel).
|
|
35
|
+
out = postprocess_rfdetr(
|
|
36
|
+
_outputs([[0.5, 0.5, 0.5, 0.5]], [[_logit(0.01), _logit(0.93)]]),
|
|
37
|
+
dict(_CONFIG),
|
|
38
|
+
orig_w=200,
|
|
39
|
+
orig_h=200,
|
|
40
|
+
scale=1.0,
|
|
41
|
+
pad=(0, 0),
|
|
42
|
+
)
|
|
43
|
+
assert len(out["detections"]) == 1
|
|
44
|
+
det = out["detections"][0]
|
|
45
|
+
assert det["class"] == "package"
|
|
46
|
+
assert det["score"] == 0.93
|
|
47
|
+
assert det["bbox"] == [50.0, 50.0, 150.0, 150.0]
|
|
48
|
+
# The NMS scratch key never leaks into the StepOutput.
|
|
49
|
+
assert "_xyxy" not in det
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_column_zero_is_the_dead_no_object_slot():
|
|
53
|
+
"""THE trap: the upstream helper slices `logits[..., :-1]` (drops the LAST
|
|
54
|
+
column). On this 2-wide head that keeps background and throws away package.
|
|
55
|
+
|
|
56
|
+
A query whose BACKGROUND logit is high and whose PACKAGE logit is low must
|
|
57
|
+
decode to nothing. If the slice were `[:-1]` this returns a 0.99 detection.
|
|
58
|
+
"""
|
|
59
|
+
out = postprocess_rfdetr(
|
|
60
|
+
_outputs([[0.5, 0.5, 0.3, 0.3]], [[_logit(0.99), _logit(0.02)]]),
|
|
61
|
+
dict(_CONFIG),
|
|
62
|
+
orig_w=200,
|
|
63
|
+
orig_h=200,
|
|
64
|
+
scale=1.0,
|
|
65
|
+
pad=(0, 0),
|
|
66
|
+
)
|
|
67
|
+
assert out["detections"] == []
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_out_of_range_normalised_box_is_clamped_not_dropped():
|
|
71
|
+
"""cxcywh is normalised but NOT sigmoid-bounded — edge queries exceed 1.0
|
|
72
|
+
and go below 0. The box must clamp to the frame, not vanish and not produce
|
|
73
|
+
negative / over-frame pixels."""
|
|
74
|
+
out = postprocess_rfdetr(
|
|
75
|
+
# cx 0.9, w 0.6 ⇒ x2 = 1.2 (> 1); cy 0.1, h 0.4 ⇒ y1 = -0.1 (< 0)
|
|
76
|
+
_outputs([[0.9, 0.1, 0.6, 0.4]], [[_logit(0.01), _logit(0.80)]]),
|
|
77
|
+
dict(_CONFIG),
|
|
78
|
+
orig_w=100,
|
|
79
|
+
orig_h=100,
|
|
80
|
+
scale=1.0,
|
|
81
|
+
pad=(0, 0),
|
|
82
|
+
)
|
|
83
|
+
assert len(out["detections"]) == 1
|
|
84
|
+
x1, y1, x2, y2 = out["detections"][0]["bbox"]
|
|
85
|
+
assert (x1, y1, x2, y2) == (60.0, 0.0, 100.0, 30.0)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def test_fully_out_of_frame_box_is_dropped():
|
|
89
|
+
out = postprocess_rfdetr(
|
|
90
|
+
_outputs([[1.6, 0.5, 0.2, 0.2]], [[_logit(0.01), _logit(0.90)]]),
|
|
91
|
+
dict(_CONFIG),
|
|
92
|
+
orig_w=100,
|
|
93
|
+
orig_h=100,
|
|
94
|
+
scale=1.0,
|
|
95
|
+
pad=(0, 0),
|
|
96
|
+
)
|
|
97
|
+
assert out["detections"] == []
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def test_whole_crop_query_is_rejected_by_the_area_guard():
|
|
101
|
+
"""The measured doormat failure mode: one query spanning ~the whole crop at
|
|
102
|
+
0.33. Every real parcel was <= 25% of the crop, so > 60% is degenerate."""
|
|
103
|
+
whole_crop = _outputs([[0.5, 0.5, 1.0, 1.0]], [[_logit(0.01), _logit(0.90)]])
|
|
104
|
+
out = postprocess_rfdetr(
|
|
105
|
+
whole_crop, dict(_CONFIG), orig_w=200, orig_h=200, scale=1.0, pad=(0, 0)
|
|
106
|
+
)
|
|
107
|
+
assert out["detections"] == []
|
|
108
|
+
|
|
109
|
+
# …and the guard is config-driven, not a hard-coded reject: raise it above
|
|
110
|
+
# 1.0 and the same query survives (proves the guard is what removed it).
|
|
111
|
+
permissive = postprocess_rfdetr(
|
|
112
|
+
whole_crop,
|
|
113
|
+
dict(_CONFIG, maxAreaFraction=1.01),
|
|
114
|
+
orig_w=200,
|
|
115
|
+
orig_h=200,
|
|
116
|
+
scale=1.0,
|
|
117
|
+
pad=(0, 0),
|
|
118
|
+
)
|
|
119
|
+
assert len(permissive["detections"]) == 1
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def test_confidence_threshold_is_applied_in_sigmoid_space():
|
|
123
|
+
"""Raw logits are NEGATIVE for a 0.6 probability — a decoder that compared
|
|
124
|
+
the logit to the threshold would drop this. The gate runs post-sigmoid."""
|
|
125
|
+
below = _outputs([[0.5, 0.5, 0.3, 0.3]], [[_logit(0.01), _logit(0.60)]])
|
|
126
|
+
assert (
|
|
127
|
+
postprocess_rfdetr(
|
|
128
|
+
below, dict(_CONFIG, confidence=0.7), orig_w=200, orig_h=200, scale=1.0, pad=(0, 0)
|
|
129
|
+
)["detections"]
|
|
130
|
+
== []
|
|
131
|
+
)
|
|
132
|
+
kept = postprocess_rfdetr(
|
|
133
|
+
below, dict(_CONFIG, confidence=0.5), orig_w=200, orig_h=200, scale=1.0, pad=(0, 0)
|
|
134
|
+
)
|
|
135
|
+
assert len(kept["detections"]) == 1
|
|
136
|
+
assert kept["detections"][0]["score"] == 0.6
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def test_duplicate_queries_are_suppressed_and_the_iou_is_config_driven():
|
|
140
|
+
# A = xyxy(60,60,140,140), B = xyxy(70,70,150,150) ⇒ IoU ≈ 0.47.
|
|
141
|
+
dup = _outputs(
|
|
142
|
+
[[0.5, 0.5, 0.4, 0.4], [0.55, 0.55, 0.4, 0.4]],
|
|
143
|
+
[[_logit(0.01), _logit(0.90)], [_logit(0.01), _logit(0.80)]],
|
|
144
|
+
)
|
|
145
|
+
default = postprocess_rfdetr(
|
|
146
|
+
dup, dict(_CONFIG), orig_w=200, orig_h=200, scale=1.0, pad=(0, 0)
|
|
147
|
+
)
|
|
148
|
+
assert len(default["detections"]) == 1
|
|
149
|
+
assert default["detections"][0]["score"] == 0.9
|
|
150
|
+
|
|
151
|
+
loose = postprocess_rfdetr(
|
|
152
|
+
dup, dict(_CONFIG, nmsIouThreshold=0.9), orig_w=200, orig_h=200, scale=1.0, pad=(0, 0)
|
|
153
|
+
)
|
|
154
|
+
assert len(loose["detections"]) == 2
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def test_outputs_resolve_by_shape_when_the_names_are_stripped():
|
|
158
|
+
named = _outputs([[0.5, 0.5, 0.4, 0.4]], [[_logit(0.01), _logit(0.90)]])
|
|
159
|
+
anonymous = {"var_1": named["dets"], "var_2": named["labels"]}
|
|
160
|
+
out = postprocess_rfdetr(
|
|
161
|
+
anonymous, dict(_CONFIG), orig_w=200, orig_h=200, scale=1.0, pad=(0, 0)
|
|
162
|
+
)
|
|
163
|
+
assert len(out["detections"]) == 1
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def test_a_labels_tensor_with_only_the_no_object_column_decodes_to_nothing():
|
|
167
|
+
"""A 1-wide head is background-only — slicing it must return empty, not raise."""
|
|
168
|
+
out = postprocess_rfdetr(
|
|
169
|
+
{
|
|
170
|
+
"dets": np.array([[[0.5, 0.5, 0.4, 0.4]]], dtype=np.float32),
|
|
171
|
+
"labels": np.array([[[_logit(0.99)]]], dtype=np.float32),
|
|
172
|
+
},
|
|
173
|
+
dict(_CONFIG),
|
|
174
|
+
orig_w=200,
|
|
175
|
+
orig_h=200,
|
|
176
|
+
scale=1.0,
|
|
177
|
+
pad=(0, 0),
|
|
178
|
+
)
|
|
179
|
+
assert out["detections"] == []
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def test_registered_in_the_dispatch_table():
|
|
183
|
+
"""`inference_pool.py` resolves `slot_config['postprocessor']` through this
|
|
184
|
+
table — an unregistered decoder raises "Unknown postprocessor: rfdetr" and
|
|
185
|
+
the catalog entry is inert no matter how correct the decode is.
|
|
186
|
+
|
|
187
|
+
Both sides import through the PACKAGE (`postprocessors.rfdetr`); the flat
|
|
188
|
+
`from rfdetr import …` this file uses elsewhere is a distinct module object.
|
|
189
|
+
"""
|
|
190
|
+
from postprocessors import POSTPROCESSORS
|
|
191
|
+
from postprocessors.rfdetr import postprocess_rfdetr as registered
|
|
192
|
+
|
|
193
|
+
assert POSTPROCESSORS["rfdetr"] is registered
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//#region \0virtual:mf:__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js
|
|
2
|
-
var e = "__mf_init__virtual:mf:__mfe_internal__addon_stream_broker_widgets__mf_v__runtimeInit__mf_v__.js__", t = globalThis[e];
|
|
3
|
-
if (!t) {
|
|
4
|
-
let n, r, i = new Promise((e, t) => {
|
|
5
|
-
n = e, r = t;
|
|
6
|
-
});
|
|
7
|
-
t = globalThis[e] = {
|
|
8
|
-
initPromise: i,
|
|
9
|
-
initResolve: n,
|
|
10
|
-
initReject: r
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
var n = t.initPromise, r = "__mf_module_cache__";
|
|
14
|
-
globalThis[r] ||= {
|
|
15
|
-
share: {},
|
|
16
|
-
remote: {}
|
|
17
|
-
}, globalThis[r].share ||= {}, globalThis[r].remote ||= {};
|
|
18
|
-
var i = globalThis[r], a, o = (e) => {
|
|
19
|
-
e.ACCESSORY_LABEL, e.ALEXA_EGRESS_PROFILE, e.ALL_CAPABILITY_DEFINITIONS, e.APPLE_SA_TO_MACRO, e.AUDIO_ANALYSIS_CAP_NAME, e.AUDIO_BACKEND_CHOICES, e.AUDIO_MACRO_LABELS, e.AUDIO_PRESETS, e.AccessoriesStatusSchema, e.AccessoryKind, e.AddBrokerInputSchema, e.AddonAutoUpdateSchema, e.AddonListItemSchema, e.AddonPageDeclarationSchema, e.AddonPageInfoSchema, e.AdoptionAdoptInputSchema, e.AdoptionAdoptResultSchema, e.AdoptionFilterSchema, e.AdoptionGetCandidateInputSchema, e.AdoptionListCandidatesInputSchema, e.AdoptionListCandidatesOutputSchema, e.AdoptionReleaseInputSchema, e.AdoptionStatusSchema, e.AgentLoadSummarySchema, e.AirQualitySensorStatusSchema, e.AlarmArmModeSchema, e.AlarmPanelStatusSchema, e.AlarmStateSchema, e.AlertSchema, e.AlertSeveritySchema, e.AlertSourceSchema, e.AlertStatusSchema, e.AmbientLightSensorStatusSchema, e.ApiKeyRecordSchema, e.ApiKeySummarySchema, e.ArchiveEntrySchema, e.ArchiveManifestSchema, e.AttachmentMediaTypeSchema, e.AttachmentSchema, e.AudioAnalysisResultSchema, e.AudioAnalysisSettingsSchema, e.AudioChunkInputSchema, e.AudioClassSummarySchema, e.AudioClassificationLabelSchema, e.AudioClassificationResultSchema, e.AudioCodecInfoSchema, e.AudioDecodeSessionConfigSchema, e.AudioEncodeSchema, e.AudioEncodeSessionConfigSchema, e.AudioEncodedChunkSchema, e.AudioEventSchema, e.AudioLevelSchema, e.AudioMetricsHistoryPointSchema, e.AudioMetricsHistorySchema, e.AudioMetricsSnapshotSchema, e.AudioPcmChunkSchema, e.AuthResultSchema, e.AutoUpdateSettingsSchema, e.AutomationControlStatusSchema, e.AvailableIntegrationTypeSchema, e.BACKEND_TO_FORMAT, e.BASE_LIVE_EGRESS_PROFILE, e.BATTERY_DEVICE_PROFILE, e.BacklightModeSchema, e.BackupDestinationInfoSchema, e.BackupEntrySchema, e.BaseAddon, e.BaseDevice, e.BaseDeviceProvider, e.BatteryStatusSchema, e.BinaryStatusSchema, e.BoundingBoxSchema, e.BrightnessStatusSchema, e.BrokerAddInputSchema, e.BrokerAudioClientSchema, e.BrokerClientsSchema, e.BrokerConnectionDetailsSchema, e.BrokerConsumerAttributionSchema, e.BrokerConsumerKindSchema, e.BrokerDecodedClientSchema, e.BrokerEncodedClientSchema, e.BrokerGetStateInputSchema, e.BrokerInfoSchema, e.BrokerProviderInfoSchema, e.BrokerPublishInputSchema, e.BrokerRegistryStatusSchema, e.BrokerRtspClientSchema, e.BrokerStatsSchema, e.BrokerStatusEnum, e.BrokerStatusSchema, e.BrokerSubscribeInputSchema, e.BrokerSubscribeResultSchema, e.BrokerTestConnectionResultSchema, e.BrokerUnsubscribeInputSchema, e.CAMERA_SWITCH_CATALOG, e.CAMERA_SWITCH_ORDER, e.CAM_PROFILE_ORDER, e.CAPABILITY_NAMES, e.CAPABILITY_ROUTER_KEYS, e.CAP_NAMES_WITH_STATUS, e.CAP_NODE_PIN_CONTEXT_KEY, e.CAP_PROVIDER_KIND_MAP, e.COCO_80_LABELS, e.COCO_TO_MACRO, e.CamProfileSchema, e.CamStreamDescriptorSchema, e.CamStreamKindSchema, e.CamStreamResolutionSchema, e.CameraAssignmentStatusSchema, e.CameraAudioStatusSchema, e.CameraBrokerProfileSchema, e.CameraBrokerStatusSchema, e.CameraCredentialsSchema, e.CameraCredentialsStatusSchema, e.CameraDecoderShmSchema, e.CameraDecoderStatusSchema, e.CameraDetectionPhaseSchema, e.CameraDetectionProvisioningSchema, e.CameraDetectionProvisioningStateSchema, e.CameraDetectionStatusSchema, e.CameraMetricsSchema, e.CameraMetricsWithDeviceIdSchema, e.CameraMotionStatusSchema, e.CameraRecordingModeSchema, e.CameraRecordingStatusSchema, e.CameraSourceStatusSchema, e.CameraSourceStreamSchema, e.CameraStatusSchema, e.CameraStreamSchema, e.CameraSwitchAuthoritySchema, e.CameraSwitchGroupSchema, e.CameraSwitchIdSchema, e.CameraSwitchSchema, e.CameraSwitchUnavailableReasonSchema, e.CandidateQueryFilterSchema, e.CapScopeSchema, e.CapabilityBindingsSchema, e.CarbonMonoxideStatusSchema, e.ChargingStatus, e.ClientNetworkStatsSchema, e.ClimateControlStatusSchema, e.ClipPlaybackSchema, e.ClipSchema, e.ClusterAddonNodeDeploymentSchema, e.ClusterAddonStatusEntrySchema, e.CollectionColumnSchema, e.CollectionIndexSchema, e.ColorStatusSchema, e.ConfigEntrySchema, e.ConfigSectionWithValuesSchema, e.ConfigTabDeclarationSchema, e.ConnectivityStatusSchema, e.ConsumableItemSchema, e.ConsumablesStatusSchema, e.ContactStatusSchema, e.ControlKindSchema, e.ControlStatusSchema, e.ConvertArtifactSchema, e.ConvertResultSchema, e.ConvertTargetSchema, e.CoreBlockCompileResultSchema, e.CoreBlockInputSchema, e.CoreBlockPlacementSchema, e.CoreBlockSchema, e.CoreBlockStatusSchema, e.CoverStateSchema, e.CoverStatusSchema, e.CreateApiKeyInputSchema, e.CreateApiKeyResultSchema, e.CreateIntegrationInputSchema, e.CreateScopedTokenInputSchema, e.CreateScopedTokenResultSchema, e.CreateUserInputSchema, e.CustomActionInputSchema, e.CustomModelDescriptorSchema, e.DATAPLANE_SECRET_HEADER, e.DEFAULT_ADDON_PLACEMENT, e.DEFAULT_AUDIO_ANALYZER_CONFIG, e.DEFAULT_DECODER_HWACCEL_CONFIG, e.DEFAULT_DETAIL_CROP_CONVENTION, e.DEFAULT_EVENT_COLOR, e.DEFAULT_FEATURES, e.DEFAULT_RETENTION, e.DEFAULT_SCRUB_THUMBNAIL_PRESET, e.DETAIL_CROP_PADDING_FIELD, e.DETAIL_CROP_PADDING_KEY, e.DETAIL_CROP_SECTION_ID, e.DETAIL_CROP_SQUARE_KEY, e.DETECTION_PIPELINE_CAP_NAME, e.DEVICE_BACKEND_TO_FORMAT, e.DEVICE_CAP_NAMES, e.DEVICE_PROFILES, e.DEVICE_SCOPED_CAPS, e.DEVICE_SETTINGS_CONTRIBUTION_METHODS, e.DEVICE_STATE_READERS, e.DEVICE_STATUS_METHOD, e.DEVICE_TYPE_CONTROL_KIND, e.DEVICE_TYPE_INFO, e.DataStoreEngineInfoSchema, e.DayNightModeSchema, e.DayNightOptionsSchema, e.DayNightSettingsPatchSchema, e.DayNightStatusSchema, e.DecodedAudioChunkSchema, e.DecodedFrameSchema, e.DecoderSessionConfigSchema, e.DecoderStatsSchema, e.DeleteIntegrationResultSchema, e.DetailCropConventionSchema, e.DetectionSourceSchema, e.DeviceCodeSeveritySchema, e.DeviceConfig, e.DeviceDiscoveryStatusSchema, e.DeviceExportExposeInputSchema, e.DeviceExportStatusSchema, e.DeviceExportUnexposeInputSchema, e.DeviceFeature, e.DeviceInfoSchema, e.DeviceLinkModeSchema, e.DeviceNetworkStatsSchema, e.DeviceRole, e.DeviceRuntimeState, e.DeviceStatusSchema, e.DeviceType, e.DiscoveredChildDeviceSchema, e.DiscoveredChildStatusSchema, e.DiscoveredDeviceSchema, e.DiscoveredTargetSchema, e.DisposerChain, e.DoorbellPressEventSchema, e.DoorbellStatusSchema, e.EVENTFUL_CAP_NAMES, e.EVENT_KIND_BY_CAP, e.EVENT_PAD_MS, e.EVENT_TAXONOMY, e.EXPRESSION_BUILTINS, e.EXPRESSION_BUILTIN_NAMES, e.EXPRESSION_COMPILE_CACHE_CAPACITY, e.EXPRESSION_IDENTIFIER_RE, e.EXPRESSION_INJECTED_NOW, e.ElementConfigStore, e.EmbeddingInfoSchema, e.EmbeddingResultSchema, e.EncodeProfileSchema, e.EncodedPacketSchema, e.EnrichedWidgetMetadataSchema, e.EnumSensorDateTimeFormatSchema, e.EnumSensorStatusSchema, e.EventCategory, e.EventEmitterStatusSchema, e.EventFireSchema, e.EventItemSchema, e.EventKindCategorySchema, e.EventKindDescriptorSchema, e.EventKindIconSchema, e.EventKindSchema, e.EventKindsForDeviceSchema, e.EventSourceType, e.ExportDownloadSchema, e.ExportOptionsSchema, e.ExportRecordSchema, e.ExportSetupFieldSchema, e.ExportSetupSchema, e.ExportSpeedSchema, e.ExportStateSchema, e.ExportTimelapseSchema, e.ExposedDeviceSchema, e.ExposureModeSchema, e.ExpressionEvalError, e.ExpressionParseError, e.FanControlStatusSchema, e.FanDirectionSchema, e.FeatureManifestSchema, e.FeatureProbeStatusSchema, e.FloodStatusSchema, e.FrameHandleFormatSchema, e.FrameHandleSchema, e.FrameInputSchema, e.GasStatusSchema, e.GetStreamWithCodecInputSchema, e.GlobalMetricsSchema, e.HAP_AUDIO_BASE, e.HAP_AUDIO_BITRATE_KBPS, e.HAP_AUDIO_VBV_KBITS, e.HAP_KEYFRAME_INTERVAL_SEC, e.HF_BASE_URL, e.HF_REPO, e.HWACCEL_OPTIONS, e.HealthStatusSchema, e.HistoryPointSchema, e.HistoryResolutionEnum, e.HumidifierStatusSchema, e.HumiditySensorStatusSchema, e.HvacModeSchema, e.ImageContractSchema, e.ImageContractStateSchema, e.ImageRotateSchema, e.ImageSettingsOptionsSchema, e.ImageSettingsPatchSchema, e.ImageSettingsStatusSchema, e.ImageStatusSchema, e.IngestOwnerSchema, e.InstalledPackageSchema, e.IntegrationLiteSchema, e.IntegrationWithStateSchema, e.IntercomAbilitySchema, e.IntercomStatusSchema, e.KNOWN_CAP_NAMES, e.KeyEventSchema, e.LOG_LEVEL_RANK, e.LabelDefinitionSchema, e.LawnMowerActivitySchema, e.LawnMowerControlStatusSchema, e.LinkedDeviceSchema, e.LlmDefaultSchema, e.LlmDefaultSelectorSchema, e.LlmErrorCodeSchema, e.LlmGenerateBaseInputSchema, e.LlmGenerateErrSchema, e.LlmGenerateOkSchema, e.LlmGenerateResultSchema, e.LlmImageSchema, e.LlmNodeModelSchema, e.LlmProfileKindDescriptorSchema, e.LlmProfileKindSchema, e.LlmProfileSchema, e.LlmRuntimeCompleteInputSchema, e.LlmRuntimeDiskUsageSchema, e.LlmRuntimeNodeSchema, e.LlmRuntimeStatusSchema, e.LlmUsageRollupSchema, e.LlmUsageSchema, e.LocateSegmentResultSchema, e.LocationStatSchema, e.LockControlStatusSchema, e.LockStateSchema, e.LogEntrySchema, e.LogLevelSchema, e.LogStreamEntrySchema, e.LoginMethodContributionSchema, e.LoginStageEnum, e.MACRO_LABELS, e.MAX_EXPRESSION_AST_NODES, e.MAX_EXPRESSION_BINDINGS, e.MAX_EXPRESSION_CALL_ARGS, e.MAX_EXPRESSION_EVAL_STEPS, e.MAX_EXPRESSION_SOURCE_LENGTH, e.METHOD_ACCESS_MAP, e.MODEL_FORMATS, e.MOTION_TRIGGER_FEATURE, e.ManagedModelCatalogEntrySchema, e.ManagedModelRefSchema, e.ManagedRuntimeConfigSchema, e.MaskGridDimsSchema, e.MaskGridShapeSchema, e.MaskLineShapeSchema, e.MaskPointSchema, e.MaskPolygonShapeSchema, e.MaskPolygonVerticesSchema, e.MaskRectShapeSchema, e.MaskShapeKindSchema, e.MaskShapeSchema, e.MediaFileInfoSchema, e.MediaFileSchema, e.MediaPlayerRepeatSchema, e.MediaPlayerStateSchema, e.MediaPlayerStatusSchema, e.MeshPeerSchema, e.MeshStatusSchema, e.MethodAccessSchema, e.ModelCatalogEntrySchema, e.ModelConvertInputSchema, e.ModelConvertMetadataSchema, e.ModelDistributeInputSchema, e.ModelDistributeResultSchema, e.ModelExtraFileSchema, e.ModelFormatEntrySchema, e.ModelFormatsSchema, e.ModelSubstitutionSchema, e.ModelVariantGroupSchema, e.MotionAnalysisResultSchema, e.MotionEventSchema, e.MotionOnMotionChangedDataSchema, e.MotionRegionSchema, e.MotionSourceEnum, e.MotionSourcesSchema, e.MotionStatusSchema, e.MotionTriggerRuntimeStateSchema, e.MotionTriggerStatusSchema, e.MotionZoneOptionsSchema, e.MotionZonePatchSchema, e.MotionZoneRegionSchema, e.MotionZoneStatusSchema, e.MqttBrokerStatusSchema, e.MutationFilterSchema, e.NC_BASE_CONDITION_KEYS, e.NC_CONDITION_CATALOG, e.NC_HISTORY_LIMIT_DEFAULT, e.NC_HISTORY_LIMIT_MAX, e.NC_MAX_PER_TRACK_IMMEDIATE, e.NC_SNOOZE_MAX_MINUTES, e.NC_TAXONOMY, e.NativeCropBboxSchema, e.NativeCropRefSchema, e.NativeCropResultSchema, e.NativeDetectionSchema, e.NativeObjectClassEnum, e.NativeObjectDetectionRuntimeStateSchema, e.NativeObjectDetectionStatusSchema, e.NcAlarmConfigSchema, e.NcAlarmModeCoverageSchema, e.NcAlarmSettingsPatchSchema, e.NcAlarmSettingsSchema, e.NcConditionDescriptorSchema, e.NcConditionsSchema, e.NcCrossingSchema, e.NcDeliverySchema, e.NcDeviceStateConditionSchema, e.NcHistoryEntrySchema, e.NcHistoryFilterSchema, e.NcHistoryRecordKindSchema, e.NcHistoryStatusSchema, e.NcHistorySubjectSchema, e.NcMediaFrameSchema, e.NcMediaPolicySchema, e.NcOccupancyConditionSchema, e.NcPlateMatcherSchema, e.NcRuleActionSchema, e.NcRuleActionSequenceSchema, e.NcRuleActionsSchema, e.NcRuleInputSchema, e.NcRuleNotificationButtonSchema, e.NcRulePatchSchema, e.NcRuleSchema, e.NcRuleTargetSchema, e.NcScheduleSchema, e.NcScheduleWindowSchema, e.NcSnoozeInputSchema, e.NcSnoozeSchema, e.NcSnoozeScopeSchema, e.NcSnoozeSuppressedSchema, e.NcTaxonomyEntrySchema, e.NcTaxonomySchema, e.NcTestResultSchema, e.NcThrottleGranularitySchema, e.NcThrottleSchema, e.NcZoneConditionSchema, e.NetworkAccessStatusSchema, e.NetworkAddressSchema, e.NetworkEndpointSchema, e.NotificationActionIconSchema, e.NotificationActionSchema, e.NotificationFormatSchema, e.NotificationSchema, e.NotifierStatusSchema, e.NumericSensorStatusSchema, e.OPS_LOG_DEFAULT_LIMIT, e.OPS_LOG_RING_DEFAULT_MAX, e.OauthIntegrationDescriptorSchema, e.ObjectEventSchema, e.OpsLogDomainSchema, e.OpsLogEntrySchema, e.OpsLogOpSchema, e.OpsLogQueryInputSchema, e.OpsLogReasonSchema, e.OrchestratorMetricsSchema, e.OsdOverlayKindEnum, e.OsdOverlayPatchSchema, e.OsdOverlaySchema, e.OsdPositionEnum, e.OsdStatusSchema, e.PET_FEEDER_MANUAL_FEED_MAX, e.PET_FEEDER_MANUAL_FEED_MIN, e.PIPELINE_FLOW_CAPABILITY_NAMES, e.PIPELINE_OWNER_CAPABILITY_NAMES, e.PROVIDER_KIND_CAP_NAMES, e.PYTHON_SCRIPT, e.PackageUpdateSchema, e.PackageVersionInfoSchema, e.PasskeyLoginMethodSchema, e.PasskeySummarySchema, e.PcmSampleFormatSchema, e.PerScopeBreakdownSchema, e.PetFeederStatusSchema, e.PickStreamPreferencesSchema, e.PickStreamRequirementsSchema, e.PickedCamStreamSchema, e.PipelineAssignmentSchema, e.PipelineDefaultStepSchema, e.PipelineEngineChoiceSchema, e.PipelineRunResultBridge, e.PipelineStepInputSchema, e.PipelineValidationIssueSchema, e.PipelineValidationResultSchema, e.PlaceholderReasonSchema, e.PolygonPointSchema, e.PowerMeterStatusSchema, e.PresenceStatusSchema, e.PressureSensorStatusSchema, e.PrivacyMaskOptionsSchema, e.PrivacyMaskPatchSchema, e.PrivacyMaskRegionSchema, e.PrivacyMaskShapeSchema, e.PrivacyMaskStatusSchema, e.ProfileRtspEntrySchema, e.ProfileSlotSchema, e.ProfileSlotStatusSchema, e.ProviderStatusSchema, e.PtzAutotrackRuntimeStateSchema, e.PtzAutotrackSettingsSchema, e.PtzAutotrackStatusSchema, e.PtzAutotrackTargetOptionSchema, e.PtzMoveCommandSchema, e.PtzOptionsSchema, e.PtzPositionSchema, e.PtzPresetSchema, e.PtzStatusSchema, e.QueryFilterSchema, e.RATE_CONTROL_RELAXED, e.RATE_CONTROL_TIGHT, e.REACHABILITY_FAILURES_TO_OFFLINE, e.REACHABILITY_POLL_INTERVAL_MS, e.REACHABILITY_PROBE_TIMEOUT_MS, e.RECOGNITION_TYPES, e.RESERVED_BINDING_NAMES, e.RUNTIME_DEFAULTS, e.RUNTIME_TO_FORMAT, e.RawStateResultSchema, e.ReadSegmentBytesResultSchema, e.ReadinessRegistry, e.ReadinessTimeoutError, e.RecentTracksPageSchema, e.RecentTracksQueryInput, e.RecordingAvailabilitySchema, e.RecordingBandModeSchema, e.RecordingBandSchema, e.RecordingBandTriggersSchema, e.RecordingConfigSchema, e.RecordingDaysSchema, e.RecordingDeviceUsageSchema, e.RecordingLocationUsageSchema, e.RecordingManifestSchema, e.RecordingRangeSchema, e.RecordingRetentionSchema, e.RecordingStatusSchema, e.RecordingStorageModeSchema, e.RecordingStorageUsageSchema, e.RecordingTriggersSchema, e.RecordingWeekdaySchema, e.RedirectLoginMethodSchema, e.RelocateFootageInputSchema, e.RelocateJobSchema, e.RelocateJobStateSchema, e.RelocateMediaInputSchema, e.RenderedAsSchema, e.ReportMotionInputSchema, e.RingBuffer, e.RtpSourceSchema, e.RtspRestreamEntrySchema, e.RunnerCameraConfigSchema, e.RunnerCameraDeviceUIFields, e.RunnerFrameSourceSchema, e.RunnerInferenceDeviceSchema, e.RunnerLocalLoadSchema, e.RunnerLocalMetricsSchema, e.SCOPE_PRESETS, e.SCRUB_THUMBNAIL_PRESETS, e.SCRUB_THUMBNAIL_PRESET_LABELS, e.SCRUB_THUMBNAIL_PRESET_ORDER, e.SENSOR_FEATURES, e.SENSOR_MAP, e.SOURCE_INFO_METADATA_KEY, e.STREAM_PROFILE_META, e.STREAM_QUALITY_LABELS, e.SUB_DETECTION_TYPES, e.SYSTEM_CAP_NAMES, e.SceneCheckSchema, e.SceneConditionSchema, e.SceneMonitorSchema, e.SceneMonitorStateSchema, e.SceneMonitorStatusSchema, e.SceneReferenceSchema, e.ScopedTokenSchema, e.ScopedTokenSummarySchema, e.ScoredObjectEventSchema, e.ScriptRunnerStatusSchema, e.ScrubThumbnailPresetSchema, e.SearchResultSchema, e.SendEmailInputSchema, e.SendEmailResultSchema, e.SendResultSchema, e.SensorEventSchema, e.ServerBootModeSchema, e.ServerPackageStatusSchema, e.ServerRollbackInfoSchema, e.ServerUpdateActionResultSchema, e.ServerUpdateCheckResultSchema, e.ServerUpdateStateSchema, e.SettingsPatchSchema, e.SettingsRecordSchema, e.SettingsSchemaWithValuesSchema, e.SettingsUpdateResultSchema, e.ShmRingStatsSchema, e.SmokeStatusSchema, e.SmtpStatusSchema, e.SnapshotImageSchema, e.SourceInfoSchema, e.SpatialDetectionSchema, e.SsoBridgeClaimsSchema, e.StartEmbeddedInputSchema, e.StationaryObjectSchema, e.StorageAbortUploadInputSchema, e.StorageBeginDownloadInputSchema, e.StorageBeginDownloadResultSchema, e.StorageBeginUploadInputSchema, e.StorageBeginUploadResultSchema, e.StorageEndDownloadInputSchema, e.StorageFinalizeUploadInputSchema, e.StorageLocationDeclarationSchema, e.StorageLocationRefSchema, e.StorageLocationSchema, e.StorageLocationTypeSchema, e.StorageProviderInfoSchema, e.StorageReadChunkInputSchema, e.StorageTestLocationResultSchema, e.StorageWriteChunkInputSchema, e.StreamCodecSchema, e.StreamFormatSchema, e.StreamNetworkStatsSchema, e.StreamParamsOptionsSchema, e.StreamParamsStatusSchema, e.StreamProfileConfigSchema, e.StreamProfileOptionsSchema, e.StreamProfilePatchSchema, e.StreamProfileSchema, e.StreamSourceEntrySchema, e.StreamSourceSchema, e.SubscribeAudioChunksInputSchema, e.SubscribeAudioChunksResultSchema, e.SubscribeFramesInputSchema, e.SubscribeFramesResultSchema, e.SwitchStatusSchema, e.SystemMetricsSchema, e.SystemMirror, e.TAXONOMY_COLORS, e.TIMEZONES, e.TRANSCODE_DOWN_MAX_BITRATE_KBPS, e.TRANSCODE_DOWN_MAX_HEIGHT, e.TamperStatusSchema, e.TankStatusSchema, e.TargetKindCapsSchema, e.TargetKindLevelSchema, e.TargetKindSchema, e.TargetSchema, e.TemperatureSensorStatusSchema, e.TerminalProfileInfoSchema, e.TerminalSessionInfoSchema, e.TestConnectionResultSchema, e.TestResultSchema, e.TimelapseRuleInputSchema, e.TimelapseRulePatchSchema, e.TimelapseRuleSchema, e.TimelapseTemplateSchema, e.ToastSchema, e.TokenScopeSchema, e.TopologyNodeSchema, e.TopologyProcessSchema, e.TopologyServiceSchema, e.TrackCascadeCountsSchema, e.TrackEnvelopeSchema, e.TrackFlagsPatchSchema, e.TrackFlagsSchema, e.TrackProjectionSchema, e.TrackSchema, e.TrackSourceSchema, e.TrackStateSchema, e.TrackZoneFilterSchema, e.TrackedDetectionSchema, e.TurnServerSchema, e.UNIT_TABLE, e.UnifiedBrokerInfoSchema, e.UnitConversionError, e.UpdateIntegrationInputSchema, e.UpdateStatusSchema, e.UpdateUserInputSchema, e.UserRecordSchema, e.UserSummarySchema, e.VacuumControlStatusSchema, e.VacuumStateSchema, e.ValveStateSchema, e.ValveStatusSchema, e.VectorDeclareIndexInputSchema, e.VectorDeleteByFilterInputSchema, e.VectorDeleteInputSchema, e.VectorDeleteResultSchema, e.VectorFilterSchema, e.VectorGetInputSchema, e.VectorGetResultSchema, e.VectorItemSchema, e.VectorMatchSchema, e.VectorMetadataSchema, e.VectorMetricSchema, e.VectorQueryInputSchema, e.VectorQueryResultSchema, e.VectorStatsInputSchema, e.VectorStatsResultSchema, e.VectorUpsertInputSchema, e.VectorUpsertResultSchema, e.VibrationStatusSchema, e.VideoEncodeSchema, e.WEBRTC_EGRESS_PROFILE, e.WELL_KNOWN_TABS, e.WELL_KNOWN_TAB_MAP, e.WaterHeaterStatusSchema, e.WeatherStatusSchema, e.WebrtcStreamChoiceSchema, e.WebrtcStreamTargetSchema, e.WhiteBalanceModeSchema, e.WidgetHostEnum, e.WidgetLoginMethodSchema, e.WidgetMetadataSchema, e.WidgetRemoteSchema, e.WidgetSizeEnum, e.YAMNET_TO_MACRO, e.ZoneCrossingDirectionSchema, e.ZoneCrossingSchema, e.ZoneKindEnum, e.ZoneRuleModeEnum, e.ZoneRuleSchema, e.ZoneRuleStageEnum, e.ZoneRulesArraySchema, e.ZoneSchema, e.ZoneScopeBreakdownSchema, e.accessoriesCapability, e.accessoryStableId, e.addonPagesCapability, e.addonPagesSourceCapability, e.addonRoutesCapability, e.addonSettingsCapability, e.addonWidgetsCapability, e.addonWidgetsSourceCapability, e.addonsCapability, e.adminUiCapability, e.airQualitySensorCapability, e.alarmPanelCapability, e.alertsCapability, e.ambientLightSensorCapability, e.applyTransform, e.asBoolean, e.asJsonArray, e.asJsonObject, e.asNumber, e.asString, e.audioAnalysisCapability, e.audioAnalyzerCapability, e.audioCodecCapability, e.audioMetricsCapability, e.audioPlanFromEncodeProfile, e.authProviderCapability, e.autoAssignProfiles, e.automationControlCapability, e.backupCapability, e.batteryCapability, e.bestLocationMatch, e.binaryCapability, e.bindAddonActions, e.brightnessCapability, e.brokerCapability, e.buildAddonRouteProvider, e.buildAudioArgs, e.buildEventKindDescriptor, e.buildFfmpegArgs, e.buildInputArgs, e.buildModelVariantGroups, e.buildNcTaxonomy, e.buildStreamParamsConfigSchema, e.buildVideoArgs, e.buttonCapability, e.cameraCredentialsCapability, e.cameraPipelineConfigCapability, e.cameraStreamsCapability, e.canConvertUnit, e.canonicalEgressPlan, e.carbonMonoxideCapability, e.cellsToRects, e.classifyStream, e.classifyStreams, e.climateControlCapability, e.collectHydratedFieldEntries, e.collectHydratedFieldValues, e.colorCapability, e.colorForKind, e.compileExpression, e.compileExpressionSafe, e.connectivityCapability, e.consumablesCapability, e.contactCapability, e.controlCapability, e.convertUnit, e.coreBlocksCapability, e.cosineSimilarity, e.coverCapability, e.createDeviceProxy, e.createDurableState, e.createEvent, e.createExpressionScope, e.createHwAccelCache, e.createLazyTrpcSource, e.createMirrorSource, e.createRuntimeStateBridge, e.createSliceHandle, e.createSystemProxy, e.customAction, e.customModelRegistryCapability, e.dataStoreProviderCapability, e.dayNightCapability, e.decodeVectorBase64, e.decoderCapability, e.defaultDeviceFor, e.defineCustomActions, e.deriveCameraSwitches, e.deriveDetailCropRect, e.deriveRecordingMode, e.describeModelVariant, e.detectionPipelineCapability, e.deviceAdoptionCapability, e.deviceBackendToFormat, e.deviceCustomAction, e.deviceDiscoveryCapability, e.deviceExportCapability, e.deviceManagerCapability, e.deviceMatchesProfile, e.deviceOpsCapability, e.deviceProviderCapability, e.deviceStateCapability, e.deviceStatusCapability, e.doorbellCapability, e.egressTranscodeSharingKey, e.embeddingEncoderCapability, e.emitDownForOwnedCaps, e.emitReadiness, e.encodeProfileFromStreamShape, e.encodeVectorBase64, e.enumSensorCapability, e.enumerateInferenceDevices, e.enumerateItemArrayFields, e.enumerateSchemaFields, e.errMsg, e.evaluateAst, e.evaluateLinkExpression, e.evaluateZoneRules, e.event, e.eventEmitterCapability, e.eventsCapability, e.expandCapMethods, e.extractNestedAddonId, e.extractSourceInfoFromMetadata, e.faceGalleryCapability, e.fanControlCapability, e.featureProbeCapability, e.filesystemBrowseCapability, e.findTimezone, e.floodCapability, e.formatForBackend, e.formatForRuntime, e.gasCapability, e.getAudioMacroClassIds, e.getByPath, e.getCapsByProviderKind, e.getTaxonomyEntry, e.hasMotionTrigger, e.hfModelUrl, e.htmlToText, e.humidifierCapability, e.humiditySensorCapability, e.hydrateSchema, e.imageCapability, e.imageSettingsCapability, e.integrationsCapability, e.intercomCapability, e.invocationFromEncodeProfile, e.isAgentOnlyPlacement, e.isArrayOutputSchema, e.isBaseConditionKey, e.isCollectionArrayMethod, e.isDeployableToAgent, e.isDeviceConfigCap, e.isDeviceScopedCap, e.isEvent, e.isNode, e.isObjectInput, e.isSoftwareDecode, e.isVoidInput, e.jobKindSchema, e.kebabToCamel, e.knownValues, e.lawnMowerControlCapability, e.lifecycleJobSchema, e.lifecycleJobScopeSchema, e.lifecycleJobStateSchema, e.lifecycleTaskSchema, e.llmCapability, e.llmRuntimeCapability, e.localNetworkCapability, e.locationSimilarity, e.lockControlCapability, e.logBannerArgs, e.logDestinationCapability, e.logLevelAtMost, e.loginMethodCapability, e.looseSchema, e.makeProfileBrokerId, a = e.makeSourceBrokerId, e.mapAudioLabelToMacro, e.markdownToHtmlLite, e.markdownToText, e.maskUrlCredentials, e.mediaPlayerCapability, e.mergeSourceInfo, e.meshNetworkCapability, e.method, e.metricsProviderCapability, e.modelConvertCapability, e.modelDistributorCapability, e.modelFormatForRuntime, e.motionCapability, e.motionDetectionCapability, e.motionTriggerCapability, e.motionZonesCapability, e.mqttBrokerCapability, e.nativeObjectDetectionCapability, e.networkAccessCapability, e.networkQualityCapability, e.nodePin, e.nodesCapability, e.normalizeAddonInitResult, e.normalizeUnit, e.notificationOutputCapability, e.notificationRulesCapability, e.notifierCapability, e.numericSensorCapability, e.oauthIntegrationCapability, e.objectInputDeclaresAddonId, e.osdCapability, e.parseCameraStreamConfig, e.parseExpression, e.parseJsonArray, e.parseJsonObject, e.parseJsonUnknown, e.parseProfileBrokerId, e.parseStreamParamsFormPatch, e.petFeederCapability, e.pickAccessoryControl, e.pickDetailCropConvention, e.pickPreferredRtspEntry, e.pickVideoEncoder, e.pickerForCondition, e.pipelineAnalyticsCapability, e.pipelineExecutorCapability, e.pipelineOrchestratorCapability, e.pipelineRunnerCapability, e.plateGalleryCapability, e.platformProbeCapability, e.powerMeterCapability, e.prepareNotification, e.presenceCapability, e.pressureSensorCapability, e.privacyMaskCapability, e.procedureAuthKey, e.ptzAutotrackCapability, e.ptzCapability, e.pythonScriptForBackend, e.readDetailCropConvention, e.readDeviceStateFrom, e.readNodePin, e.readinessKey, e.rebootCapability, e.recordingCapability, e.recordingExportCapability, e.rectsToCells, e.requiresPython, e.resolveAddonExecution, e.resolveAddonGroup, e.resolveAddonPlacement, e.resolveAddonRuntime, e.resolveCapMount, e.resolveDetectionRuntime, e.resolveDeviceControlKind, e.resolveDeviceProfile, e.resolveEgressDecodeHwAccel, e.resolveFormat, e.resolveHydratedFieldValue, e.resolveModelFormat, e.resolveMutate, e.resolveRunnerId, e.resolveScrubThumbnailGeometry, e.resolveVariantModelId, e.runInferenceStep, e.runtimeDevices, e.sceneMonitorCapability, e.scopeKey, e.scoreRuntimes, e.scriptRunnerCapability, e.selectAssignedProfileSlots, e.serverManagementCapability, e.setByPath, e.settingsStoreCapability, e.sleep, e.sleepCancellable, e.smokeCapability, e.smtpProviderCapability, e.snapshotCapability, e.ssoBridgeCapability, e.startReachabilityPoll, e.stateVocabularyFor, e.storageCapability, e.storageEvictableCapability, e.storageProviderCapability, e.streamBrokerCapability, e.streamCatalogCapability, e.streamParamsCapability, e.streamPixels, e.streamQualityLabel, e.subKindsOf, e.supportedRuntimes, e.switchCapability, e.switchedOffIds, e.synthesizeSourceInfo, e.systemCapability, e.tamperCapability, e.taskLogEntrySchema, e.taskPhaseSchema, e.taskTargetSchema, e.temperatureSensorCapability, e.terminalSessionCapability, e.textToHtml, e.toDeviceSummary, e.toExpressionValue, e.toStreamSourceEntry, e.toastCapability, e.tokenize, e.transcodeBody, e.tryConvertUnit, e.turnProviderCapability, e.unitDimension, e.unitsForDimension, e.updateCapability, e.userManagementCapability, e.userPasskeysCapability, e.vacuumControlCapability, e.validateExpressionSource, e.valveCapability, e.vectorDimFromBase64, e.vectorStoreCapability, e.vibrationCapability, e.videoclipsCapability, e.viewerUiCapability, e.waterHeaterCapability, e.weatherCapability, e.webrtcClientHintsSchema, e.webrtcSessionCapability, e.wiringAddonHealthSchema, e.wiringHealthSnapshotSchema, e.wiringNodeHealthSchema, e.wiringProbeKindSchema, e.wiringProbeResultSchema, e.zodEntriesToConfigUI, e.zoneAnalyticsCapability, e.zoneRulesCapability, e.zonesCapability, e.default;
|
|
20
|
-
}, s = i.share["default:@camstack/types"];
|
|
21
|
-
s === void 0 ? n.then(() => {
|
|
22
|
-
if (s = i.share["default:@camstack/types"], s === void 0) throw Error("[Module Federation] Shared module @camstack/types was imported before federation bootstrap finished.");
|
|
23
|
-
o(s);
|
|
24
|
-
}) : o(s);
|
|
25
|
-
//#endregion
|
|
26
|
-
export { a as t };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
//#region src/session-decode/worker-protocol.ts
|
|
2
|
-
/**
|
|
3
|
-
* Classify a worker diagnostic line into a {@link WorkerLogLevel}. Failure /
|
|
4
|
-
* fault lines surface at `warn` (visible at the default log level so a
|
|
5
|
-
* native-crop failure is finally seen in `addons.getLogs`); routine
|
|
6
|
-
* provenance / transition / lifecycle lines stay `debug`. Pure + exported so
|
|
7
|
-
* the mapping is unit-testable without spawning a worker.
|
|
8
|
-
*/
|
|
9
|
-
function logLevelForLine(line) {
|
|
10
|
-
return /\b(fail(?:ed|ure)?|error|exception|unhandled rejection|corrupt|EIO|EINVAL)\b/i.test(line) ? "warn" : "debug";
|
|
11
|
-
}
|
|
12
|
-
function isRecord(value) {
|
|
13
|
-
return typeof value === "object" && value !== null;
|
|
14
|
-
}
|
|
15
|
-
function isFiniteNumber(value) {
|
|
16
|
-
return typeof value === "number" && Number.isFinite(value);
|
|
17
|
-
}
|
|
18
|
-
function isWorkerFrameFormat(value) {
|
|
19
|
-
return value === "rgb" || value === "gray";
|
|
20
|
-
}
|
|
21
|
-
function isWorkerLogLevel(value) {
|
|
22
|
-
return value === "debug" || value === "info" || value === "warn" || value === "error";
|
|
23
|
-
}
|
|
24
|
-
function isWorkerCropRegion(value) {
|
|
25
|
-
return isRecord(value) && isFiniteNumber(value.left) && isFiniteNumber(value.top) && isFiniteNumber(value.width) && isFiniteNumber(value.height);
|
|
26
|
-
}
|
|
27
|
-
function isWorkerResizeTarget(value) {
|
|
28
|
-
return isRecord(value) && isFiniteNumber(value.width) && isFiniteNumber(value.height);
|
|
29
|
-
}
|
|
30
|
-
function isFrameImageOptions(value) {
|
|
31
|
-
if (!isRecord(value)) return false;
|
|
32
|
-
if (value.crop !== void 0 && !isWorkerCropRegion(value.crop)) return false;
|
|
33
|
-
if (value.resize !== void 0 && !isWorkerResizeTarget(value.resize)) return false;
|
|
34
|
-
if (value.format !== void 0 && !isWorkerFrameFormat(value.format)) return false;
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
function isNormalizedBbox(value) {
|
|
38
|
-
return isRecord(value) && isFiniteNumber(value.x) && isFiniteNumber(value.y) && isFiniteNumber(value.w) && isFiniteNumber(value.h);
|
|
39
|
-
}
|
|
40
|
-
function isVideoFrameSource(value) {
|
|
41
|
-
return isRecord(value) && typeof value.restreamUrl === "string" && isFiniteNumber(value.deviceId) && typeof value.codec === "string";
|
|
42
|
-
}
|
|
43
|
-
function isVideoFrameGenOptions(value) {
|
|
44
|
-
if (!isRecord(value)) return false;
|
|
45
|
-
if (value.fps !== void 0 && !isFiniteNumber(value.fps)) return false;
|
|
46
|
-
if (value.format !== void 0 && !isWorkerFrameFormat(value.format)) return false;
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
/** Discriminated-union guard for {@link WorkerRequest} — no `as` casts. */
|
|
50
|
-
function isWorkerRequest(value) {
|
|
51
|
-
if (!isRecord(value)) return false;
|
|
52
|
-
switch (value.kind) {
|
|
53
|
-
case "start": return isVideoFrameSource(value.source) && isVideoFrameGenOptions(value.opts);
|
|
54
|
-
case "pull": return true;
|
|
55
|
-
case "toBuffer": return isFiniteNumber(value.frameId) && (value.opts === void 0 || isFrameImageOptions(value.opts));
|
|
56
|
-
case "nativeCrop": return isFiniteNumber(value.requestId) && isFiniteNumber(value.frameId) && isNormalizedBbox(value.bbox) && (value.maxWidth === void 0 || isFiniteNumber(value.maxWidth));
|
|
57
|
-
case "releaseNativeLease": return isFiniteNumber(value.frameId);
|
|
58
|
-
case "stop": return true;
|
|
59
|
-
default: return false;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/** Discriminated-union guard for {@link WorkerReply} — no `as` casts. */
|
|
63
|
-
function isWorkerReply(value) {
|
|
64
|
-
if (!isRecord(value)) return false;
|
|
65
|
-
switch (value.kind) {
|
|
66
|
-
case "frame": return isFiniteNumber(value.frameId) && isFiniteNumber(value.timestamp) && isFiniteNumber(value.width) && isFiniteNumber(value.height) && isWorkerFrameFormat(value.format);
|
|
67
|
-
case "buffer": return isFiniteNumber(value.frameId) && value.bytes instanceof Uint8Array;
|
|
68
|
-
case "nativeCropResult": return isFiniteNumber(value.requestId) && value.bytes instanceof Uint8Array && isFiniteNumber(value.width) && isFiniteNumber(value.height);
|
|
69
|
-
case "nativeCropMiss": return isFiniteNumber(value.requestId) && (value.reason === void 0 || typeof value.reason === "string");
|
|
70
|
-
case "ended": return true;
|
|
71
|
-
case "error": return typeof value.message === "string" && (value.frameId === void 0 || isFiniteNumber(value.frameId));
|
|
72
|
-
case "log": return isWorkerLogLevel(value.level) && typeof value.message === "string";
|
|
73
|
-
default: return false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
export { isWorkerRequest as n, logLevelForLine as r, isWorkerReply as t };
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
//#region src/session-decode/worker-protocol.ts
|
|
2
|
-
/**
|
|
3
|
-
* Classify a worker diagnostic line into a {@link WorkerLogLevel}. Failure /
|
|
4
|
-
* fault lines surface at `warn` (visible at the default log level so a
|
|
5
|
-
* native-crop failure is finally seen in `addons.getLogs`); routine
|
|
6
|
-
* provenance / transition / lifecycle lines stay `debug`. Pure + exported so
|
|
7
|
-
* the mapping is unit-testable without spawning a worker.
|
|
8
|
-
*/
|
|
9
|
-
function logLevelForLine(line) {
|
|
10
|
-
return /\b(fail(?:ed|ure)?|error|exception|unhandled rejection|corrupt|EIO|EINVAL)\b/i.test(line) ? "warn" : "debug";
|
|
11
|
-
}
|
|
12
|
-
function isRecord(value) {
|
|
13
|
-
return typeof value === "object" && value !== null;
|
|
14
|
-
}
|
|
15
|
-
function isFiniteNumber(value) {
|
|
16
|
-
return typeof value === "number" && Number.isFinite(value);
|
|
17
|
-
}
|
|
18
|
-
function isWorkerFrameFormat(value) {
|
|
19
|
-
return value === "rgb" || value === "gray";
|
|
20
|
-
}
|
|
21
|
-
function isWorkerLogLevel(value) {
|
|
22
|
-
return value === "debug" || value === "info" || value === "warn" || value === "error";
|
|
23
|
-
}
|
|
24
|
-
function isWorkerCropRegion(value) {
|
|
25
|
-
return isRecord(value) && isFiniteNumber(value.left) && isFiniteNumber(value.top) && isFiniteNumber(value.width) && isFiniteNumber(value.height);
|
|
26
|
-
}
|
|
27
|
-
function isWorkerResizeTarget(value) {
|
|
28
|
-
return isRecord(value) && isFiniteNumber(value.width) && isFiniteNumber(value.height);
|
|
29
|
-
}
|
|
30
|
-
function isFrameImageOptions(value) {
|
|
31
|
-
if (!isRecord(value)) return false;
|
|
32
|
-
if (value.crop !== void 0 && !isWorkerCropRegion(value.crop)) return false;
|
|
33
|
-
if (value.resize !== void 0 && !isWorkerResizeTarget(value.resize)) return false;
|
|
34
|
-
if (value.format !== void 0 && !isWorkerFrameFormat(value.format)) return false;
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
function isNormalizedBbox(value) {
|
|
38
|
-
return isRecord(value) && isFiniteNumber(value.x) && isFiniteNumber(value.y) && isFiniteNumber(value.w) && isFiniteNumber(value.h);
|
|
39
|
-
}
|
|
40
|
-
function isVideoFrameSource(value) {
|
|
41
|
-
return isRecord(value) && typeof value.restreamUrl === "string" && isFiniteNumber(value.deviceId) && typeof value.codec === "string";
|
|
42
|
-
}
|
|
43
|
-
function isVideoFrameGenOptions(value) {
|
|
44
|
-
if (!isRecord(value)) return false;
|
|
45
|
-
if (value.fps !== void 0 && !isFiniteNumber(value.fps)) return false;
|
|
46
|
-
if (value.format !== void 0 && !isWorkerFrameFormat(value.format)) return false;
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
/** Discriminated-union guard for {@link WorkerRequest} — no `as` casts. */
|
|
50
|
-
function isWorkerRequest(value) {
|
|
51
|
-
if (!isRecord(value)) return false;
|
|
52
|
-
switch (value.kind) {
|
|
53
|
-
case "start": return isVideoFrameSource(value.source) && isVideoFrameGenOptions(value.opts);
|
|
54
|
-
case "pull": return true;
|
|
55
|
-
case "toBuffer": return isFiniteNumber(value.frameId) && (value.opts === void 0 || isFrameImageOptions(value.opts));
|
|
56
|
-
case "nativeCrop": return isFiniteNumber(value.requestId) && isFiniteNumber(value.frameId) && isNormalizedBbox(value.bbox) && (value.maxWidth === void 0 || isFiniteNumber(value.maxWidth));
|
|
57
|
-
case "releaseNativeLease": return isFiniteNumber(value.frameId);
|
|
58
|
-
case "stop": return true;
|
|
59
|
-
default: return false;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/** Discriminated-union guard for {@link WorkerReply} — no `as` casts. */
|
|
63
|
-
function isWorkerReply(value) {
|
|
64
|
-
if (!isRecord(value)) return false;
|
|
65
|
-
switch (value.kind) {
|
|
66
|
-
case "frame": return isFiniteNumber(value.frameId) && isFiniteNumber(value.timestamp) && isFiniteNumber(value.width) && isFiniteNumber(value.height) && isWorkerFrameFormat(value.format);
|
|
67
|
-
case "buffer": return isFiniteNumber(value.frameId) && value.bytes instanceof Uint8Array;
|
|
68
|
-
case "nativeCropResult": return isFiniteNumber(value.requestId) && value.bytes instanceof Uint8Array && isFiniteNumber(value.width) && isFiniteNumber(value.height);
|
|
69
|
-
case "nativeCropMiss": return isFiniteNumber(value.requestId) && (value.reason === void 0 || typeof value.reason === "string");
|
|
70
|
-
case "ended": return true;
|
|
71
|
-
case "error": return typeof value.message === "string" && (value.frameId === void 0 || isFiniteNumber(value.frameId));
|
|
72
|
-
case "log": return isWorkerLogLevel(value.level) && typeof value.message === "string";
|
|
73
|
-
default: return false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
Object.defineProperty(exports, "isWorkerReply", {
|
|
78
|
-
enumerable: true,
|
|
79
|
-
get: function() {
|
|
80
|
-
return isWorkerReply;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
Object.defineProperty(exports, "isWorkerRequest", {
|
|
84
|
-
enumerable: true,
|
|
85
|
-
get: function() {
|
|
86
|
-
return isWorkerRequest;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
Object.defineProperty(exports, "logLevelForLine", {
|
|
90
|
-
enumerable: true,
|
|
91
|
-
get: function() {
|
|
92
|
-
return logLevelForLine;
|
|
93
|
-
}
|
|
94
|
-
});
|