mediapipe 0.10.30__py3-none-win_amd64.whl
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.
- mediapipe/__init__.py +20 -0
- mediapipe/modules/hand_landmark/handedness.txt +2 -0
- mediapipe/modules/objectron/object_detection_oidv4_labelmap.txt +24 -0
- mediapipe/tasks/__init__.py +14 -0
- mediapipe/tasks/c/__init__.py +1 -0
- mediapipe/tasks/c/libmediapipe.dll +0 -0
- mediapipe/tasks/metadata/image_segmenter_metadata_schema.fbs +59 -0
- mediapipe/tasks/metadata/image_segmenter_metadata_schema_py_generated.py +108 -0
- mediapipe/tasks/metadata/metadata_schema.fbs +732 -0
- mediapipe/tasks/metadata/metadata_schema_py_generated.py +3251 -0
- mediapipe/tasks/metadata/object_detector_metadata_schema.fbs +98 -0
- mediapipe/tasks/metadata/object_detector_metadata_schema_py_generated.py +674 -0
- mediapipe/tasks/metadata/schema_py_generated.py +18667 -0
- mediapipe/tasks/python/__init__.py +27 -0
- mediapipe/tasks/python/audio/__init__.py +28 -0
- mediapipe/tasks/python/audio/audio_classifier.py +456 -0
- mediapipe/tasks/python/audio/core/__init__.py +16 -0
- mediapipe/tasks/python/audio/core/audio_record.py +125 -0
- mediapipe/tasks/python/audio/core/audio_task_running_mode.py +48 -0
- mediapipe/tasks/python/benchmark/__init__.py +13 -0
- mediapipe/tasks/python/benchmark/benchmark_utils.py +70 -0
- mediapipe/tasks/python/benchmark/vision/__init__.py +13 -0
- mediapipe/tasks/python/benchmark/vision/benchmark.py +99 -0
- mediapipe/tasks/python/benchmark/vision/core/__init__.py +14 -0
- mediapipe/tasks/python/benchmark/vision/core/base_vision_benchmark_api.py +40 -0
- mediapipe/tasks/python/components/__init__.py +13 -0
- mediapipe/tasks/python/components/containers/__init__.py +53 -0
- mediapipe/tasks/python/components/containers/audio_data.py +152 -0
- mediapipe/tasks/python/components/containers/audio_data_c.py +27 -0
- mediapipe/tasks/python/components/containers/bounding_box.py +66 -0
- mediapipe/tasks/python/components/containers/category.py +97 -0
- mediapipe/tasks/python/components/containers/category_c.py +37 -0
- mediapipe/tasks/python/components/containers/classification_result.py +99 -0
- mediapipe/tasks/python/components/containers/classification_result_c.py +37 -0
- mediapipe/tasks/python/components/containers/detections.py +122 -0
- mediapipe/tasks/python/components/containers/detections_c.py +41 -0
- mediapipe/tasks/python/components/containers/embedding_result.py +93 -0
- mediapipe/tasks/python/components/containers/embedding_result_c.py +39 -0
- mediapipe/tasks/python/components/containers/keypoint.py +72 -0
- mediapipe/tasks/python/components/containers/keypoint_c.py +27 -0
- mediapipe/tasks/python/components/containers/landmark.py +108 -0
- mediapipe/tasks/python/components/containers/landmark_c.py +65 -0
- mediapipe/tasks/python/components/containers/landmark_detection_result.py +42 -0
- mediapipe/tasks/python/components/containers/matrix_c.py +50 -0
- mediapipe/tasks/python/components/containers/rect.py +123 -0
- mediapipe/tasks/python/components/containers/rect_c.py +50 -0
- mediapipe/tasks/python/components/processors/__init__.py +23 -0
- mediapipe/tasks/python/components/processors/classifier_options.py +64 -0
- mediapipe/tasks/python/components/processors/classifier_options_c.py +81 -0
- mediapipe/tasks/python/components/utils/__init__.py +13 -0
- mediapipe/tasks/python/components/utils/cosine_similarity.py +68 -0
- mediapipe/tasks/python/core/__init__.py +13 -0
- mediapipe/tasks/python/core/async_result_dispatcher.py +232 -0
- mediapipe/tasks/python/core/base_options.py +80 -0
- mediapipe/tasks/python/core/base_options_c.py +25 -0
- mediapipe/tasks/python/core/mediapipe_c_bindings.py +120 -0
- mediapipe/tasks/python/core/mediapipe_c_utils.py +232 -0
- mediapipe/tasks/python/core/optional_dependencies.py +25 -0
- mediapipe/tasks/python/core/serial_dispatcher.py +91 -0
- mediapipe/tasks/python/genai/__init__.py +14 -0
- mediapipe/tasks/python/genai/bundler/__init__.py +23 -0
- mediapipe/tasks/python/genai/bundler/llm_bundler.py +231 -0
- mediapipe/tasks/python/genai/bundler/llm_bundler_test.py +225 -0
- mediapipe/tasks/python/genai/converter/__init__.py +24 -0
- mediapipe/tasks/python/genai/converter/converter_base.py +184 -0
- mediapipe/tasks/python/genai/converter/converter_factory.py +79 -0
- mediapipe/tasks/python/genai/converter/external_dependencies.py +26 -0
- mediapipe/tasks/python/genai/converter/llm_converter.py +572 -0
- mediapipe/tasks/python/genai/converter/llm_converter_test.py +263 -0
- mediapipe/tasks/python/genai/converter/pytorch_converter.py +320 -0
- mediapipe/tasks/python/genai/converter/pytorch_converter_test.py +86 -0
- mediapipe/tasks/python/genai/converter/quantization_util.py +600 -0
- mediapipe/tasks/python/genai/converter/quantization_util_test.py +292 -0
- mediapipe/tasks/python/genai/converter/safetensors_converter.py +634 -0
- mediapipe/tasks/python/genai/converter/safetensors_converter_test.py +83 -0
- mediapipe/tasks/python/genai/converter/weight_bins_writer.py +122 -0
- mediapipe/tasks/python/genai/converter/weight_bins_writer_test.py +95 -0
- mediapipe/tasks/python/metadata/__init__.py +13 -0
- mediapipe/tasks/python/metadata/metadata.py +1013 -0
- mediapipe/tasks/python/metadata/metadata_displayer_cli.py +34 -0
- mediapipe/tasks/python/metadata/metadata_writers/__init__.py +13 -0
- mediapipe/tasks/python/metadata/metadata_writers/image_classifier.py +71 -0
- mediapipe/tasks/python/metadata/metadata_writers/image_segmenter.py +170 -0
- mediapipe/tasks/python/metadata/metadata_writers/metadata_info.py +1166 -0
- mediapipe/tasks/python/metadata/metadata_writers/metadata_writer.py +845 -0
- mediapipe/tasks/python/metadata/metadata_writers/model_asset_bundle_utils.py +71 -0
- mediapipe/tasks/python/metadata/metadata_writers/object_detector.py +331 -0
- mediapipe/tasks/python/metadata/metadata_writers/text_classifier.py +119 -0
- mediapipe/tasks/python/metadata/metadata_writers/writer_utils.py +91 -0
- mediapipe/tasks/python/test/__init__.py +13 -0
- mediapipe/tasks/python/test/audio/__init__.py +13 -0
- mediapipe/tasks/python/test/audio/audio_classifier_test.py +405 -0
- mediapipe/tasks/python/test/test_utils.py +196 -0
- mediapipe/tasks/python/test/text/__init__.py +13 -0
- mediapipe/tasks/python/test/text/language_detector_test.py +226 -0
- mediapipe/tasks/python/test/text/text_classifier_test.py +295 -0
- mediapipe/tasks/python/test/text/text_embedder_test.py +328 -0
- mediapipe/tasks/python/test/vision/__init__.py +13 -0
- mediapipe/tasks/python/test/vision/face_detector_test.py +517 -0
- mediapipe/tasks/python/test/vision/face_landmarker_test.py +568 -0
- mediapipe/tasks/python/test/vision/hand_landmarker_test.py +455 -0
- mediapipe/tasks/python/test/vision/image_classifier_test.py +679 -0
- mediapipe/tasks/python/test/vision/image_embedder_test.py +450 -0
- mediapipe/tasks/python/test/vision/image_segmenter_test.py +529 -0
- mediapipe/tasks/python/test/vision/image_test.py +113 -0
- mediapipe/tasks/python/test/vision/interactive_segmenter_test.py +343 -0
- mediapipe/tasks/python/test/vision/object_detector_test.py +520 -0
- mediapipe/tasks/python/test/vision/pose_landmarker_test.py +525 -0
- mediapipe/tasks/python/test/vision/proto_utils.py +182 -0
- mediapipe/tasks/python/text/__init__.py +35 -0
- mediapipe/tasks/python/text/language_detector.py +290 -0
- mediapipe/tasks/python/text/text_classifier.py +264 -0
- mediapipe/tasks/python/text/text_embedder.py +260 -0
- mediapipe/tasks/python/vision/__init__.py +77 -0
- mediapipe/tasks/python/vision/core/__init__.py +14 -0
- mediapipe/tasks/python/vision/core/image.py +491 -0
- mediapipe/tasks/python/vision/core/image_processing_options.py +57 -0
- mediapipe/tasks/python/vision/core/image_processing_options_c.py +28 -0
- mediapipe/tasks/python/vision/core/vision_task_running_mode.py +79 -0
- mediapipe/tasks/python/vision/face_detector.py +457 -0
- mediapipe/tasks/python/vision/face_landmarker.py +3325 -0
- mediapipe/tasks/python/vision/gesture_recognizer.py +493 -0
- mediapipe/tasks/python/vision/gesture_recognizer_result.py +96 -0
- mediapipe/tasks/python/vision/gesture_recognizer_result_c.py +40 -0
- mediapipe/tasks/python/vision/hand_landmarker.py +603 -0
- mediapipe/tasks/python/vision/image_classifier.py +481 -0
- mediapipe/tasks/python/vision/image_embedder.py +497 -0
- mediapipe/tasks/python/vision/image_segmenter.py +544 -0
- mediapipe/tasks/python/vision/interactive_segmenter.py +350 -0
- mediapipe/tasks/python/vision/object_detector.py +538 -0
- mediapipe/tasks/python/vision/pose_landmarker.py +571 -0
- mediapipe-0.10.30.dist-info/METADATA +203 -0
- mediapipe-0.10.30.dist-info/RECORD +136 -0
- mediapipe-0.10.30.dist-info/WHEEL +5 -0
- mediapipe-0.10.30.dist-info/licenses/LICENSE +218 -0
- mediapipe-0.10.30.dist-info/top_level.txt +2 -0
mediapipe/__init__.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright 2019 - 2022 The MediaPipe Authors.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
import mediapipe.tasks.python as tasks
|
|
16
|
+
from mediapipe.tasks.python.vision.core.image import Image
|
|
17
|
+
from mediapipe.tasks.python.vision.core.image import ImageFormat
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
__version__ = '0.10.30'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
???
|
|
2
|
+
Bicycle
|
|
3
|
+
Boot
|
|
4
|
+
Laptop
|
|
5
|
+
Person
|
|
6
|
+
Chair
|
|
7
|
+
Cattle
|
|
8
|
+
Desk
|
|
9
|
+
Cat
|
|
10
|
+
Computer mouse
|
|
11
|
+
Computer monitor
|
|
12
|
+
Box
|
|
13
|
+
Mug
|
|
14
|
+
Coffee cup
|
|
15
|
+
Stationary bicycle
|
|
16
|
+
Table
|
|
17
|
+
Bottle
|
|
18
|
+
High heels
|
|
19
|
+
Vehicle
|
|
20
|
+
Footwear
|
|
21
|
+
Dog
|
|
22
|
+
Book
|
|
23
|
+
Camera
|
|
24
|
+
Car
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Copyright 2022 The MediaPipe Authors.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
14
|
+
"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Empty __init__.py file"""
|
|
Binary file
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright 2023 The MediaPipe Authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
namespace mediapipe.tasks;
|
|
16
|
+
|
|
17
|
+
// Image segmenter metadata contains information specific for the image
|
|
18
|
+
// segmentation task. The metadata can be added in
|
|
19
|
+
// SubGraphMetadata.custom_metadata [1] in model metadata.
|
|
20
|
+
// [1]: https://github.com/google/mediapipe/blob/46b5c4012d2ef76c9d92bb0d88a6b107aee83814/mediapipe/tasks/metadata/metadata_schema.fbs#L685
|
|
21
|
+
|
|
22
|
+
// ImageSegmenterOptions.min_parser_version indicates the minimum necessary
|
|
23
|
+
// image segmenter metadata parser version to fully understand all fields in a
|
|
24
|
+
// given metadata flatbuffer. This min_parser_version is specific for the
|
|
25
|
+
// image segmenter metadata defined in this schema file.
|
|
26
|
+
//
|
|
27
|
+
// New fields and types will have associated comments with the schema version
|
|
28
|
+
// for which they were added.
|
|
29
|
+
//
|
|
30
|
+
// Schema Semantic version: 1.0.0
|
|
31
|
+
|
|
32
|
+
// This indicates the flatbuffer compatibility. The number will bump up when a
|
|
33
|
+
// break change is applied to the schema, such as removing fields or adding new
|
|
34
|
+
// fields to the middle of a table.
|
|
35
|
+
file_identifier "V001";
|
|
36
|
+
|
|
37
|
+
// History:
|
|
38
|
+
// 1.0.0 - Initial version.
|
|
39
|
+
|
|
40
|
+
// Supported activation functions.
|
|
41
|
+
enum Activation: byte {
|
|
42
|
+
NONE = 0,
|
|
43
|
+
SIGMOID = 1,
|
|
44
|
+
SOFTMAX = 2
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
table ImageSegmenterOptions {
|
|
48
|
+
// The activation function of the output layer in the image segmenter.
|
|
49
|
+
activation: Activation;
|
|
50
|
+
|
|
51
|
+
// The minimum necessary image segmenter metadata parser version to fully
|
|
52
|
+
// understand all fields in a given metadata flatbuffer. This field is
|
|
53
|
+
// automatically populated by the MetadataPopulator when the metadata is
|
|
54
|
+
// populated into a TFLite model. This min_parser_version is specific for the
|
|
55
|
+
// image segmenter metadata defined in this schema file.
|
|
56
|
+
min_parser_version:string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
root_type ImageSegmenterOptions;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import flatbuffers
|
|
2
|
+
|
|
3
|
+
# automatically generated by the FlatBuffers compiler, do not modify
|
|
4
|
+
|
|
5
|
+
# namespace: tasks
|
|
6
|
+
|
|
7
|
+
from flatbuffers.compat import import_numpy
|
|
8
|
+
np = import_numpy()
|
|
9
|
+
|
|
10
|
+
class Activation(object):
|
|
11
|
+
NONE = 0
|
|
12
|
+
SIGMOID = 1
|
|
13
|
+
SOFTMAX = 2
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ImageSegmenterOptions(object):
|
|
17
|
+
__slots__ = ['_tab']
|
|
18
|
+
|
|
19
|
+
@classmethod
|
|
20
|
+
def GetRootAs(cls, buf, offset=0):
|
|
21
|
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
|
22
|
+
x = ImageSegmenterOptions()
|
|
23
|
+
x.Init(buf, n + offset)
|
|
24
|
+
return x
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def GetRootAsImageSegmenterOptions(cls, buf, offset=0):
|
|
28
|
+
"""This method is deprecated. Please switch to GetRootAs."""
|
|
29
|
+
return cls.GetRootAs(buf, offset)
|
|
30
|
+
@classmethod
|
|
31
|
+
def ImageSegmenterOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
|
32
|
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x56\x30\x30\x31", size_prefixed=size_prefixed)
|
|
33
|
+
|
|
34
|
+
# ImageSegmenterOptions
|
|
35
|
+
def Init(self, buf, pos):
|
|
36
|
+
self._tab = flatbuffers.table.Table(buf, pos)
|
|
37
|
+
|
|
38
|
+
# ImageSegmenterOptions
|
|
39
|
+
def Activation(self):
|
|
40
|
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
|
41
|
+
if o != 0:
|
|
42
|
+
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
|
|
43
|
+
return 0
|
|
44
|
+
|
|
45
|
+
# ImageSegmenterOptions
|
|
46
|
+
def MinParserVersion(self):
|
|
47
|
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
|
48
|
+
if o != 0:
|
|
49
|
+
return self._tab.String(o + self._tab.Pos)
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
def ImageSegmenterOptionsStart(builder):
|
|
53
|
+
builder.StartObject(2)
|
|
54
|
+
|
|
55
|
+
def ImageSegmenterOptionsAddActivation(builder, activation):
|
|
56
|
+
builder.PrependInt8Slot(0, activation, 0)
|
|
57
|
+
|
|
58
|
+
def ImageSegmenterOptionsAddMinParserVersion(builder, minParserVersion):
|
|
59
|
+
builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(minParserVersion), 0)
|
|
60
|
+
|
|
61
|
+
def ImageSegmenterOptionsEnd(builder):
|
|
62
|
+
return builder.EndObject()
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class ImageSegmenterOptionsT(object):
|
|
67
|
+
|
|
68
|
+
# ImageSegmenterOptionsT
|
|
69
|
+
def __init__(self):
|
|
70
|
+
self.activation = 0 # type: int
|
|
71
|
+
self.minParserVersion = None # type: str
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def InitFromBuf(cls, buf, pos):
|
|
75
|
+
imageSegmenterOptions = ImageSegmenterOptions()
|
|
76
|
+
imageSegmenterOptions.Init(buf, pos)
|
|
77
|
+
return cls.InitFromObj(imageSegmenterOptions)
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def InitFromPackedBuf(cls, buf, pos=0):
|
|
81
|
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
|
82
|
+
return cls.InitFromBuf(buf, pos+n)
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def InitFromObj(cls, imageSegmenterOptions):
|
|
86
|
+
x = ImageSegmenterOptionsT()
|
|
87
|
+
x._UnPack(imageSegmenterOptions)
|
|
88
|
+
return x
|
|
89
|
+
|
|
90
|
+
# ImageSegmenterOptionsT
|
|
91
|
+
def _UnPack(self, imageSegmenterOptions):
|
|
92
|
+
if imageSegmenterOptions is None:
|
|
93
|
+
return
|
|
94
|
+
self.activation = imageSegmenterOptions.Activation()
|
|
95
|
+
self.minParserVersion = imageSegmenterOptions.MinParserVersion()
|
|
96
|
+
|
|
97
|
+
# ImageSegmenterOptionsT
|
|
98
|
+
def Pack(self, builder):
|
|
99
|
+
if self.minParserVersion is not None:
|
|
100
|
+
minParserVersion = builder.CreateString(self.minParserVersion)
|
|
101
|
+
ImageSegmenterOptionsStart(builder)
|
|
102
|
+
ImageSegmenterOptionsAddActivation(builder, self.activation)
|
|
103
|
+
if self.minParserVersion is not None:
|
|
104
|
+
ImageSegmenterOptionsAddMinParserVersion(builder, minParserVersion)
|
|
105
|
+
imageSegmenterOptions = ImageSegmenterOptionsEnd(builder)
|
|
106
|
+
return imageSegmenterOptions
|
|
107
|
+
|
|
108
|
+
|