@mediapipe/tasks-vision 0.10.0 → 0.10.2-rc1
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/README.md +58 -32
- package/package.json +5 -2
- package/vision.d.ts +98 -32
- package/vision_bundle.cjs +2 -0
- package/vision_bundle.cjs.map +1 -0
- package/vision_bundle.mjs +2 -0
- package/vision_bundle.mjs.map +1 -0
- package/wasm/vision_wasm_internal.wasm +0 -0
- package/wasm/vision_wasm_nosimd_internal.wasm +0 -0
- package/vision_bundle.js +0 -1
- package/wasm/vision_wasm_internal.js +0 -8495
- package/wasm/vision_wasm_nosimd_internal.js +0 -8485
package/README.md
CHANGED
|
@@ -2,23 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
This package contains the vision tasks for MediaPipe.
|
|
4
4
|
|
|
5
|
-
## Face
|
|
5
|
+
## Face Detector
|
|
6
6
|
|
|
7
7
|
The MediaPipe Face Detector task lets you detect the presence and location of
|
|
8
8
|
faces within images or videos.
|
|
9
9
|
|
|
10
10
|
```
|
|
11
11
|
const vision = await FilesetResolver.forVisionTasks(
|
|
12
|
-
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision
|
|
12
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
13
13
|
);
|
|
14
14
|
const faceDetector = await FaceDetector.createFromModelPath(vision,
|
|
15
|
-
"https://storage.googleapis.com/mediapipe-
|
|
15
|
+
"https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite"
|
|
16
16
|
);
|
|
17
17
|
const image = document.getElementById("image") as HTMLImageElement;
|
|
18
18
|
const detections = faceDetector.detect(image);
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
For more information, refer to the [Face Detector](https://developers.google.com/mediapipe/solutions/vision/face_detector/web_js) documentation.
|
|
22
|
+
|
|
23
|
+
## Face Landmarker
|
|
22
24
|
|
|
23
25
|
The MediaPipe Face Landmarker task lets you detect the landmarks of faces in
|
|
24
26
|
an image. You can use this Task to localize key points of a face and render
|
|
@@ -26,31 +28,33 @@ visual effects over the faces.
|
|
|
26
28
|
|
|
27
29
|
```
|
|
28
30
|
const vision = await FilesetResolver.forVisionTasks(
|
|
29
|
-
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision
|
|
31
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
30
32
|
);
|
|
31
33
|
const faceLandmarker = await FaceLandmarker.createFromModelPath(vision,
|
|
32
|
-
"https://storage.googleapis.com/mediapipe-
|
|
34
|
+
"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task`"
|
|
33
35
|
);
|
|
34
36
|
const image = document.getElementById("image") as HTMLImageElement;
|
|
35
37
|
const landmarks = faceLandmarker.detect(image);
|
|
36
38
|
```
|
|
37
39
|
|
|
40
|
+
For more information, refer to the [Face Landmarker](https://developers.google.com/mediapipe/solutions/vision/face_landmarker/web_js) documentation.
|
|
41
|
+
|
|
38
42
|
## Face Stylizer
|
|
39
43
|
|
|
40
44
|
The MediaPipe Face Stylizer lets you perform face stylization on images.
|
|
41
45
|
|
|
42
46
|
```
|
|
43
47
|
const vision = await FilesetResolver.forVisionTasks(
|
|
44
|
-
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision
|
|
48
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
45
49
|
);
|
|
46
50
|
const faceStylizer = await FaceStylizer.createFromModelPath(vision,
|
|
47
|
-
"https://storage.googleapis.com/mediapipe-
|
|
51
|
+
"https://storage.googleapis.com/mediapipe-models/face_stylizer/blaze_face_stylizer/float32/1/blaze_face_stylizer.task"
|
|
48
52
|
);
|
|
49
53
|
const image = document.getElementById("image") as HTMLImageElement;
|
|
50
54
|
const stylizedImage = faceStylizer.stylize(image);
|
|
51
55
|
```
|
|
52
56
|
|
|
53
|
-
## Gesture
|
|
57
|
+
## Gesture Recognizer
|
|
54
58
|
|
|
55
59
|
The MediaPipe Gesture Recognizer task lets you recognize hand gestures in real
|
|
56
60
|
time, and provides the recognized hand gesture results along with the landmarks
|
|
@@ -59,16 +63,18 @@ from a user, and invoke application features that correspond to those gestures.
|
|
|
59
63
|
|
|
60
64
|
```
|
|
61
65
|
const vision = await FilesetResolver.forVisionTasks(
|
|
62
|
-
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision
|
|
66
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
63
67
|
);
|
|
64
68
|
const gestureRecognizer = await GestureRecognizer.createFromModelPath(vision,
|
|
65
|
-
"
|
|
69
|
+
"hhttps://storage.googleapis.com/mediapipe-models/gesture_recognizer/gesture_recognizer/float16/1/gesture_recognizer.task"
|
|
66
70
|
);
|
|
67
71
|
const image = document.getElementById("image") as HTMLImageElement;
|
|
68
72
|
const recognitions = gestureRecognizer.recognize(image);
|
|
69
73
|
```
|
|
70
74
|
|
|
71
|
-
|
|
75
|
+
For more information, refer to the [Gesture Recognizer](https://developers.google.com/mediapipe/solutions/vision/gesture_recognizer/web_js) documentation.
|
|
76
|
+
|
|
77
|
+
## Hand Landmarker
|
|
72
78
|
|
|
73
79
|
The MediaPipe Hand Landmarker task lets you detect the landmarks of the hands in
|
|
74
80
|
an image. You can use this Task to localize key points of the hands and render
|
|
@@ -76,18 +82,18 @@ visual effects over the hands.
|
|
|
76
82
|
|
|
77
83
|
```
|
|
78
84
|
const vision = await FilesetResolver.forVisionTasks(
|
|
79
|
-
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision
|
|
85
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
80
86
|
);
|
|
81
87
|
const handLandmarker = await HandLandmarker.createFromModelPath(vision,
|
|
82
|
-
"https://storage.googleapis.com/mediapipe-
|
|
88
|
+
"https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task"
|
|
83
89
|
);
|
|
84
90
|
const image = document.getElementById("image") as HTMLImageElement;
|
|
85
91
|
const landmarks = handLandmarker.detect(image);
|
|
86
92
|
```
|
|
87
93
|
|
|
88
|
-
For more information, refer to the [
|
|
94
|
+
For more information, refer to the [Hand Landmarker](https://developers.google.com/mediapipe/solutions/vision/hand_landmarker/web_js) documentation.
|
|
89
95
|
|
|
90
|
-
## Image
|
|
96
|
+
## Image Classifier
|
|
91
97
|
|
|
92
98
|
The MediaPipe Image Classifier task lets you perform classification on images.
|
|
93
99
|
You can use this task to identify what an image represents among a set of
|
|
@@ -95,27 +101,42 @@ categories defined at training time.
|
|
|
95
101
|
|
|
96
102
|
```
|
|
97
103
|
const vision = await FilesetResolver.forVisionTasks(
|
|
98
|
-
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision
|
|
104
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
99
105
|
);
|
|
100
106
|
const imageClassifier = await ImageClassifier.createFromModelPath(vision,
|
|
101
|
-
"https://storage.googleapis.com/mediapipe-
|
|
107
|
+
"https://storage.googleapis.com/mediapipe-models/image_classifier/efficientnet_lite0/float32/1/efficientnet_lite0.tflite"
|
|
102
108
|
);
|
|
103
109
|
const image = document.getElementById("image") as HTMLImageElement;
|
|
104
110
|
const classifications = imageClassifier.classify(image);
|
|
105
111
|
```
|
|
106
112
|
|
|
107
|
-
For more information, refer to the [Image
|
|
113
|
+
For more information, refer to the [Image Classifier](https://developers.google.com/mediapipe/solutions/vision/image_classifier/web_js) documentation.
|
|
114
|
+
|
|
115
|
+
## Image Embedder
|
|
116
|
+
|
|
117
|
+
The MediaPipe Image Embedder extracts embeddings from an image.
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
const vision = await FilesetResolver.forVisionTasks(
|
|
121
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
122
|
+
);
|
|
123
|
+
const imageEmbedder = await ImageEmbedder.createFromModelPath(vision,
|
|
124
|
+
"https://storage.googleapis.com/mediapipe-models/image_embedder/mobilenet_v3_small/float32/1/mobilenet_v3_small.tflite"
|
|
125
|
+
);
|
|
126
|
+
const image = document.getElementById("image") as HTMLImageElement;
|
|
127
|
+
const embeddings = imageSegmenter.embed(image);
|
|
128
|
+
```
|
|
108
129
|
|
|
109
|
-
## Image
|
|
130
|
+
## Image Segmenter
|
|
110
131
|
|
|
111
132
|
The MediaPipe Image Segmenter lets you segment an image into categories.
|
|
112
133
|
|
|
113
134
|
```
|
|
114
135
|
const vision = await FilesetResolver.forVisionTasks(
|
|
115
|
-
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision
|
|
136
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
116
137
|
);
|
|
117
138
|
const imageSegmenter = await ImageSegmenter.createFromModelPath(vision,
|
|
118
|
-
"https://storage.googleapis.com/mediapipe-
|
|
139
|
+
"https://storage.googleapis.com/mediapipe-models/image_segmenter/deeplab_v3/float32/1/deeplab_v3.tflite"
|
|
119
140
|
);
|
|
120
141
|
const image = document.getElementById("image") as HTMLImageElement;
|
|
121
142
|
imageSegmenter.segment(image, (masks, width, height) => {
|
|
@@ -123,18 +144,20 @@ imageSegmenter.segment(image, (masks, width, height) => {
|
|
|
123
144
|
});
|
|
124
145
|
```
|
|
125
146
|
|
|
126
|
-
|
|
147
|
+
For more information, refer to the [Image Segmenter](https://developers.google.com/mediapipe/solutions/vision/image_segmenter/web_js) documentation.
|
|
148
|
+
|
|
149
|
+
## Interactive Segmenter
|
|
127
150
|
|
|
128
151
|
The MediaPipe Interactive Segmenter lets you select a region of interest to
|
|
129
152
|
segment an image by.
|
|
130
153
|
|
|
131
154
|
```
|
|
132
155
|
const vision = await FilesetResolver.forVisionTasks(
|
|
133
|
-
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision
|
|
156
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
134
157
|
);
|
|
135
158
|
const interactiveSegmenter = await InteractiveSegmenter.createFromModelPath(
|
|
136
159
|
vision,
|
|
137
|
-
"https://storage.googleapis.com/mediapipe-
|
|
160
|
+
"https://storage.googleapis.com/mediapipe-models/interactive_segmenter/magic_touch/float32/1/magic_touch.tflite"
|
|
138
161
|
);
|
|
139
162
|
const image = document.getElementById("image") as HTMLImageElement;
|
|
140
163
|
interactiveSegmenter.segment(image, { keypoint: { x: 0.1, y: 0.2 } },
|
|
@@ -142,17 +165,19 @@ interactiveSegmenter.segment(image, { keypoint: { x: 0.1, y: 0.2 } },
|
|
|
142
165
|
);
|
|
143
166
|
```
|
|
144
167
|
|
|
145
|
-
|
|
168
|
+
For more information, refer to the [Interactive Segmenter](https://developers.google.com/mediapipe/solutions/vision/interactive_segmenter/web_js) documentation.
|
|
169
|
+
|
|
170
|
+
## Object Detector
|
|
146
171
|
|
|
147
172
|
The MediaPipe Object Detector task lets you detect the presence and location of
|
|
148
173
|
multiple classes of objects within images or videos.
|
|
149
174
|
|
|
150
175
|
```
|
|
151
176
|
const vision = await FilesetResolver.forVisionTasks(
|
|
152
|
-
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision
|
|
177
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
153
178
|
);
|
|
154
179
|
const objectDetector = await ObjectDetector.createFromModelPath(vision,
|
|
155
|
-
"https://storage.googleapis.com/mediapipe-
|
|
180
|
+
"https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite"
|
|
156
181
|
);
|
|
157
182
|
const image = document.getElementById("image") as HTMLImageElement;
|
|
158
183
|
const detections = objectDetector.detect(image);
|
|
@@ -160,8 +185,7 @@ const detections = objectDetector.detect(image);
|
|
|
160
185
|
|
|
161
186
|
For more information, refer to the [Object Detector](https://developers.google.com/mediapipe/solutions/vision/object_detector/web_js) documentation.
|
|
162
187
|
|
|
163
|
-
|
|
164
|
-
## Pose Landmark Detection
|
|
188
|
+
## Pose Landmarker
|
|
165
189
|
|
|
166
190
|
The MediaPipe Pose Landmarker task lets you detect the landmarks of body poses
|
|
167
191
|
in an image. You can use this Task to localize key points of a pose and render
|
|
@@ -169,11 +193,13 @@ visual effects over the body.
|
|
|
169
193
|
|
|
170
194
|
```
|
|
171
195
|
const vision = await FilesetResolver.forVisionTasks(
|
|
172
|
-
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision
|
|
196
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
173
197
|
);
|
|
174
198
|
const poseLandmarker = await PoseLandmarker.createFromModelPath(vision,
|
|
175
|
-
"
|
|
199
|
+
"https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task
|
|
176
200
|
);
|
|
177
201
|
const image = document.getElementById("image") as HTMLImageElement;
|
|
178
202
|
const landmarks = poseLandmarker.detect(image);
|
|
179
203
|
```
|
|
204
|
+
|
|
205
|
+
For more information, refer to the [Pose Landmarker](https://developers.google.com/mediapipe/solutions/vision/pose_landmarker/web_js) documentation.
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediapipe/tasks-vision",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2-rc1",
|
|
4
4
|
"description": "MediaPipe Vision Tasks",
|
|
5
|
-
"main": "vision_bundle.
|
|
5
|
+
"main": "vision_bundle.cjs",
|
|
6
|
+
"browser": "vision_bundle.mjs",
|
|
7
|
+
"module": "vision_bundle.mjs",
|
|
6
8
|
"author": "mediapipe@google.com",
|
|
7
9
|
"license": "Apache-2.0",
|
|
10
|
+
"type": "module",
|
|
8
11
|
"types": "vision.d.ts",
|
|
9
12
|
"homepage": "http://mediapipe.dev",
|
|
10
13
|
"keywords": [ "AR", "ML", "Augmented", "MediaPipe", "MediaPipe Tasks" ]
|
package/vision.d.ts
CHANGED
|
@@ -172,13 +172,14 @@ export declare interface Detection {
|
|
|
172
172
|
/** The bounding box of the detected objects. */
|
|
173
173
|
boundingBox?: BoundingBox;
|
|
174
174
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
|
|
181
|
-
|
|
175
|
+
* List of keypoints associated with the detection. Keypoints represent
|
|
176
|
+
* interesting points related to the detection. For example, the keypoints
|
|
177
|
+
* represent the eye, ear and mouth from face detection model. Or in the
|
|
178
|
+
* template matching detection, e.g. KNIFT, they can represent the feature
|
|
179
|
+
* points for template matching. Contains an empty list if no keypoints are
|
|
180
|
+
* detected.
|
|
181
|
+
*/
|
|
182
|
+
keypoints: NormalizedKeypoint[];
|
|
182
183
|
}
|
|
183
184
|
|
|
184
185
|
/** Detection results of a model. */
|
|
@@ -554,9 +555,9 @@ export declare interface FaceLandmarkerResult {
|
|
|
554
555
|
/** Detected face landmarks in normalized image coordinates. */
|
|
555
556
|
faceLandmarks: NormalizedLandmark[][];
|
|
556
557
|
/** Optional face blendshapes results. */
|
|
557
|
-
faceBlendshapes
|
|
558
|
+
faceBlendshapes: Classifications[];
|
|
558
559
|
/** Optional facial transformation matrix. */
|
|
559
|
-
facialTransformationMatrixes
|
|
560
|
+
facialTransformationMatrixes: Matrix[];
|
|
560
561
|
}
|
|
561
562
|
|
|
562
563
|
/** Performs face stylization on images. */
|
|
@@ -636,7 +637,7 @@ export declare class FaceStylizer extends VisionTaskRunner {
|
|
|
636
637
|
/**
|
|
637
638
|
* Performs face stylization on the provided single image and returns the
|
|
638
639
|
* result. This method creates a copy of the resulting image and should not be
|
|
639
|
-
* used in high-throughput
|
|
640
|
+
* used in high-throughput applications. Only use this method when the
|
|
640
641
|
* FaceStylizer is created with the image running mode.
|
|
641
642
|
*
|
|
642
643
|
* @param image An image to process.
|
|
@@ -647,7 +648,7 @@ export declare class FaceStylizer extends VisionTaskRunner {
|
|
|
647
648
|
/**
|
|
648
649
|
* Performs face stylization on the provided single image and returns the
|
|
649
650
|
* result. This method creates a copy of the resulting image and should not be
|
|
650
|
-
* used in high-throughput
|
|
651
|
+
* used in high-throughput applications. Only use this method when the
|
|
651
652
|
* FaceStylizer is created with the image running mode.
|
|
652
653
|
*
|
|
653
654
|
* The 'imageProcessingOptions' parameter can be used to specify one or all
|
|
@@ -714,7 +715,7 @@ export declare class FaceStylizer extends VisionTaskRunner {
|
|
|
714
715
|
/**
|
|
715
716
|
* Performs face stylization on the provided video frame. This method creates
|
|
716
717
|
* a copy of the resulting image and should not be used in high-throughput
|
|
717
|
-
*
|
|
718
|
+
* applications. Only use this method when the FaceStylizer is created with the
|
|
718
719
|
* video running mode.
|
|
719
720
|
*
|
|
720
721
|
* The input frame can be of any size. It's required to provide the video
|
|
@@ -1322,7 +1323,7 @@ export declare class ImageSegmenter extends VisionTaskRunner {
|
|
|
1322
1323
|
/**
|
|
1323
1324
|
* Performs image segmentation on the provided single image and returns the
|
|
1324
1325
|
* segmentation result. This method creates a copy of the resulting masks and
|
|
1325
|
-
* should not be used in high-throughput
|
|
1326
|
+
* should not be used in high-throughput applications. Only use this method
|
|
1326
1327
|
* when the ImageSegmenter is created with running mode `image`.
|
|
1327
1328
|
*
|
|
1328
1329
|
* @param image An image to process.
|
|
@@ -1333,7 +1334,7 @@ export declare class ImageSegmenter extends VisionTaskRunner {
|
|
|
1333
1334
|
/**
|
|
1334
1335
|
* Performs image segmentation on the provided single image and returns the
|
|
1335
1336
|
* segmentation result. This method creates a copy of the resulting masks and
|
|
1336
|
-
* should not be used in high-v
|
|
1337
|
+
* should not be used in high-v applications. Only use this method when
|
|
1337
1338
|
* the ImageSegmenter is created with running mode `image`.
|
|
1338
1339
|
*
|
|
1339
1340
|
* @param image An image to process.
|
|
@@ -1385,7 +1386,7 @@ export declare class ImageSegmenter extends VisionTaskRunner {
|
|
|
1385
1386
|
/**
|
|
1386
1387
|
* Performs image segmentation on the provided video frame and returns the
|
|
1387
1388
|
* segmentation result. This method creates a copy of the resulting masks and
|
|
1388
|
-
* should not be used in high-v
|
|
1389
|
+
* should not be used in high-v applications. Only use this method when
|
|
1389
1390
|
* the ImageSegmenter is created with running mode `video`.
|
|
1390
1391
|
*
|
|
1391
1392
|
* @param videoFrame A video frame to process.
|
|
@@ -1432,19 +1433,46 @@ export declare interface ImageSegmenterOptions extends VisionTaskOptions {
|
|
|
1432
1433
|
}
|
|
1433
1434
|
|
|
1434
1435
|
/** The output result of ImageSegmenter. */
|
|
1435
|
-
export declare
|
|
1436
|
+
export declare class ImageSegmenterResult {
|
|
1437
|
+
/**
|
|
1438
|
+
* Multiple masks represented as `Float32Array` or `WebGLTexture`-backed
|
|
1439
|
+
* `MPImage`s where, for each mask, each pixel represents the prediction
|
|
1440
|
+
* confidence, usually in the [0, 1] range.
|
|
1441
|
+
*/
|
|
1442
|
+
readonly confidenceMasks?: MPMask[] | undefined;
|
|
1443
|
+
/**
|
|
1444
|
+
* A category mask represented as a `Uint8ClampedArray` or
|
|
1445
|
+
* `WebGLTexture`-backed `MPImage` where each pixel represents the class
|
|
1446
|
+
* which the pixel in the original image was predicted to belong to.
|
|
1447
|
+
*/
|
|
1448
|
+
readonly categoryMask?: MPMask | undefined;
|
|
1449
|
+
/**
|
|
1450
|
+
* The quality scores of the result masks, in the range of [0, 1].
|
|
1451
|
+
* Defaults to `1` if the model doesn't output quality scores. Each
|
|
1452
|
+
* element corresponds to the score of the category in the model outputs.
|
|
1453
|
+
*/
|
|
1454
|
+
readonly qualityScores?: number[] | undefined;
|
|
1455
|
+
constructor(
|
|
1436
1456
|
/**
|
|
1437
1457
|
* Multiple masks represented as `Float32Array` or `WebGLTexture`-backed
|
|
1438
1458
|
* `MPImage`s where, for each mask, each pixel represents the prediction
|
|
1439
1459
|
* confidence, usually in the [0, 1] range.
|
|
1440
1460
|
*/
|
|
1441
|
-
confidenceMasks?: MPMask[]
|
|
1461
|
+
confidenceMasks?: MPMask[] | undefined,
|
|
1442
1462
|
/**
|
|
1443
1463
|
* A category mask represented as a `Uint8ClampedArray` or
|
|
1444
|
-
* `WebGLTexture`-backed `MPImage` where each pixel represents the class
|
|
1445
|
-
* the pixel in the original image was predicted to belong to.
|
|
1464
|
+
* `WebGLTexture`-backed `MPImage` where each pixel represents the class
|
|
1465
|
+
* which the pixel in the original image was predicted to belong to.
|
|
1446
1466
|
*/
|
|
1447
|
-
categoryMask?: MPMask
|
|
1467
|
+
categoryMask?: MPMask | undefined,
|
|
1468
|
+
/**
|
|
1469
|
+
* The quality scores of the result masks, in the range of [0, 1].
|
|
1470
|
+
* Defaults to `1` if the model doesn't output quality scores. Each
|
|
1471
|
+
* element corresponds to the score of the category in the model outputs.
|
|
1472
|
+
*/
|
|
1473
|
+
qualityScores?: number[] | undefined);
|
|
1474
|
+
/** Frees the resources held by the category and confidence masks. */
|
|
1475
|
+
close(): void;
|
|
1448
1476
|
}
|
|
1449
1477
|
|
|
1450
1478
|
/**
|
|
@@ -1603,19 +1631,46 @@ export declare interface InteractiveSegmenterOptions extends TaskRunnerOptions {
|
|
|
1603
1631
|
}
|
|
1604
1632
|
|
|
1605
1633
|
/** The output result of InteractiveSegmenter. */
|
|
1606
|
-
export declare
|
|
1634
|
+
export declare class InteractiveSegmenterResult {
|
|
1635
|
+
/**
|
|
1636
|
+
* Multiple masks represented as `Float32Array` or `WebGLTexture`-backed
|
|
1637
|
+
* `MPImage`s where, for each mask, each pixel represents the prediction
|
|
1638
|
+
* confidence, usually in the [0, 1] range.
|
|
1639
|
+
*/
|
|
1640
|
+
readonly confidenceMasks?: MPMask[] | undefined;
|
|
1641
|
+
/**
|
|
1642
|
+
* A category mask represented as a `Uint8ClampedArray` or
|
|
1643
|
+
* `WebGLTexture`-backed `MPImage` where each pixel represents the class
|
|
1644
|
+
* which the pixel in the original image was predicted to belong to.
|
|
1645
|
+
*/
|
|
1646
|
+
readonly categoryMask?: MPMask | undefined;
|
|
1647
|
+
/**
|
|
1648
|
+
* The quality scores of the result masks, in the range of [0, 1].
|
|
1649
|
+
* Defaults to `1` if the model doesn't output quality scores. Each
|
|
1650
|
+
* element corresponds to the score of the category in the model outputs.
|
|
1651
|
+
*/
|
|
1652
|
+
readonly qualityScores?: number[] | undefined;
|
|
1653
|
+
constructor(
|
|
1607
1654
|
/**
|
|
1608
1655
|
* Multiple masks represented as `Float32Array` or `WebGLTexture`-backed
|
|
1609
1656
|
* `MPImage`s where, for each mask, each pixel represents the prediction
|
|
1610
1657
|
* confidence, usually in the [0, 1] range.
|
|
1611
1658
|
*/
|
|
1612
|
-
confidenceMasks?: MPMask[]
|
|
1659
|
+
confidenceMasks?: MPMask[] | undefined,
|
|
1613
1660
|
/**
|
|
1614
1661
|
* A category mask represented as a `Uint8ClampedArray` or
|
|
1615
|
-
* `WebGLTexture`-backed `MPImage` where each pixel represents the class
|
|
1616
|
-
* the pixel in the original image was predicted to belong to.
|
|
1662
|
+
* `WebGLTexture`-backed `MPImage` where each pixel represents the class
|
|
1663
|
+
* which the pixel in the original image was predicted to belong to.
|
|
1664
|
+
*/
|
|
1665
|
+
categoryMask?: MPMask | undefined,
|
|
1666
|
+
/**
|
|
1667
|
+
* The quality scores of the result masks, in the range of [0, 1].
|
|
1668
|
+
* Defaults to `1` if the model doesn't output quality scores. Each
|
|
1669
|
+
* element corresponds to the score of the category in the model outputs.
|
|
1617
1670
|
*/
|
|
1618
|
-
|
|
1671
|
+
qualityScores?: number[] | undefined);
|
|
1672
|
+
/** Frees the resources held by the category and confidence masks. */
|
|
1673
|
+
close(): void;
|
|
1619
1674
|
}
|
|
1620
1675
|
|
|
1621
1676
|
/**
|
|
@@ -1786,8 +1841,8 @@ export declare class MPMask {
|
|
|
1786
1841
|
getAsUint8Array(): Uint8Array;
|
|
1787
1842
|
/**
|
|
1788
1843
|
* Returns the underlying mask as a single channel `Float32Array`. Note that
|
|
1789
|
-
* this involves an expensive GPU to CPU transfer if the current mask is
|
|
1790
|
-
* available as a `WebGLTexture`.
|
|
1844
|
+
* this involves an expensive GPU to CPU transfer if the current mask is
|
|
1845
|
+
* only available as a `WebGLTexture`.
|
|
1791
1846
|
*
|
|
1792
1847
|
* @return The current mask as a Float32Array.
|
|
1793
1848
|
*/
|
|
@@ -1801,6 +1856,11 @@ export declare class MPMask {
|
|
|
1801
1856
|
* @return The current mask as a WebGLTexture.
|
|
1802
1857
|
*/
|
|
1803
1858
|
getAsWebGLTexture(): WebGLTexture;
|
|
1859
|
+
/**
|
|
1860
|
+
* Returns the texture format used for writing float textures on this
|
|
1861
|
+
* platform.
|
|
1862
|
+
*/
|
|
1863
|
+
getTexImage2DFormat(): GLenum;
|
|
1804
1864
|
/**
|
|
1805
1865
|
* Creates a copy of the resources stored in this `MPMask`. You can
|
|
1806
1866
|
* invoke this method to extend the lifetime of a mask returned by a
|
|
@@ -2140,13 +2200,19 @@ export declare interface PoseLandmarkerOptions extends VisionTaskOptions {
|
|
|
2140
2200
|
* Represents the pose landmarks deection results generated by `PoseLandmarker`.
|
|
2141
2201
|
* Each vector element represents a single pose detected in the image.
|
|
2142
2202
|
*/
|
|
2143
|
-
export declare
|
|
2144
|
-
|
|
2145
|
-
landmarks: NormalizedLandmark[][];
|
|
2203
|
+
export declare class PoseLandmarkerResult {
|
|
2204
|
+
readonly landmarks: NormalizedLandmark[][];
|
|
2146
2205
|
/** Pose landmarks in world coordinates of detected poses. */
|
|
2147
|
-
worldLandmarks: Landmark[][];
|
|
2206
|
+
readonly worldLandmarks: Landmark[][];
|
|
2207
|
+
/** Segmentation mask for the detected pose. */
|
|
2208
|
+
readonly segmentationMasks?: MPMask[] | undefined;
|
|
2209
|
+
constructor(/** Pose landmarks of detected poses. */ landmarks: NormalizedLandmark[][],
|
|
2210
|
+
/** Pose landmarks in world coordinates of detected poses. */
|
|
2211
|
+
worldLandmarks: Landmark[][],
|
|
2148
2212
|
/** Segmentation mask for the detected pose. */
|
|
2149
|
-
segmentationMasks?: MPMask[];
|
|
2213
|
+
segmentationMasks?: MPMask[] | undefined);
|
|
2214
|
+
/** Frees the resources held by the segmentation masks. */
|
|
2215
|
+
close(): void;
|
|
2150
2216
|
}
|
|
2151
2217
|
|
|
2152
2218
|
/**
|