2020-08-13 03:57:56 +02:00
|
|
|
# Copyright 2020 The MediaPipe Authors.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2022-09-06 23:29:51 +02:00
|
|
|
load("@org_tensorflow//tensorflow:tensorflow.bzl", "pybind_extension")
|
2020-08-13 03:57:56 +02:00
|
|
|
|
|
|
|
licenses(["notice"]) # Apache 2.0
|
|
|
|
|
2022-09-06 23:29:51 +02:00
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
2020-08-13 03:57:56 +02:00
|
|
|
pybind_extension(
|
|
|
|
name = "_framework_bindings",
|
|
|
|
srcs = ["framework_bindings.cc"],
|
2020-08-30 05:41:10 +02:00
|
|
|
linkopts = select({
|
|
|
|
"//third_party:opencv_source_build": [],
|
|
|
|
"//conditions:default": [
|
|
|
|
"-lopencv_core",
|
|
|
|
"-lopencv_imgproc",
|
|
|
|
"-lopencv_highgui",
|
|
|
|
"-lopencv_video",
|
|
|
|
"-lopencv_features2d",
|
|
|
|
"-lopencv_calib3d",
|
|
|
|
"-lopencv_imgcodecs",
|
|
|
|
],
|
|
|
|
}),
|
2022-09-06 23:29:51 +02:00
|
|
|
module_name = "_framework_bindings",
|
2020-08-13 03:57:56 +02:00
|
|
|
deps = [
|
|
|
|
":builtin_calculators",
|
2022-09-06 23:29:51 +02:00
|
|
|
":builtin_task_graphs",
|
2020-08-13 03:57:56 +02:00
|
|
|
"//mediapipe/python/pybind:calculator_graph",
|
2021-05-05 03:30:15 +02:00
|
|
|
"//mediapipe/python/pybind:image",
|
2020-08-13 03:57:56 +02:00
|
|
|
"//mediapipe/python/pybind:image_frame",
|
|
|
|
"//mediapipe/python/pybind:matrix",
|
|
|
|
"//mediapipe/python/pybind:packet",
|
|
|
|
"//mediapipe/python/pybind:packet_creator",
|
|
|
|
"//mediapipe/python/pybind:packet_getter",
|
|
|
|
"//mediapipe/python/pybind:resource_util",
|
|
|
|
"//mediapipe/python/pybind:timestamp",
|
2020-09-16 03:31:50 +02:00
|
|
|
"//mediapipe/python/pybind:validated_graph_config",
|
2022-09-06 23:29:51 +02:00
|
|
|
"//mediapipe/tasks/python/core/pybind:task_runner",
|
2022-09-29 12:42:07 +02:00
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
"@stblib//:stb_image",
|
2020-11-05 01:02:35 +01:00
|
|
|
# Type registration.
|
|
|
|
"//mediapipe/framework:basic_types_registration",
|
|
|
|
"//mediapipe/framework/formats:classification_registration",
|
|
|
|
"//mediapipe/framework/formats:detection_registration",
|
|
|
|
"//mediapipe/framework/formats:landmark_registration",
|
2021-02-27 09:21:16 +01:00
|
|
|
"//mediapipe/framework/formats:rect_registration",
|
|
|
|
"//mediapipe/modules/objectron/calculators:annotation_registration",
|
2020-11-05 01:02:35 +01:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "builtin_calculators",
|
|
|
|
deps = [
|
2020-12-10 04:13:05 +01:00
|
|
|
"//mediapipe/calculators/core:gate_calculator",
|
2020-11-05 01:02:35 +01:00
|
|
|
"//mediapipe/calculators/core:pass_through_calculator",
|
2020-12-10 04:13:05 +01:00
|
|
|
"//mediapipe/calculators/core:side_packet_to_stream_calculator",
|
2022-03-21 20:07:37 +01:00
|
|
|
"//mediapipe/calculators/core:split_proto_list_calculator",
|
2020-12-10 04:13:05 +01:00
|
|
|
"//mediapipe/calculators/core:string_to_int_calculator",
|
|
|
|
"//mediapipe/calculators/image:image_transformation_calculator",
|
|
|
|
"//mediapipe/calculators/util:detection_unique_id_calculator",
|
2021-06-24 23:10:25 +02:00
|
|
|
"//mediapipe/modules/face_detection:face_detection_full_range_cpu",
|
|
|
|
"//mediapipe/modules/face_detection:face_detection_short_range_cpu",
|
2020-11-05 01:02:35 +01:00
|
|
|
"//mediapipe/modules/face_landmark:face_landmark_front_cpu",
|
|
|
|
"//mediapipe/modules/hand_landmark:hand_landmark_tracking_cpu",
|
2020-12-10 04:13:05 +01:00
|
|
|
"//mediapipe/modules/holistic_landmark:holistic_landmark_cpu",
|
2021-02-27 09:21:16 +01:00
|
|
|
"//mediapipe/modules/objectron:objectron_cpu",
|
2020-11-05 01:02:35 +01:00
|
|
|
"//mediapipe/modules/palm_detection:palm_detection_cpu",
|
|
|
|
"//mediapipe/modules/pose_detection:pose_detection_cpu",
|
2020-12-10 04:13:05 +01:00
|
|
|
"//mediapipe/modules/pose_landmark:pose_landmark_by_roi_cpu",
|
|
|
|
"//mediapipe/modules/pose_landmark:pose_landmark_cpu",
|
2021-06-03 22:13:30 +02:00
|
|
|
"//mediapipe/modules/selfie_segmentation:selfie_segmentation_cpu",
|
2020-08-13 03:57:56 +02:00
|
|
|
],
|
|
|
|
)
|
2022-09-06 23:29:51 +02:00
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "builtin_task_graphs",
|
|
|
|
deps = [
|
2022-11-03 16:52:17 +01:00
|
|
|
"//mediapipe/tasks/cc/vision/gesture_recognizer:gesture_recognizer_graph",
|
2022-09-29 11:45:20 +02:00
|
|
|
"//mediapipe/tasks/cc/vision/image_classifier:image_classifier_graph",
|
2022-11-12 02:03:00 +01:00
|
|
|
"//mediapipe/tasks/cc/vision/image_embedder:image_embedder_graph",
|
2022-09-21 12:23:04 +02:00
|
|
|
"//mediapipe/tasks/cc/vision/image_segmenter:image_segmenter_graph",
|
2022-09-06 23:29:51 +02:00
|
|
|
"//mediapipe/tasks/cc/vision/object_detector:object_detector_graph",
|
2022-11-07 19:26:19 +01:00
|
|
|
] + select({
|
2022-11-13 19:44:54 +01:00
|
|
|
# TODO: Build text_classifier_graph and text_embedder_graph on Windows.
|
2022-11-14 21:16:45 +01:00
|
|
|
# TODO: Build audio_classifier_graph and audio_embedder_graph on Windows.
|
2022-11-07 19:26:19 +01:00
|
|
|
"//mediapipe:windows": [],
|
|
|
|
"//conditions:default": [
|
2022-11-08 02:25:13 +01:00
|
|
|
"//mediapipe/tasks/cc/audio/audio_classifier:audio_classifier_graph",
|
2022-11-14 21:16:45 +01:00
|
|
|
"//mediapipe/tasks/cc/audio/audio_embedder:audio_embedder_graph",
|
2022-11-07 19:26:19 +01:00
|
|
|
"//mediapipe/tasks/cc/text/text_classifier:text_classifier_graph",
|
2022-11-10 11:16:51 +01:00
|
|
|
"//mediapipe/tasks/cc/text/text_embedder:text_embedder_graph",
|
2022-11-07 19:26:19 +01:00
|
|
|
],
|
|
|
|
}),
|
2022-09-06 23:29:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
py_library(
|
|
|
|
name = "packet_creator",
|
|
|
|
srcs = ["packet_creator.py"],
|
|
|
|
srcs_version = "PY3",
|
|
|
|
deps = [
|
|
|
|
":_framework_bindings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_library(
|
|
|
|
name = "packet_getter",
|
|
|
|
srcs = ["packet_getter.py"],
|
|
|
|
srcs_version = "PY3",
|
|
|
|
deps = [
|
|
|
|
":_framework_bindings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-11-11 01:46:12 +01:00
|
|
|
py_library(
|
|
|
|
name = "solution_base",
|
|
|
|
srcs = ["solution_base.py"],
|
|
|
|
srcs_version = "PY3",
|
|
|
|
visibility = [
|
|
|
|
"//mediapipe/python:__subpackages__",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":_framework_bindings",
|
|
|
|
":packet_creator",
|
|
|
|
":packet_getter",
|
|
|
|
"//mediapipe/calculators/core:constant_side_packet_calculator_py_pb2",
|
|
|
|
"//mediapipe/calculators/image:image_transformation_calculator_py_pb2",
|
|
|
|
"//mediapipe/calculators/tensor:tensors_to_detections_calculator_py_pb2",
|
|
|
|
"//mediapipe/calculators/util:landmarks_smoothing_calculator_py_pb2",
|
|
|
|
"//mediapipe/calculators/util:logic_calculator_py_pb2",
|
|
|
|
"//mediapipe/calculators/util:thresholding_calculator_py_pb2",
|
|
|
|
"//mediapipe/framework:calculator_py_pb2",
|
|
|
|
"//mediapipe/framework/formats:classification_py_pb2",
|
|
|
|
"//mediapipe/framework/formats:detection_py_pb2",
|
|
|
|
"//mediapipe/framework/formats:landmark_py_pb2",
|
|
|
|
"//mediapipe/framework/formats:rect_py_pb2",
|
|
|
|
"//mediapipe/modules/objectron/calculators:annotation_py_pb2",
|
|
|
|
"//mediapipe/modules/objectron/calculators:lift_2d_frame_annotation_to_3d_calculator_py_pb2",
|
|
|
|
"@com_google_protobuf//:protobuf_python",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-09-06 23:29:51 +02:00
|
|
|
py_test(
|
|
|
|
name = "calculator_graph_test",
|
|
|
|
srcs = ["calculator_graph_test.py"],
|
|
|
|
python_version = "PY3",
|
|
|
|
srcs_version = "PY3",
|
|
|
|
deps = [
|
|
|
|
":_framework_bindings",
|
|
|
|
":packet_creator",
|
|
|
|
":packet_getter",
|
|
|
|
"//mediapipe/framework:calculator_py_pb2",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
name = "image_test",
|
|
|
|
srcs = ["image_test.py"],
|
|
|
|
python_version = "PY3",
|
|
|
|
srcs_version = "PY3",
|
|
|
|
deps = [
|
|
|
|
":_framework_bindings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
name = "image_frame_test",
|
|
|
|
srcs = ["image_frame_test.py"],
|
|
|
|
python_version = "PY3",
|
|
|
|
srcs_version = "PY3",
|
|
|
|
deps = [
|
|
|
|
":_framework_bindings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
name = "packet_test",
|
|
|
|
srcs = ["packet_test.py"],
|
|
|
|
python_version = "PY3",
|
|
|
|
srcs_version = "PY3",
|
|
|
|
deps = [
|
|
|
|
":_framework_bindings",
|
|
|
|
":packet_creator",
|
|
|
|
":packet_getter",
|
|
|
|
"//mediapipe/framework/formats:detection_py_pb2",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
name = "timestamp_test",
|
|
|
|
srcs = ["timestamp_test.py"],
|
|
|
|
python_version = "PY3",
|
|
|
|
srcs_version = "PY3",
|
|
|
|
deps = [
|
|
|
|
":_framework_bindings",
|
|
|
|
],
|
|
|
|
)
|
2022-11-11 01:46:12 +01:00
|
|
|
|
|
|
|
py_test(
|
|
|
|
name = "solution_base_test",
|
|
|
|
srcs = ["solution_base_test.py"],
|
|
|
|
python_version = "PY3",
|
|
|
|
srcs_version = "PY3",
|
|
|
|
deps = [
|
|
|
|
":solution_base",
|
|
|
|
"//file/google_src",
|
|
|
|
"//file/localfile",
|
|
|
|
"//mediapipe/calculators/core:gate_calculator",
|
|
|
|
"//mediapipe/calculators/core:pass_through_calculator",
|
|
|
|
"//mediapipe/calculators/core:side_packet_to_stream_calculator",
|
|
|
|
"//mediapipe/calculators/image:image_transformation_calculator",
|
|
|
|
"//mediapipe/calculators/util:detection_unique_id_calculator",
|
|
|
|
"//mediapipe/calculators/util:to_image_calculator",
|
|
|
|
"//mediapipe/framework:calculator_py_pb2",
|
|
|
|
"//mediapipe/framework/formats:detection_py_pb2",
|
|
|
|
"@com_google_protobuf//:protobuf_python",
|
|
|
|
],
|
|
|
|
)
|