supervision 0.1.4 → 0.1.6
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/index.d.ts +12 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +864 -127
- package/dist/index.js.map +1 -1
- package/dist/mask-preparation.worker.js +91 -59
- package/dist/mask-preparation.worker.js.map +1 -1
- package/dist/media/media-errors.d.ts +32 -0
- package/dist/media/media-errors.d.ts.map +1 -0
- package/dist/media/media-source-state.d.ts.map +1 -1
- package/dist/media/media-stream-media-source.d.ts +31 -0
- package/dist/media/media-stream-media-source.d.ts.map +1 -1
- package/dist/media/mediabunny-media-source.d.ts.map +1 -1
- package/dist/media/presentation-timeline-media-source.d.ts +17 -0
- package/dist/media/presentation-timeline-media-source.d.ts.map +1 -0
- package/dist/media/static-image-media-source.d.ts.map +1 -1
- package/dist/post-processing/default-tracking-worker.d.ts +3 -0
- package/dist/post-processing/default-tracking-worker.d.ts.map +1 -0
- package/dist/post-processing/detection-post-processing-pipeline.d.ts +7 -0
- package/dist/post-processing/detection-post-processing-pipeline.d.ts.map +1 -0
- package/dist/post-processing/embedded-tracking-worker.d.ts +2 -0
- package/dist/post-processing/embedded-tracking-worker.d.ts.map +1 -0
- package/dist/post-processing/tracking-worker-protocol.d.ts +29 -0
- package/dist/post-processing/tracking-worker-protocol.d.ts.map +1 -0
- package/dist/post-processing/tracking.worker.d.ts +2 -0
- package/dist/post-processing/tracking.worker.d.ts.map +1 -0
- package/dist/renderers/media-renderer-core.d.ts.map +1 -1
- package/dist/renderers/media-renderer-state.d.ts.map +1 -1
- package/dist/sessions/media-session-detections.d.ts.map +1 -1
- package/dist/sessions/media-session.d.ts +2 -2
- package/dist/sessions/media-session.d.ts.map +1 -1
- package/dist/tracking.worker.js +1509 -0
- package/dist/tracking.worker.js.map +1 -0
- package/dist/types/detection-post-processing.d.ts +62 -0
- package/dist/types/detection-post-processing.d.ts.map +1 -0
- package/dist/types/media-session.d.ts +57 -1
- package/dist/types/media-session.d.ts.map +1 -1
- package/dist/workers/worker-rpc-client.d.ts +2 -1
- package/dist/workers/worker-rpc-client.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/detections/composite-detection-frame-source.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/detections/memory-cold-detection-frame-store.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/detections/projected-detection-frame-source.d.ts +22 -0
- package/node_modules/supervision-js-core/dist/detections/projected-detection-frame-source.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/detections/writable-detection-frame-source.d.ts +2 -7
- package/node_modules/supervision-js-core/dist/detections/writable-detection-frame-source.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/index.d.ts +11 -3
- package/node_modules/supervision-js-core/dist/index.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/index.js +2289 -329
- package/node_modules/supervision-js-core/dist/index.js.map +1 -1
- package/node_modules/supervision-js-core/dist/post-processing/byte-track-tracker.d.ts +4 -0
- package/node_modules/supervision-js-core/dist/post-processing/byte-track-tracker.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/post-processing/cbiou-tracker.d.ts +4 -0
- package/node_modules/supervision-js-core/dist/post-processing/cbiou-tracker.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/post-processing/oc-sort-tracker.d.ts +4 -0
- package/node_modules/supervision-js-core/dist/post-processing/oc-sort-tracker.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/post-processing/sort-tracker.d.ts +4 -0
- package/node_modules/supervision-js-core/dist/post-processing/sort-tracker.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/post-processing/tracking.d.ts +9 -0
- package/node_modules/supervision-js-core/dist/post-processing/tracking.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts +113 -3
- package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/detections.d.ts +33 -3
- package/node_modules/supervision-js-core/dist/types/detections.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts +31 -0
- package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/post-processing.d.ts +148 -0
- package/node_modules/supervision-js-core/dist/types/post-processing.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/utils/detection-projection.d.ts +20 -0
- package/node_modules/supervision-js-core/dist/utils/detection-projection.d.ts.map +1 -0
- package/node_modules/supervision-js-core/package.json +12 -5
- package/package.json +7 -2
|
@@ -138,22 +138,56 @@
|
|
|
138
138
|
AnnotationFrameMutationKind["Update"] = "update";
|
|
139
139
|
})(AnnotationFrameMutationKind || (AnnotationFrameMutationKind = {}));
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
141
|
+
/** Geometry projected into a tracker. The original detection payload is retained. */
|
|
142
|
+
var TrackingGeometry;
|
|
143
|
+
(function (TrackingGeometry) {
|
|
144
|
+
TrackingGeometry["Box"] = "box";
|
|
145
|
+
TrackingGeometry["Mask"] = "mask";
|
|
146
|
+
TrackingGeometry["Keypoints"] = "keypoints";
|
|
147
|
+
})(TrackingGeometry || (TrackingGeometry = {}));
|
|
148
|
+
|
|
149
|
+
var DetectionMaskPayloadFormat;
|
|
150
|
+
(function (DetectionMaskPayloadFormat) {
|
|
151
|
+
DetectionMaskPayloadFormat["RawCocoRle"] = "rawCocoRle";
|
|
152
|
+
DetectionMaskPayloadFormat["DeflatedBase64"] = "deflatedBase64";
|
|
153
|
+
})(DetectionMaskPayloadFormat || (DetectionMaskPayloadFormat = {}));
|
|
154
|
+
function encodeBinaryMask(data, width, height) {
|
|
155
|
+
assertMaskDimensions(data, width, height);
|
|
156
|
+
const runs = [];
|
|
157
|
+
let currentValue = 0;
|
|
158
|
+
let runLength = 0;
|
|
159
|
+
for (let x = 0; x < width; x += 1) {
|
|
160
|
+
for (let y = 0; y < height; y += 1) {
|
|
161
|
+
const value = data[y * width + x] ? 1 : 0;
|
|
162
|
+
if (value === currentValue) {
|
|
163
|
+
runLength += 1;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
runs.push(runLength);
|
|
167
|
+
currentValue = value;
|
|
168
|
+
runLength = 1;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
runs.push(runLength);
|
|
173
|
+
return {
|
|
174
|
+
counts: encodeCompressedRleCounts(runs),
|
|
175
|
+
encoding: DetectionMaskEncoding.CompressedRle,
|
|
176
|
+
height,
|
|
177
|
+
width,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function assertMaskDimensions(data, width, height) {
|
|
181
|
+
if (!Number.isInteger(width) || width <= 0) {
|
|
182
|
+
throw new Error("Mask width must be a positive integer.");
|
|
183
|
+
}
|
|
184
|
+
if (!Number.isInteger(height) || height <= 0) {
|
|
185
|
+
throw new Error("Mask height must be a positive integer.");
|
|
186
|
+
}
|
|
187
|
+
if (data.length !== width * height) {
|
|
188
|
+
throw new Error("Mask data length must equal width * height.");
|
|
189
|
+
}
|
|
190
|
+
}
|
|
157
191
|
|
|
158
192
|
function centerRectToTopLeftRect(rect) {
|
|
159
193
|
return {
|
|
@@ -185,6 +219,23 @@
|
|
|
185
219
|
};
|
|
186
220
|
}
|
|
187
221
|
|
|
222
|
+
var DetectionPickTarget;
|
|
223
|
+
(function (DetectionPickTarget) {
|
|
224
|
+
DetectionPickTarget["Box"] = "box";
|
|
225
|
+
DetectionPickTarget["Edge"] = "edge";
|
|
226
|
+
DetectionPickTarget["Keypoint"] = "keypoint";
|
|
227
|
+
DetectionPickTarget["Label"] = "label";
|
|
228
|
+
DetectionPickTarget["Mask"] = "mask";
|
|
229
|
+
DetectionPickTarget["Polygon"] = "polygon";
|
|
230
|
+
DetectionPickTarget["Polyline"] = "polyline";
|
|
231
|
+
})(DetectionPickTarget || (DetectionPickTarget = {}));
|
|
232
|
+
var MediaInteractionMode;
|
|
233
|
+
(function (MediaInteractionMode) {
|
|
234
|
+
MediaInteractionMode["Always"] = "always";
|
|
235
|
+
MediaInteractionMode["Disabled"] = "disabled";
|
|
236
|
+
MediaInteractionMode["PausedOnly"] = "pausedOnly";
|
|
237
|
+
})(MediaInteractionMode || (MediaInteractionMode = {}));
|
|
238
|
+
|
|
188
239
|
var AnnotationGeometryKind;
|
|
189
240
|
(function (AnnotationGeometryKind) {
|
|
190
241
|
AnnotationGeometryKind["Box"] = "box";
|
|
@@ -289,49 +340,6 @@
|
|
|
289
340
|
KeypointMarkerShape["Circle"] = "circle";
|
|
290
341
|
KeypointMarkerShape["Cross"] = "cross";
|
|
291
342
|
})(KeypointMarkerShape || (KeypointMarkerShape = {}));
|
|
292
|
-
|
|
293
|
-
var DetectionMaskPayloadFormat;
|
|
294
|
-
(function (DetectionMaskPayloadFormat) {
|
|
295
|
-
DetectionMaskPayloadFormat["RawCocoRle"] = "rawCocoRle";
|
|
296
|
-
DetectionMaskPayloadFormat["DeflatedBase64"] = "deflatedBase64";
|
|
297
|
-
})(DetectionMaskPayloadFormat || (DetectionMaskPayloadFormat = {}));
|
|
298
|
-
function encodeBinaryMask(data, width, height) {
|
|
299
|
-
assertMaskDimensions(data, width, height);
|
|
300
|
-
const runs = [];
|
|
301
|
-
let currentValue = 0;
|
|
302
|
-
let runLength = 0;
|
|
303
|
-
for (let x = 0; x < width; x += 1) {
|
|
304
|
-
for (let y = 0; y < height; y += 1) {
|
|
305
|
-
const value = data[y * width + x] ? 1 : 0;
|
|
306
|
-
if (value === currentValue) {
|
|
307
|
-
runLength += 1;
|
|
308
|
-
}
|
|
309
|
-
else {
|
|
310
|
-
runs.push(runLength);
|
|
311
|
-
currentValue = value;
|
|
312
|
-
runLength = 1;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
runs.push(runLength);
|
|
317
|
-
return {
|
|
318
|
-
counts: encodeCompressedRleCounts(runs),
|
|
319
|
-
encoding: DetectionMaskEncoding.CompressedRle,
|
|
320
|
-
height,
|
|
321
|
-
width,
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
function assertMaskDimensions(data, width, height) {
|
|
325
|
-
if (!Number.isInteger(width) || width <= 0) {
|
|
326
|
-
throw new Error("Mask width must be a positive integer.");
|
|
327
|
-
}
|
|
328
|
-
if (!Number.isInteger(height) || height <= 0) {
|
|
329
|
-
throw new Error("Mask height must be a positive integer.");
|
|
330
|
-
}
|
|
331
|
-
if (data.length !== width * height) {
|
|
332
|
-
throw new Error("Mask data length must equal width * height.");
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
343
|
function rasterizePolygonToMask(points, dimensions) {
|
|
336
344
|
const data = createEmptyMask(dimensions);
|
|
337
345
|
if (points.length < 3) {
|
|
@@ -454,6 +462,30 @@
|
|
|
454
462
|
MediaRendererPlaybackState["Error"] = "error";
|
|
455
463
|
MediaRendererPlaybackState["Destroyed"] = "destroyed";
|
|
456
464
|
})(MediaRendererPlaybackState || (MediaRendererPlaybackState = {}));
|
|
465
|
+
/**
|
|
466
|
+
* Stable classification of a media failure.
|
|
467
|
+
*
|
|
468
|
+
* Applications branch on these kinds instead of parsing decoder, demuxer, or
|
|
469
|
+
* container error text, and still own their localized user-facing copy. New
|
|
470
|
+
* kinds may be added over time, so treat unrecognized values like `Unknown`.
|
|
471
|
+
*/
|
|
472
|
+
var MediaErrorKind;
|
|
473
|
+
(function (MediaErrorKind) {
|
|
474
|
+
/** The media could not be opened or read at all. */
|
|
475
|
+
MediaErrorKind["Unreadable"] = "unreadable";
|
|
476
|
+
/** The container or codec is not supported by this platform. */
|
|
477
|
+
MediaErrorKind["UnsupportedFormat"] = "unsupportedFormat";
|
|
478
|
+
/** The media opened but carries no usable video track. */
|
|
479
|
+
MediaErrorKind["NoVideoTrack"] = "noVideoTrack";
|
|
480
|
+
/** Decoding a sample failed after the source opened. */
|
|
481
|
+
MediaErrorKind["Decode"] = "decode";
|
|
482
|
+
/** The media could not be fetched. */
|
|
483
|
+
MediaErrorKind["Network"] = "network";
|
|
484
|
+
/** The host environment lacks the APIs this media source requires. */
|
|
485
|
+
MediaErrorKind["EnvironmentUnsupported"] = "environmentUnsupported";
|
|
486
|
+
/** The failure could not be classified. */
|
|
487
|
+
MediaErrorKind["Unknown"] = "unknown";
|
|
488
|
+
})(MediaErrorKind || (MediaErrorKind = {}));
|
|
457
489
|
/**
|
|
458
490
|
* Lower-level media source readiness.
|
|
459
491
|
*/
|