@mediapipe/tasks-vision 0.1.0-alpha-2 → 0.1.0-alpha-3
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
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# MediaPipe Tasks Vision Package
|
|
2
|
+
|
|
3
|
+
This package contains the vision tasks for MediaPipe.
|
|
4
|
+
|
|
5
|
+
## Object Detection
|
|
6
|
+
|
|
7
|
+
The MediaPipe Object Detector task lets you detect the presence and location of
|
|
8
|
+
multiple classes of objects within images or videos.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
const vision = await FilesetResolver.forVisionTasks(
|
|
12
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm"
|
|
13
|
+
);
|
|
14
|
+
const objectDetector = await ObjectDetector.createFromModelPath(vision,
|
|
15
|
+
"https://storage.googleapis.com/mediapipe-tasks/object_detector/efficientdet_lite0_uint8.tflite"
|
|
16
|
+
);
|
|
17
|
+
const image = document.getElementById("image") as HTMLImageElement;
|
|
18
|
+
const detections = objectDetector.detect(image);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For more information, refer to the [Object Detector](https://developers.google.com/mediapipe/solutions/vision/object_detector/web_js) documentation.
|
|
22
|
+
|
|
23
|
+
## Image Classification
|
|
24
|
+
|
|
25
|
+
The MediaPipe Image Classifier task lets you perform classification on images.
|
|
26
|
+
You can use this task to identify what an image represents among a set of
|
|
27
|
+
categories defined at training time.
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
const vision = await FilesetResolver.forVisionTasks(
|
|
31
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm"
|
|
32
|
+
);
|
|
33
|
+
const imageClassifier = await ImageClassifier.createFromModelPath(vision,
|
|
34
|
+
"https://storage.googleapis.com/mediapipe-tasks/image_classifier/efficientnet_lite0_uint8.tflite"
|
|
35
|
+
);
|
|
36
|
+
const image = document.getElementById("image") as HTMLImageElement;
|
|
37
|
+
const classifications = imageClassifier.classify(image);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
For more information, refer to the [Image Classification](https://developers.google.com/mediapipe/solutions/vision/image_classifier/web_js) documentation.
|
|
41
|
+
|
|
42
|
+
## Gesture Recognition
|
|
43
|
+
|
|
44
|
+
The MediaPipe Gesture Recognizer task lets you recognize hand gestures in real
|
|
45
|
+
time, and provides the recognized hand gesture results along with the landmarks
|
|
46
|
+
of the detected hands. You can use this task to recognize specific hand gestures
|
|
47
|
+
from a user, and invoke application features that correspond to those gestures.
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
const vision = await FilesetResolver.forVisionTasks(
|
|
51
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm"
|
|
52
|
+
);
|
|
53
|
+
const gestureRecognizer = await GestureRecognizer.createFromModelPath(vision,
|
|
54
|
+
"https://storage.googleapis.com/mediapipe-tasks/gesture_recognizer/gesture_recognizer.task"
|
|
55
|
+
);
|
|
56
|
+
const image = document.getElementById("image") as HTMLImageElement;
|
|
57
|
+
const recognitions = gestureRecognizer.recognize(image);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Handlandmark Detection
|
|
61
|
+
|
|
62
|
+
The MediaPipe Hand Landmarker task lets you detect the landmarks of the hands in
|
|
63
|
+
an image. You can use this Task to localize key points of the hands and render
|
|
64
|
+
visual effects over the hands.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
const vision = await FilesetResolver.forVisionTasks(
|
|
68
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm"
|
|
69
|
+
);
|
|
70
|
+
const handLandmarker = await HandLandmarker.createFromModelPath(vision,
|
|
71
|
+
"https://storage.googleapis.com/mediapipe-tasks/hand_landmarker/hand_landmarker.task"
|
|
72
|
+
);
|
|
73
|
+
const image = document.getElementById("image") as HTMLImageElement;
|
|
74
|
+
const landmarks = handLandmarker.detect(image);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
For more information, refer to the [Handlandmark Detection](https://developers.google.com/mediapipe/solutions/vision/hand_landmarker/web_js) documentation.
|
|
78
|
+
|