Internal change
PiperOrigin-RevId: 488333493
This commit is contained in:
parent
bc6240e989
commit
badaccfb04
|
@ -214,10 +214,10 @@ def mediapipe_ts_library(
|
||||||
"""Generate ts_project for MediaPipe open source version.
|
"""Generate ts_project for MediaPipe open source version.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
name: the name of the mediapipe_ts_library.
|
name: the name of the cc_proto_library.
|
||||||
srcs: the .proto files of the mediapipe_ts_library for Bazel use.
|
srcs: the .proto files of the cc_proto_library for Bazel use.
|
||||||
visibility: visibility of this target.
|
visibility: visibility of this target.
|
||||||
deps: a list of dependency labels for Bazel use.
|
deps: a list of dependency labels for Bazel use; must be cc_proto_library.
|
||||||
testonly: test only or not.
|
testonly: test only or not.
|
||||||
allow_unoptimized_namespaces: ignored, used only internally
|
allow_unoptimized_namespaces: ignored, used only internally
|
||||||
"""
|
"""
|
||||||
|
@ -235,36 +235,3 @@ def mediapipe_ts_library(
|
||||||
declaration = True,
|
declaration = True,
|
||||||
tsconfig = "//:tsconfig.json",
|
tsconfig = "//:tsconfig.json",
|
||||||
))
|
))
|
||||||
|
|
||||||
def mediapipe_ts_declaration(
|
|
||||||
name,
|
|
||||||
srcs,
|
|
||||||
visibility = None,
|
|
||||||
deps = []):
|
|
||||||
"""Generate ts_declaration for MediaPipe open source version.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
name: the name of the mediapipe_ts_declaration.
|
|
||||||
srcs: the .proto files of the mediapipe_ts_declaration for Bazel use.
|
|
||||||
visibility: visibility of this target.
|
|
||||||
deps: a list of dependency labels for Bazel use
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Bazel does not create JS files for .d.ts files, which leads to import
|
|
||||||
# failures in our open source build. We simply re-name the .d.ts files
|
|
||||||
# to .ts to work around this problem.
|
|
||||||
for src in srcs:
|
|
||||||
native.genrule(
|
|
||||||
name = replace_suffix(src, ".d.ts", "_d_ts"),
|
|
||||||
srcs = [src],
|
|
||||||
outs = [replace_suffix(src, ".d.ts", ".ts")],
|
|
||||||
visibility = visibility,
|
|
||||||
cmd = "cp -n $< $@;",
|
|
||||||
)
|
|
||||||
|
|
||||||
mediapipe_ts_library(
|
|
||||||
name = name,
|
|
||||||
srcs = [replace_suffix(src, ".d.ts", "_d_ts") for src in srcs],
|
|
||||||
visibility = visibility,
|
|
||||||
deps = deps,
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
# This package contains options shared by all MediaPipe Tasks for Web.
|
# This package contains options shared by all MediaPipe Tasks for Web.
|
||||||
|
|
||||||
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_declaration")
|
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
|
||||||
|
|
||||||
package(default_visibility = ["//mediapipe/tasks:internal"])
|
package(default_visibility = ["//mediapipe/tasks:internal"])
|
||||||
|
|
||||||
mediapipe_ts_declaration(
|
mediapipe_ts_library(
|
||||||
name = "category",
|
name = "category",
|
||||||
srcs = ["category.d.ts"],
|
srcs = ["category.d.ts"],
|
||||||
)
|
)
|
||||||
|
|
||||||
mediapipe_ts_declaration(
|
mediapipe_ts_library(
|
||||||
name = "classification_result",
|
name = "classification_result",
|
||||||
srcs = ["classification_result.d.ts"],
|
srcs = ["classification_result.d.ts"],
|
||||||
deps = [":category"],
|
deps = [":category"],
|
||||||
)
|
)
|
||||||
|
|
||||||
mediapipe_ts_declaration(
|
mediapipe_ts_library(
|
||||||
name = "landmark",
|
name = "landmark",
|
||||||
srcs = ["landmark.d.ts"],
|
srcs = ["landmark.d.ts"],
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
* Landmark represents a point in 3D space with x, y, z coordinates. If
|
* Landmark represents a point in 3D space with x, y, z coordinates. If
|
||||||
* normalized is true, the landmark coordinates is normalized respect to the
|
* normalized is true, the landmark coordinates is normalized respect to the
|
||||||
* dimension of image, and the coordinates values are in the range of [0,1].
|
* dimension of image, and the coordinates values are in the range of [0,1].
|
||||||
* Otherwise, it represents a point in world coordinates.
|
* Otherwise, it represenet a point in world coordinates.
|
||||||
*/
|
*/
|
||||||
export declare interface Landmark {
|
export declare class Landmark {
|
||||||
/** The x coordinates of the landmark. */
|
/** The x coordinates of the landmark. */
|
||||||
x: number;
|
x: number;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# This package contains options shared by all MediaPipe Tasks for Web.
|
# This package contains options shared by all MediaPipe Tasks for Web.
|
||||||
|
|
||||||
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_declaration", "mediapipe_ts_library")
|
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
|
||||||
|
|
||||||
package(default_visibility = ["//mediapipe/tasks:internal"])
|
package(default_visibility = ["//mediapipe/tasks:internal"])
|
||||||
|
|
||||||
mediapipe_ts_declaration(
|
mediapipe_ts_library(
|
||||||
name = "core",
|
name = "core",
|
||||||
srcs = [
|
srcs = [
|
||||||
"base_options.d.ts",
|
"base_options.d.ts",
|
||||||
|
@ -24,7 +24,7 @@ mediapipe_ts_library(
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
mediapipe_ts_declaration(
|
mediapipe_ts_library(
|
||||||
name = "classifier_options",
|
name = "classifier_options",
|
||||||
srcs = [
|
srcs = [
|
||||||
"classifier_options.d.ts",
|
"classifier_options.d.ts",
|
||||||
|
|
|
@ -9,10 +9,7 @@ mediapipe_ts_library(
|
||||||
srcs = ["index.ts"],
|
srcs = ["index.ts"],
|
||||||
deps = [
|
deps = [
|
||||||
"//mediapipe/tasks/web/vision/gesture_recognizer",
|
"//mediapipe/tasks/web/vision/gesture_recognizer",
|
||||||
"//mediapipe/tasks/web/vision/gesture_recognizer:gesture_recognizer_types",
|
|
||||||
"//mediapipe/tasks/web/vision/image_classifier",
|
"//mediapipe/tasks/web/vision/image_classifier",
|
||||||
"//mediapipe/tasks/web/vision/image_classifier:image_classifier_types",
|
|
||||||
"//mediapipe/tasks/web/vision/object_detector",
|
"//mediapipe/tasks/web/vision/object_detector",
|
||||||
"//mediapipe/tasks/web/vision/object_detector:object_detector_types",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This task takes video frames and outputs synchronized frames along with
|
# This task takes video frames and outputs synchronized frames along with
|
||||||
# the detection results for one or more gesture categories, using Gesture Recognizer.
|
# the detection results for one or more gesture categories, using Gesture Recognizer.
|
||||||
|
|
||||||
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_declaration", "mediapipe_ts_library")
|
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
|
||||||
|
|
||||||
package(default_visibility = ["//mediapipe/tasks:internal"])
|
package(default_visibility = ["//mediapipe/tasks:internal"])
|
||||||
|
|
||||||
|
@ -11,9 +11,12 @@ licenses(["notice"])
|
||||||
|
|
||||||
mediapipe_ts_library(
|
mediapipe_ts_library(
|
||||||
name = "gesture_recognizer",
|
name = "gesture_recognizer",
|
||||||
srcs = ["gesture_recognizer.ts"],
|
srcs = [
|
||||||
|
"gesture_recognizer.ts",
|
||||||
|
"gesture_recognizer_options.ts",
|
||||||
|
"gesture_recognizer_result.ts",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":gesture_recognizer_types",
|
|
||||||
"//mediapipe/framework:calculator_jspb_proto",
|
"//mediapipe/framework:calculator_jspb_proto",
|
||||||
"//mediapipe/framework:calculator_options_jspb_proto",
|
"//mediapipe/framework:calculator_options_jspb_proto",
|
||||||
"//mediapipe/framework/formats:classification_jspb_proto",
|
"//mediapipe/framework/formats:classification_jspb_proto",
|
||||||
|
@ -30,21 +33,8 @@ mediapipe_ts_library(
|
||||||
"//mediapipe/tasks/web/components/processors:base_options",
|
"//mediapipe/tasks/web/components/processors:base_options",
|
||||||
"//mediapipe/tasks/web/components/processors:classifier_options",
|
"//mediapipe/tasks/web/components/processors:classifier_options",
|
||||||
"//mediapipe/tasks/web/core",
|
"//mediapipe/tasks/web/core",
|
||||||
|
"//mediapipe/tasks/web/core:classifier_options",
|
||||||
"//mediapipe/tasks/web/core:task_runner",
|
"//mediapipe/tasks/web/core:task_runner",
|
||||||
"//mediapipe/web/graph_runner:wasm_mediapipe_lib_ts",
|
"//mediapipe/web/graph_runner:wasm_mediapipe_lib_ts",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
mediapipe_ts_declaration(
|
|
||||||
name = "gesture_recognizer_types",
|
|
||||||
srcs = [
|
|
||||||
"gesture_recognizer_options.d.ts",
|
|
||||||
"gesture_recognizer_result.d.ts",
|
|
||||||
],
|
|
||||||
deps = [
|
|
||||||
"//mediapipe/tasks/web/components/containers:category",
|
|
||||||
"//mediapipe/tasks/web/components/containers:landmark",
|
|
||||||
"//mediapipe/tasks/web/core",
|
|
||||||
"//mediapipe/tasks/web/core:classifier_options",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
|
@ -154,6 +154,10 @@ export class GestureRecognizer extends TaskRunner {
|
||||||
this.handGestureRecognizerGraphOptions);
|
this.handGestureRecognizerGraphOptions);
|
||||||
|
|
||||||
this.initDefaults();
|
this.initDefaults();
|
||||||
|
|
||||||
|
// Disables the automatic render-to-screen code, which allows for pure
|
||||||
|
// CPU processing.
|
||||||
|
this.setAutoRenderToScreen(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# This task takes video or image frames and outputs the classification result.
|
# This task takes video or image frames and outputs the classification result.
|
||||||
|
|
||||||
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_declaration", "mediapipe_ts_library")
|
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
|
||||||
|
|
||||||
package(default_visibility = ["//mediapipe/tasks:internal"])
|
package(default_visibility = ["//mediapipe/tasks:internal"])
|
||||||
|
|
||||||
|
@ -12,31 +12,22 @@ mediapipe_ts_library(
|
||||||
name = "image_classifier",
|
name = "image_classifier",
|
||||||
srcs = [
|
srcs = [
|
||||||
"image_classifier.ts",
|
"image_classifier.ts",
|
||||||
|
"image_classifier_options.ts",
|
||||||
|
"image_classifier_result.ts",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":image_classifier_types",
|
|
||||||
"//mediapipe/framework:calculator_jspb_proto",
|
"//mediapipe/framework:calculator_jspb_proto",
|
||||||
"//mediapipe/framework:calculator_options_jspb_proto",
|
"//mediapipe/framework:calculator_options_jspb_proto",
|
||||||
"//mediapipe/tasks/cc/components/containers/proto:classifications_jspb_proto",
|
"//mediapipe/tasks/cc/components/containers/proto:classifications_jspb_proto",
|
||||||
"//mediapipe/tasks/cc/vision/image_classifier/proto:image_classifier_graph_options_jspb_proto",
|
"//mediapipe/tasks/cc/vision/image_classifier/proto:image_classifier_graph_options_jspb_proto",
|
||||||
|
"//mediapipe/tasks/web/components/containers:category",
|
||||||
|
"//mediapipe/tasks/web/components/containers:classification_result",
|
||||||
"//mediapipe/tasks/web/components/processors:base_options",
|
"//mediapipe/tasks/web/components/processors:base_options",
|
||||||
"//mediapipe/tasks/web/components/processors:classifier_options",
|
"//mediapipe/tasks/web/components/processors:classifier_options",
|
||||||
"//mediapipe/tasks/web/components/processors:classifier_result",
|
"//mediapipe/tasks/web/components/processors:classifier_result",
|
||||||
"//mediapipe/tasks/web/core",
|
"//mediapipe/tasks/web/core",
|
||||||
|
"//mediapipe/tasks/web/core:classifier_options",
|
||||||
"//mediapipe/tasks/web/core:task_runner",
|
"//mediapipe/tasks/web/core:task_runner",
|
||||||
"//mediapipe/web/graph_runner:wasm_mediapipe_lib_ts",
|
"//mediapipe/web/graph_runner:wasm_mediapipe_lib_ts",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
mediapipe_ts_declaration(
|
|
||||||
name = "image_classifier_types",
|
|
||||||
srcs = [
|
|
||||||
"image_classifier_options.d.ts",
|
|
||||||
"image_classifier_result.d.ts",
|
|
||||||
],
|
|
||||||
deps = [
|
|
||||||
"//mediapipe/tasks/web/components/containers:category",
|
|
||||||
"//mediapipe/tasks/web/components/containers:classification_result",
|
|
||||||
"//mediapipe/tasks/web/core:classifier_options",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This task takes video frames and outputs synchronized frames along with
|
# This task takes video frames and outputs synchronized frames along with
|
||||||
# the detection results for one or more object categories, using Object Detector.
|
# the detection results for one or more object categories, using Object Detector.
|
||||||
|
|
||||||
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_declaration", "mediapipe_ts_library")
|
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
|
||||||
|
|
||||||
package(default_visibility = ["//mediapipe/tasks:internal"])
|
package(default_visibility = ["//mediapipe/tasks:internal"])
|
||||||
|
|
||||||
|
@ -13,28 +13,18 @@ mediapipe_ts_library(
|
||||||
name = "object_detector",
|
name = "object_detector",
|
||||||
srcs = [
|
srcs = [
|
||||||
"object_detector.ts",
|
"object_detector.ts",
|
||||||
|
"object_detector_options.ts",
|
||||||
|
"object_detector_result.ts",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":object_detector_types",
|
|
||||||
"//mediapipe/framework:calculator_jspb_proto",
|
"//mediapipe/framework:calculator_jspb_proto",
|
||||||
"//mediapipe/framework:calculator_options_jspb_proto",
|
"//mediapipe/framework:calculator_options_jspb_proto",
|
||||||
"//mediapipe/framework/formats:detection_jspb_proto",
|
"//mediapipe/framework/formats:detection_jspb_proto",
|
||||||
"//mediapipe/tasks/cc/vision/object_detector/proto:object_detector_options_jspb_proto",
|
"//mediapipe/tasks/cc/vision/object_detector/proto:object_detector_options_jspb_proto",
|
||||||
|
"//mediapipe/tasks/web/components/containers:category",
|
||||||
"//mediapipe/tasks/web/components/processors:base_options",
|
"//mediapipe/tasks/web/components/processors:base_options",
|
||||||
"//mediapipe/tasks/web/core",
|
"//mediapipe/tasks/web/core",
|
||||||
"//mediapipe/tasks/web/core:task_runner",
|
"//mediapipe/tasks/web/core:task_runner",
|
||||||
"//mediapipe/web/graph_runner:wasm_mediapipe_lib_ts",
|
"//mediapipe/web/graph_runner:wasm_mediapipe_lib_ts",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
mediapipe_ts_declaration(
|
|
||||||
name = "object_detector_types",
|
|
||||||
srcs = [
|
|
||||||
"object_detector_options.d.ts",
|
|
||||||
"object_detector_result.d.ts",
|
|
||||||
],
|
|
||||||
deps = [
|
|
||||||
"//mediapipe/tasks/web/components/containers:category",
|
|
||||||
"//mediapipe/tasks/web/core",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
import {BaseOptions} from '../../../../tasks/web/core/base_options';
|
import {BaseOptions} from '../../../../tasks/web/core/base_options';
|
||||||
|
|
||||||
/** Options to configure the MediaPipe Object Detector Task */
|
/** Options to configure the MediaPipe Object Detector Task */
|
||||||
export declare interface ObjectDetectorOptions {
|
export interface ObjectDetectorOptions {
|
||||||
/** Options to configure the loading of the model assets. */
|
/** Options to configure the loading of the model assets. */
|
||||||
baseOptions?: BaseOptions;
|
baseOptions?: BaseOptions;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user