@mediapipe/tasks-vision 0.10.22-rc.20250304 → 0.10.33
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 +0 -15
- package/package.json +10 -4
- package/vision.d.ts +12 -145
- package/vision_bundle.cjs +1 -1
- package/vision_bundle.cjs.map +1 -1
- package/vision_bundle.mjs +1 -1
- package/vision_bundle.mjs.map +1 -1
- package/wasm/vision_wasm_internal.js +8835 -11
- package/wasm/vision_wasm_internal.wasm +0 -0
- package/wasm/vision_wasm_module_internal.js +8840 -0
- package/wasm/vision_wasm_module_internal.wasm +0 -0
- package/wasm/vision_wasm_nosimd_internal.js +8826 -11
- package/wasm/vision_wasm_nosimd_internal.wasm +0 -0
package/README.md
CHANGED
|
@@ -39,21 +39,6 @@ const landmarks = faceLandmarker.detect(image);
|
|
|
39
39
|
|
|
40
40
|
For more information, refer to the [Face Landmarker](https://developers.google.com/mediapipe/solutions/vision/face_landmarker/web_js) documentation.
|
|
41
41
|
|
|
42
|
-
## Face Stylizer
|
|
43
|
-
|
|
44
|
-
The MediaPipe Face Stylizer lets you perform face stylization on images.
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
const vision = await FilesetResolver.forVisionTasks(
|
|
48
|
-
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm"
|
|
49
|
-
);
|
|
50
|
-
const faceStylizer = await FaceStylizer.createFromModelPath(vision,
|
|
51
|
-
"https://storage.googleapis.com/mediapipe-models/face_stylizer/blaze_face_stylizer/float32/1/blaze_face_stylizer.task"
|
|
52
|
-
);
|
|
53
|
-
const image = document.getElementById("image") as HTMLImageElement;
|
|
54
|
-
const stylizedImage = faceStylizer.stylize(image);
|
|
55
|
-
```
|
|
56
|
-
|
|
57
42
|
## Gesture Recognizer
|
|
58
43
|
|
|
59
44
|
The MediaPipe Gesture Recognizer task lets you recognize hand gestures in real
|
package/package.json
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediapipe/tasks-vision",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.33",
|
|
4
4
|
"description": "MediaPipe Vision Tasks",
|
|
5
5
|
"main": "vision_bundle.cjs",
|
|
6
6
|
"browser": "vision_bundle.mjs",
|
|
7
7
|
"module": "vision_bundle.mjs",
|
|
8
8
|
"exports": {
|
|
9
|
-
"import":
|
|
9
|
+
"import": "./vision_bundle.mjs",
|
|
10
10
|
"require": "./vision_bundle.cjs",
|
|
11
|
-
"default":
|
|
12
|
-
"types":
|
|
11
|
+
"default": "./vision_bundle.mjs",
|
|
12
|
+
"types": "./vision.d.ts",
|
|
13
|
+
"./vision_wasm_internal.js": "./vision_wasm_internal.js",
|
|
14
|
+
"./vision_wasm_internal.wasm": "./vision_wasm_internal.wasm",
|
|
15
|
+
"./vision_wasm_nosimd_internal.js": "./vision_wasm_nosimd_internal.js",
|
|
16
|
+
"./vision_wasm_nosimd_internal.wasm": "./vision_wasm_nosimd_internal.wasm",
|
|
17
|
+
"./vision_wasm_module_internal.js": "./vision_wasm_module_internal.js",
|
|
18
|
+
"./vision_wasm_module_internal.wasm": "./vision_wasm_module_internal.wasm"
|
|
13
19
|
},
|
|
14
20
|
"author": "mediapipe@google.com",
|
|
15
21
|
"license": "Apache-2.0",
|
package/vision.d.ts
CHANGED
|
@@ -699,133 +699,6 @@ export declare interface FaceLandmarkerResult {
|
|
|
699
699
|
facialTransformationMatrixes: Matrix[];
|
|
700
700
|
}
|
|
701
701
|
|
|
702
|
-
/** Performs face stylization on images. */
|
|
703
|
-
export declare class FaceStylizer extends VisionTaskRunner {
|
|
704
|
-
/**
|
|
705
|
-
* Initializes the Wasm runtime and creates a new Face Stylizer from the
|
|
706
|
-
* provided options.
|
|
707
|
-
* @export
|
|
708
|
-
* @param wasmFileset A configuration object that provides the location of
|
|
709
|
-
* the Wasm binary and its loader.
|
|
710
|
-
* @param faceStylizerOptions The options for the Face Stylizer. Note
|
|
711
|
-
* that either a path to the model asset or a model buffer needs to be
|
|
712
|
-
* provided (via `baseOptions`).
|
|
713
|
-
*/
|
|
714
|
-
static createFromOptions(wasmFileset: WasmFileset, faceStylizerOptions: FaceStylizerOptions): Promise<FaceStylizer>;
|
|
715
|
-
/**
|
|
716
|
-
* Initializes the Wasm runtime and creates a new Face Stylizer based on
|
|
717
|
-
* the provided model asset buffer.
|
|
718
|
-
* @export
|
|
719
|
-
* @param wasmFileset A configuration object that provides the location of
|
|
720
|
-
* the Wasm binary and its loader.
|
|
721
|
-
* @param modelAssetBuffer An array or a stream containing a binary
|
|
722
|
-
* representation of the model.
|
|
723
|
-
*/
|
|
724
|
-
static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array | ReadableStreamDefaultReader): Promise<FaceStylizer>;
|
|
725
|
-
/**
|
|
726
|
-
* Initializes the Wasm runtime and creates a new Face Stylizer based on
|
|
727
|
-
* the path to the model asset.
|
|
728
|
-
* @export
|
|
729
|
-
* @param wasmFileset A configuration object that provides the location of
|
|
730
|
-
* the Wasm binary and its loader.
|
|
731
|
-
* @param modelAssetPath The path to the model asset.
|
|
732
|
-
*/
|
|
733
|
-
static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<FaceStylizer>;
|
|
734
|
-
private constructor();
|
|
735
|
-
/**
|
|
736
|
-
* Sets new options for the Face Stylizer.
|
|
737
|
-
*
|
|
738
|
-
* Calling `setOptions()` with a subset of options only affects those
|
|
739
|
-
* options. You can reset an option back to its default value by
|
|
740
|
-
* explicitly setting it to `undefined`.
|
|
741
|
-
*
|
|
742
|
-
* @export
|
|
743
|
-
* @param options The options for the Face Stylizer.
|
|
744
|
-
*/
|
|
745
|
-
setOptions(options: FaceStylizerOptions): Promise<void>;
|
|
746
|
-
/**
|
|
747
|
-
* Performs face stylization on the provided single image and invokes the
|
|
748
|
-
* callback with result. The method returns synchronously once the callback
|
|
749
|
-
* returns. Only use this method when the FaceStylizer is created with the
|
|
750
|
-
* image running mode.
|
|
751
|
-
*
|
|
752
|
-
* @param image An image to process.
|
|
753
|
-
* @param callback The callback that is invoked with the stylized image or
|
|
754
|
-
* `null` if no face was detected. The lifetime of the returned data is
|
|
755
|
-
* only guaranteed for the duration of the callback.
|
|
756
|
-
*/
|
|
757
|
-
stylize(image: ImageSource, callback: FaceStylizerCallback): void;
|
|
758
|
-
/**
|
|
759
|
-
* Performs face stylization on the provided single image and invokes the
|
|
760
|
-
* callback with result. The method returns synchronously once the callback
|
|
761
|
-
* returns. Only use this method when the FaceStylizer is created with the
|
|
762
|
-
* image running mode.
|
|
763
|
-
*
|
|
764
|
-
* The 'imageProcessingOptions' parameter can be used to specify one or all
|
|
765
|
-
* of:
|
|
766
|
-
* - the rotation to apply to the image before performing stylization, by
|
|
767
|
-
* setting its 'rotationDegrees' property.
|
|
768
|
-
* - the region-of-interest on which to perform stylization, by setting its
|
|
769
|
-
* 'regionOfInterest' property. If not specified, the full image is used.
|
|
770
|
-
* If both are specified, the crop around the region-of-interest is extracted
|
|
771
|
-
* first, then the specified rotation is applied to the crop.
|
|
772
|
-
*
|
|
773
|
-
* @param image An image to process.
|
|
774
|
-
* @param imageProcessingOptions the `ImageProcessingOptions` specifying how
|
|
775
|
-
* to process the input image before running inference.
|
|
776
|
-
* @param callback The callback that is invoked with the stylized image or
|
|
777
|
-
* `null` if no face was detected. The lifetime of the returned data is
|
|
778
|
-
* only guaranteed for the duration of the callback.
|
|
779
|
-
*/
|
|
780
|
-
stylize(image: ImageSource, imageProcessingOptions: ImageProcessingOptions, callback: FaceStylizerCallback): void;
|
|
781
|
-
/**
|
|
782
|
-
* Performs face stylization on the provided single image and returns the
|
|
783
|
-
* result. This method creates a copy of the resulting image and should not be
|
|
784
|
-
* used in high-throughput applications. Only use this method when the
|
|
785
|
-
* FaceStylizer is created with the image running mode.
|
|
786
|
-
*
|
|
787
|
-
* @param image An image to process.
|
|
788
|
-
* @return A stylized face or `null` if no face was detected. The result is
|
|
789
|
-
* copied to avoid lifetime issues.
|
|
790
|
-
*/
|
|
791
|
-
stylize(image: ImageSource): MPImage | null;
|
|
792
|
-
/**
|
|
793
|
-
* Performs face stylization on the provided single image and returns the
|
|
794
|
-
* result. This method creates a copy of the resulting image and should not be
|
|
795
|
-
* used in high-throughput applications. Only use this method when the
|
|
796
|
-
* FaceStylizer is created with the image running mode.
|
|
797
|
-
*
|
|
798
|
-
* The 'imageProcessingOptions' parameter can be used to specify one or all
|
|
799
|
-
* of:
|
|
800
|
-
* - the rotation to apply to the image before performing stylization, by
|
|
801
|
-
* setting its 'rotationDegrees' property.
|
|
802
|
-
* - the region-of-interest on which to perform stylization, by setting its
|
|
803
|
-
* 'regionOfInterest' property. If not specified, the full image is used.
|
|
804
|
-
* If both are specified, the crop around the region-of-interest is extracted
|
|
805
|
-
* first, then the specified rotation is applied to the crop.
|
|
806
|
-
*
|
|
807
|
-
* @param image An image to process.
|
|
808
|
-
* @param imageProcessingOptions the `ImageProcessingOptions` specifying how
|
|
809
|
-
* to process the input image before running inference.
|
|
810
|
-
* @return A stylized face or `null` if no face was detected. The result is
|
|
811
|
-
* copied to avoid lifetime issues.
|
|
812
|
-
*/
|
|
813
|
-
stylize(image: ImageSource, imageProcessingOptions: ImageProcessingOptions): MPImage | null;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
/**
|
|
817
|
-
* A callback that receives an `MPImage` object from the face stylizer, or
|
|
818
|
-
* `null` if no face was detected. The lifetime of the underlying data is
|
|
819
|
-
* limited to the duration of the callback. If asynchronous processing is
|
|
820
|
-
* needed, all data needs to be copied before the callback returns (via
|
|
821
|
-
* `image.clone()`).
|
|
822
|
-
*/
|
|
823
|
-
export declare type FaceStylizerCallback = (image: MPImage | null) => void;
|
|
824
|
-
|
|
825
|
-
/** Options to configure the MediaPipe Face Stylizer Task */
|
|
826
|
-
export declare interface FaceStylizerOptions extends VisionTaskOptions {
|
|
827
|
-
}
|
|
828
|
-
|
|
829
702
|
/**
|
|
830
703
|
* Resolves the files required for the MediaPipe Task APIs.
|
|
831
704
|
*
|
|
@@ -841,12 +714,13 @@ export declare class FilesetResolver {
|
|
|
841
714
|
*
|
|
842
715
|
* If your environment requires custom locations for the MediaPipe Wasm files,
|
|
843
716
|
* you can use `isSimdSupported()` to decide whether to load the SIMD-based
|
|
844
|
-
* assets.
|
|
717
|
+
* assets. Note that for ES6 Modules, SIMD is assumed to be always supported.
|
|
845
718
|
*
|
|
719
|
+
* @param useModule Whether to use ES6 Modules for the Wasm files.
|
|
846
720
|
* @export
|
|
847
721
|
* @return Whether SIMD support was detected in the current environment.
|
|
848
722
|
*/
|
|
849
|
-
static isSimdSupported(): Promise<boolean>;
|
|
723
|
+
static isSimdSupported(useModule?: boolean): Promise<boolean>;
|
|
850
724
|
/**
|
|
851
725
|
* Creates a fileset for the MediaPipe Audio tasks.
|
|
852
726
|
*
|
|
@@ -854,10 +728,11 @@ export declare class FilesetResolver {
|
|
|
854
728
|
* @param basePath An optional base path to specify the directory the Wasm
|
|
855
729
|
* files should be loaded from. If not specified, the Wasm files are
|
|
856
730
|
* loaded from the host's root directory.
|
|
731
|
+
* @param useModule Whether to use ES6 Modules for the Wasm files.
|
|
857
732
|
* @return A `WasmFileset` that can be used to initialize MediaPipe Audio
|
|
858
733
|
* tasks.
|
|
859
734
|
*/
|
|
860
|
-
static forAudioTasks(basePath?: string): Promise<WasmFileset>;
|
|
735
|
+
static forAudioTasks(basePath?: string, useModule?: boolean): Promise<WasmFileset>;
|
|
861
736
|
/**
|
|
862
737
|
* Creates a fileset for the MediaPipe GenAI tasks.
|
|
863
738
|
*
|
|
@@ -865,21 +740,11 @@ export declare class FilesetResolver {
|
|
|
865
740
|
* @param basePath An optional base path to specify the directory the Wasm
|
|
866
741
|
* files should be loaded from. If not specified, the Wasm files are
|
|
867
742
|
* loaded from the host's root directory.
|
|
743
|
+
* @param useModule Whether to use ES6 Modules for the Wasm files.
|
|
868
744
|
* @return A `WasmFileset` that can be used to initialize MediaPipe GenAI
|
|
869
745
|
* tasks.
|
|
870
746
|
*/
|
|
871
|
-
static forGenAiTasks(basePath?: string): Promise<WasmFileset>;
|
|
872
|
-
/**
|
|
873
|
-
* Creates a fileset for the MediaPipe GenAI Experimental tasks.
|
|
874
|
-
*
|
|
875
|
-
* @export
|
|
876
|
-
* @param basePath An optional base path to specify the directory the Wasm
|
|
877
|
-
* files should be loaded from. If not specified, the Wasm files are
|
|
878
|
-
* loaded from the host's root directory.
|
|
879
|
-
* @return A `WasmFileset` that can be used to initialize MediaPipe GenAI
|
|
880
|
-
* tasks.
|
|
881
|
-
*/
|
|
882
|
-
static forGenAiExperimentalTasks(basePath?: string): Promise<WasmFileset>;
|
|
747
|
+
static forGenAiTasks(basePath?: string, useModule?: boolean): Promise<WasmFileset>;
|
|
883
748
|
/**
|
|
884
749
|
* Creates a fileset for the MediaPipe Text tasks.
|
|
885
750
|
*
|
|
@@ -887,10 +752,11 @@ export declare class FilesetResolver {
|
|
|
887
752
|
* @param basePath An optional base path to specify the directory the Wasm
|
|
888
753
|
* files should be loaded from. If not specified, the Wasm files are
|
|
889
754
|
* loaded from the host's root directory.
|
|
755
|
+
* @param useModule Whether to use ES6 Modules for the Wasm files.
|
|
890
756
|
* @return A `WasmFileset` that can be used to initialize MediaPipe Text
|
|
891
757
|
* tasks.
|
|
892
758
|
*/
|
|
893
|
-
static forTextTasks(basePath?: string): Promise<WasmFileset>;
|
|
759
|
+
static forTextTasks(basePath?: string, useModule?: boolean): Promise<WasmFileset>;
|
|
894
760
|
/**
|
|
895
761
|
* Creates a fileset for the MediaPipe Vision tasks.
|
|
896
762
|
*
|
|
@@ -898,10 +764,11 @@ export declare class FilesetResolver {
|
|
|
898
764
|
* @param basePath An optional base path to specify the directory the Wasm
|
|
899
765
|
* files should be loaded from. If not specified, the Wasm files are
|
|
900
766
|
* loaded from the host's root directory.
|
|
767
|
+
* @param useModule Whether to use ES6 Modules for the Wasm files.
|
|
901
768
|
* @return A `WasmFileset` that can be used to initialize MediaPipe Vision
|
|
902
769
|
* tasks.
|
|
903
770
|
*/
|
|
904
|
-
static forVisionTasks(basePath?: string): Promise<WasmFileset>;
|
|
771
|
+
static forVisionTasks(basePath?: string, useModule?: boolean): Promise<WasmFileset>;
|
|
905
772
|
}
|
|
906
773
|
|
|
907
774
|
/** Performs hand gesture recognition on images. */
|
|
@@ -2080,7 +1947,7 @@ export declare class InteractiveSegmenter extends VisionTaskRunner {
|
|
|
2080
1947
|
export declare type InteractiveSegmenterCallback = (result: InteractiveSegmenterResult) => void;
|
|
2081
1948
|
|
|
2082
1949
|
/** Options to configure the MediaPipe Interactive Segmenter Task */
|
|
2083
|
-
export declare interface InteractiveSegmenterOptions extends
|
|
1950
|
+
export declare interface InteractiveSegmenterOptions extends VisionTaskOptions {
|
|
2084
1951
|
/** Whether to output confidence masks. Defaults to true. */
|
|
2085
1952
|
outputConfidenceMasks?: boolean | undefined;
|
|
2086
1953
|
/** Whether to output the category masks. Defaults to false. */
|