supervision 0.1.4 → 0.1.5
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 +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +432 -83
- package/dist/index.js.map +1 -1
- package/dist/mask-preparation.worker.js +67 -59
- package/dist/mask-preparation.worker.js.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/tracking.worker.js +1485 -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/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/index.d.ts +6 -0
- package/node_modules/supervision-js-core/dist/index.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/index.js +1600 -255
- 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/detections.d.ts +11 -3
- package/node_modules/supervision-js-core/dist/types/detections.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/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) {
|