Compare commits

...

1223 Commits

Author SHA1 Message Date
Dmitri Gribenko
ec43bea176 No public description
PiperOrigin-RevId: 595039397
2024-01-02 00:01:27 -08:00
Copybara-Service
e23fa531e1 Merge pull request from kinaryml:python-holistic-landmarker
PiperOrigin-RevId: 594995636
2024-01-01 18:49:45 -08:00
MediaPipe Team
8609e5fae5 Adds warning about using Tensors::OpenGlBufferViews with multiple GlContexts.
PiperOrigin-RevId: 592924315
2023-12-21 12:29:11 -08:00
MediaPipe Team
cfb4465c38 Guard WaitOnGpu with extra OpenGL checks.
PiperOrigin-RevId: 592707594
2023-12-20 18:22:27 -08:00
MediaPipe Team
835ee5e354 No public description
PiperOrigin-RevId: 592683556
2023-12-20 16:16:50 -08:00
MediaPipe Team
52c1d44561 TypeScript: adding VideoFrame typings support to video input
PiperOrigin-RevId: 592640146
2023-12-20 13:16:55 -08:00
Sebastian Schmidt
1fa79195ec Rename Holistic's landmarksConfidence to presenceConfidence to match other APIs better
PiperOrigin-RevId: 592607279
2023-12-20 11:07:46 -08:00
Sebastian Schmidt
7edcba9fc0 Upgrade TypeScript to 5.3.3
PiperOrigin-RevId: 592599208
2023-12-20 10:38:57 -08:00
MediaPipe Team
1a88e75a37 No public description
PiperOrigin-RevId: 592472709
2023-12-20 00:58:34 -08:00
MediaPipe Team
42aa649aa6 Explicitly cast at callsite of WebGL context creation to avoid compilation errors with newer Emscripten versions.
PiperOrigin-RevId: 592409915
2023-12-19 19:45:08 -08:00
MediaPipe Team
473757c6cc No public description
PiperOrigin-RevId: 592358739
2023-12-19 15:22:26 -08:00
MediaPipe Team
7c3a5296ab Make DeletingFile movable.
PiperOrigin-RevId: 592332785
2023-12-19 13:48:20 -08:00
Sebastian Schmidt
5ee24d1662 Expose MediaPipe's ABSL and Sentencepiece as shared dependencies
PiperOrigin-RevId: 592256006
2023-12-19 09:21:57 -08:00
MediaPipe Team
4f4f107a8b Add Holistic Landmarker Web API.
PiperOrigin-RevId: 592006517
2023-12-18 14:17:57 -08:00
MediaPipe Team
91cfc691e4 Remove superfluous glFlush().
PiperOrigin-RevId: 591954599
2023-12-18 11:13:16 -08:00
Copybara-Service
e2ea358919 Merge pull request from priankakariatyml:ios-pose-landmarker-implementation
PiperOrigin-RevId: 591910121
2023-12-18 08:54:34 -08:00
Kinar
569c16db0b Documented HolisticLandmarkerResult 2023-12-18 04:37:29 -08:00
Kinar
cba0878652 Updated Copyright year 2023-12-18 02:51:11 -08:00
Kinar
a667949b99 Changed import style in task_info 2023-12-18 02:49:20 -08:00
Kinar
30e6b766d4 Revised implementation and added more tests 2023-12-18 02:47:28 -08:00
Kinar R
88463aeb9e
Merge branch 'google:master' into python-holistic-landmarker 2023-12-18 15:01:43 +05:30
Kinar R
c0606e819c
Update holistic_landmarker.py 2023-12-18 05:00:45 +05:30
Kinar R
00eb1f190f
Fix typo in holistic_landmarker_test.py 2023-12-18 04:57:25 +05:30
Kinar
24fe8eb73a Support both proto2 and proto3 in task subgraph options configuration, and revised the Holistic Landmarker API's implementation 2023-12-17 15:13:34 -08:00
Sebastian Schmidt
4b471266b8 No public description
PiperOrigin-RevId: 591370734
2023-12-15 15:10:53 -08:00
MediaPipe Team
41db137d37 No public description
PiperOrigin-RevId: 591351708
2023-12-15 14:00:39 -08:00
MediaPipe Team
e55caa234c No public description
PiperOrigin-RevId: 591148449
2023-12-14 22:25:41 -08:00
MediaPipe Team
28d5546d9d Internal change
PiperOrigin-RevId: 591121815
2023-12-14 19:48:57 -08:00
Copybara-Service
d6b8c2257b Merge pull request from kinaryml:c-face-landmarker-api
PiperOrigin-RevId: 591062403
2023-12-14 15:07:10 -08:00
MediaPipe Team
746d775933 Extend verifyGraph to be compatible with proto3.
PiperOrigin-RevId: 591047275
2023-12-14 14:12:36 -08:00
Kinar
5e75a169d3 Fix rows to columns for the field cols in struct Matrix 2023-12-14 09:02:05 -08:00
Kinar
f4bbfef674 Use memcpy now for copying data and indicate how the data is stored 2023-12-14 08:56:38 -08:00
Sebastian Schmidt
df7feadaf7 No public description
PiperOrigin-RevId: 590950821
2023-12-14 08:44:26 -08:00
MediaPipe Team
4004c2dfaa No public description
PiperOrigin-RevId: 590913209
2023-12-14 06:05:32 -08:00
Kinar
6fab3a8b85 Simplified copying data from Eigen matrix to C-style matrix and addressed some issues 2023-12-13 19:59:36 -08:00
Copybara-Service
04bcb0d2ee Merge pull request from priankakariatyml:ios-mpp-image-utils-pixel-buffer-format-fix
PiperOrigin-RevId: 590770032
2023-12-13 18:03:58 -08:00
MediaPipe Team
4e89de69a6 Version increment in version.bzl
PiperOrigin-RevId: 590658960
2023-12-13 11:19:06 -08:00
MediaPipe Team
4892209da9 No public description
PiperOrigin-RevId: 590629265
2023-12-13 09:49:59 -08:00
Sebastian Schmidt
15f2b32006 Expose MediaPipe's ABSL and Sentencepiece as shared dependencies
PiperOrigin-RevId: 590320902
2023-12-12 13:49:54 -08:00
Sebastian Schmidt
4237b765ce Internal
PiperOrigin-RevId: 590220032
2023-12-12 08:58:08 -08:00
MediaPipe Team
9a20d6b3e4 Create an explicit GlRuntimeException class
PiperOrigin-RevId: 590035213
2023-12-11 19:59:11 -08:00
Kinar
42b251cb8d Updated tests in face_landmarker_result_converter_test 2023-12-11 16:11:39 -08:00
Jiuqiang Tang
bd946db5a6 No public description
PiperOrigin-RevId: 589890130
2023-12-11 11:43:51 -08:00
Prianka Liz Kariat
c1cab6e9dc Merge branch 'master' into ios-mpp-image-utils-pixel-buffer-format-fix 2023-12-11 19:41:15 +05:30
Prianka Liz Kariat
04f826e9d3 Fixed function names in MPPImage Utils 2023-12-11 19:40:13 +05:30
Kinar
0200d32285 Changed Recognition to Detection 2023-12-11 05:20:48 -08:00
Kinar
fec4dff0d6 Added Face Landmarker C Tasks API and tests 2023-12-11 04:58:15 -08:00
MediaPipe Team
61efcf5a11 internal-only change
PiperOrigin-RevId: 589284167
2023-12-08 17:23:55 -08:00
Dmitri Gribenko
4e78e645d0 No public description
PiperOrigin-RevId: 589279414
2023-12-08 17:01:53 -08:00
Copybara-Service
faae68e81d Merge pull request from kinaryml:c-hand-landmarker-api
PiperOrigin-RevId: 588900627
2023-12-07 13:58:10 -08:00
Sebastian Schmidt
20743b8110 Update MediaPipe development version to 0.10.9
PiperOrigin-RevId: 588890763
2023-12-07 13:27:41 -08:00
Jiuqiang Tang
0a77b8c57b No public description
PiperOrigin-RevId: 588827865
2023-12-07 10:04:46 -08:00
MediaPipe Team
66655a15b2 API 2: Do not redirect from MEDIAPIPE_REGISTER_NODE to REGISTER_CALCULATOR
The problem with redirecting is that the calling code has to include API 1 code (often third_party/mediapipe/framework/calculator_framework.h), even though they are only using API 2 functionality (albeit deprecated). This can lead to weird issues, e.g. MakePacket<T> confusingly does not return a Packet<T>, but a Packet, because it's using the API 1 version.

PiperOrigin-RevId: 588798455
2023-12-07 08:20:28 -08:00
Kinar
6909504ca9 Fix naming in different files 2023-12-07 00:25:54 -08:00
MediaPipe Team
fad3785721 Export java package for hand_roi_refinement_graph_options.
PiperOrigin-RevId: 588537174
2023-12-06 14:08:46 -08:00
MediaPipe Team
78af80027a No user facing changes
PiperOrigin-RevId: 588501289
2023-12-06 12:05:21 -08:00
Sebastian Schmidt
0a3f27d1ce Move hand_roi_refinement_graph_options_java_proto_lite to vision lib
PiperOrigin-RevId: 588444225
2023-12-06 09:04:08 -08:00
Prianka Liz Kariat
1e04ec3cc2 Enabled stream mode on iOS pose landmarker 2023-12-06 21:40:08 +05:30
MediaPipe Team
e4a6ea3079 No public description
PiperOrigin-RevId: 588376739
2023-12-06 04:31:59 -08:00
Kinar
b5c1c11f6a Added Hand Landmarker C Tasks API and tests 2023-12-06 02:59:39 -08:00
Sebastian Schmidt
0f90ba17dc Use Java Proto Lite Target for Hand ROI Refinement proto
PiperOrigin-RevId: 588170664
2023-12-05 13:26:23 -08:00
Sebastian Schmidt
dad2626f91 No public description
PiperOrigin-RevId: 587850211
2023-12-04 14:58:44 -08:00
MediaPipe Team
b91ec031a2 Adding version.bzl for tracking version
PiperOrigin-RevId: 587767961
2023-12-04 10:31:42 -08:00
Prianka Liz Kariat
28d62d55ac Added iOS Pose Landmarker to CocoaPods build 2023-12-04 21:35:53 +05:30
Kinar
ea95ae753d Uncommented configuring options for Holistic Landmarker 2023-12-04 04:12:22 -08:00
Kinar
66f8625a42 Added Holistic Landmarker Python API 2023-12-04 04:10:34 -08:00
Dmitri Gribenko
3d8b715dd6 No public description
PiperOrigin-RevId: 587559637
2023-12-03 17:53:22 -08:00
MediaPipe Team
507d677d44 Internal change
PiperOrigin-RevId: 587325154
2023-12-02 09:47:33 -08:00
Sebastian Schmidt
f35ecb6c8b Add dependency on hand_roi_refinement_graph_options_proto
PiperOrigin-RevId: 587082550
2023-12-01 12:21:07 -08:00
Youchuan Hu
a0eda45baf Add TensorsToSegmentationCalculator test utilities.
PiperOrigin-RevId: 586817713
2023-11-30 16:17:17 -08:00
Sebastian Schmidt
7013b23785 No public description
PiperOrigin-RevId: 586813896
2023-11-30 16:06:16 -08:00
Sebastian Schmidt
3433ba083a Move LanguageDetectorResult converter to LanguageDetector task
PiperOrigin-RevId: 586812754
2023-11-30 16:01:14 -08:00
Copybara-Service
80e4e1599a Merge pull request from priankakariatyml:ios-pose-landmarker-implementation
PiperOrigin-RevId: 586811420
2023-11-30 15:53:32 -08:00
Sebastian Schmidt
2b53891a7c Add lib targets for all C vision tasks
PiperOrigin-RevId: 586805240
2023-11-30 15:37:35 -08:00
Copybara-Service
7d73a3e1fd Merge pull request from kinaryml:c-landmarker-apis
PiperOrigin-RevId: 586804764
2023-11-30 15:32:12 -08:00
Sebastian Schmidt
e5c7ebec12 Add libtext and libvision build rules
PiperOrigin-RevId: 586804071
2023-11-30 15:27:19 -08:00
Copybara-Service
53cd40cdd0 Merge pull request from priankakariatyml:ios-interactive-segmenter-containers
PiperOrigin-RevId: 586779717
2023-11-30 14:05:42 -08:00
Kinar
9a5aa1b360 Refactor GestureRecognizerResult conversion for default initialization 2023-11-30 09:13:10 -08:00
Prianka Liz Kariat
90622475a2 Added iOS interactive segmenter header 2023-11-30 02:32:08 +05:30
Prianka Liz Kariat
f5ac0637a2 Updated iOS vision/core to add methods for processing region of interest 2023-11-30 02:31:48 +05:30
Prianka Liz Kariat
4c02980b3f Added iOS region of interest helpers 2023-11-30 02:31:11 +05:30
Prianka Liz Kariat
4137dbcbf5 Added iOS region of interest 2023-11-30 02:30:42 +05:30
Prianka Liz Kariat
3532503354 Added iOS interactive segmenter options 2023-11-30 02:05:23 +05:30
Copybara-Service
bb4906bcd3 Merge pull request from kinaryml:python-vision-benchmark-scripts
PiperOrigin-RevId: 586349225
2023-11-29 08:27:59 -08:00
Kinar
d19d5a50be Added FreeMemory test for GestureRecognizerResult 2023-11-29 03:17:35 -08:00
Kinar R
6ed5e3d0df
Merge branch 'master' into c-landmarker-apis 2023-11-29 16:41:12 +05:30
Kinar
3c655e2334 Revised Gesture Recognizer API implementation and associated tests 2023-11-29 03:08:09 -08:00
MediaPipe Team
91589b10d3 internal change.
PiperOrigin-RevId: 586156439
2023-11-28 18:07:30 -08:00
Sebastian Schmidt
62bafd39bb HolisticLandmarker Java API
PiperOrigin-RevId: 586113048
2023-11-28 15:00:54 -08:00
Sebastian Schmidt
a898215c52 Holistic Landmarker C++ Graph
PiperOrigin-RevId: 586105983
2023-11-28 14:36:19 -08:00
MediaPipe Team
95601ff98b Remove internal logs.
PiperOrigin-RevId: 585782033
2023-11-27 15:51:21 -08:00
Copybara-Service
6fa9848a15 Merge pull request from amacsmith:master
PiperOrigin-RevId: 585775506
2023-11-27 15:25:00 -08:00
Copybara-Service
090e74a0aa Merge pull request from kinaryml:c-object-detector-api
PiperOrigin-RevId: 585765946
2023-11-27 14:51:35 -08:00
MediaPipe Team
1ff7e95295 No public description
PiperOrigin-RevId: 585719403
2023-11-27 12:01:38 -08:00
Sebastian Schmidt
8d57a9e2e8 Add missing export declarations to DrawingUtils
Fixes https://github.com/google/mediapipe/issues/4980

PiperOrigin-RevId: 585705106
2023-11-27 11:16:23 -08:00
Kinar
17c0c960be Added Gesture Recognizer C API and tests 2023-11-27 04:51:32 -08:00
Alex Macdonald-Smith
5ca859f90b
Updated mediapipe/mediapipe/tasks/web /vision/README.md
There was a typo in the url referencing Gesture Recognizer

```
const gestureRecognizer = await GestureRecognizer.createFromModelPath(vision,
    "hhttps://storage.googleapis.com/mediapipe-models/gesture_recognizer/gesture_recognizer/float16/1/gesture_recognizer.task"
);
```

changed to 
```
const gestureRecognizer = await GestureRecognizer.createFromModelPath(vision,
    "https://storage.googleapis.com/mediapipe-models/gesture_recognizer/gesture_recognizer/float16/1/gesture_recognizer.task"
);
```

The extra 'h' was dropped.

Let me know if there are anymore updates needed for this.
2023-11-21 16:03:57 -05:00
Tony Allevato
e7edd97eff Internal change.
PiperOrigin-RevId: 584399894
2023-11-21 12:33:58 -08:00
MediaPipe Team
0d298d7a67 No public description
PiperOrigin-RevId: 584349220
2023-11-21 09:39:09 -08:00
Prianka Liz Kariat
447f9cc452 Fixed formatting of MPPPoseLandmarkerTests.mm 2023-11-20 22:37:43 +05:30
Prianka Liz Kariat
972e3d81c0 Added iOS Objective C Pose Landmarker Tests 2023-11-20 22:33:58 +05:30
Matt Kreileder
d8fd986517 No public description
PiperOrigin-RevId: 583973946
2023-11-20 03:32:39 -08:00
MediaPipe Team
5cd3037443 Adding a GpuTestWithParamBase test class to support value parameterized tests
PiperOrigin-RevId: 583967017
2023-11-20 03:02:22 -08:00
MediaPipe Team
bd4be30b02 No public description
PiperOrigin-RevId: 583936442
2023-11-20 00:59:42 -08:00
MediaPipe Team
42d42a5ea1 Ensure that releaseGl() is called if prepapreGl throws
Without this logic, we might have resources created within prepareGl() leaking, since they will never be released.

PiperOrigin-RevId: 583491569
2023-11-17 14:52:34 -08:00
Sebastian Schmidt
d29ea119ff Add the result class for the HolisticLandmarker Java API
PiperOrigin-RevId: 583426528
2023-11-17 10:29:42 -08:00
Sebastian Schmidt
9456c64830 No public description
PiperOrigin-RevId: 583417701
2023-11-17 10:02:53 -08:00
Kinar
6bdc7ce016 Removed unused param 2023-11-16 16:39:21 -08:00
Kinar
46c6c9403c Code cleanup and revised benchmarking API 2023-11-16 16:26:29 -08:00
MediaPipe Team
e7c7638833 No public description
PiperOrigin-RevId: 583186277
2023-11-16 15:38:42 -08:00
Kinar
8f32fda6d8 Added more benchmark scripts for the Tasks Python API 2023-11-16 12:53:36 -08:00
Kinar
b879e3a204 Updated components and their tests in the C Tasks API 2023-11-16 10:05:34 -08:00
Copybara-Service
7287056674 Merge pull request from kinaryml:python-image-classifier-bench
PiperOrigin-RevId: 583072872
2023-11-16 09:38:05 -08:00
MediaPipe Team
f13c6974ee Extract CPU conversion methods into a separate library & add test
PiperOrigin-RevId: 582966041
2023-11-16 02:34:22 -08:00
Sebastian Schmidt
12340a8e82 Use gl.LINEAR interpolation for confidence masks
PiperOrigin-RevId: 582777383
2023-11-15 13:02:14 -08:00
Sebastian Schmidt
47e217896c Add drawConfidenceMask() to our public API
PiperOrigin-RevId: 582647409
2023-11-15 06:12:12 -08:00
MediaPipe Team
e440a4da56 Explicitly delete some copy operations to improve compile errors.
PiperOrigin-RevId: 582595026
2023-11-15 02:23:05 -08:00
Kinar
252cca72e7 Allowed a default value for the model argument 2023-11-13 21:44:27 -08:00
Kinar
f8add5ad42 Documented the return value and added percentile to argparser 2023-11-13 21:17:28 -08:00
Sebastian Schmidt
a38467bae0 Internal
PiperOrigin-RevId: 582098762
2023-11-13 15:15:53 -08:00
Youchuan Hu
71e9929f60 Refactor OpenCV path out of TensorsToSegmentationCalculator main file.
ProcessCpu() is changed into an OpenCV converter that is owned by the calculator. The calculator should call converter.Convert() to get the conversion result.

PiperOrigin-RevId: 582010350
2023-11-13 10:33:07 -08:00
Kinar
1c860cace6 Added files for the Object Detector C Tasks API 2023-11-13 09:53:37 -08:00
Sebastian Schmidt
d504d3bf22 Create shared utilities to construct landmark lists
PiperOrigin-RevId: 581970043
2023-11-13 08:24:19 -08:00
Kinar
38737849e6 Updated copyright 2023-11-11 03:34:57 -08:00
Kinar
99c8b9ee3c Updated copyright 2023-11-11 03:34:26 -08:00
Kinar
021c7edde7 Updated README and script 2023-11-11 03:32:45 -08:00
Kinar
35f2f36733 Added image classifier benchmark 2023-11-11 03:25:36 -08:00
MediaPipe Team
939a9c2a37 No public description
PiperOrigin-RevId: 581469194
2023-11-10 23:59:21 -08:00
MediaPipe Team
ad4da8c9cc No public description
PiperOrigin-RevId: 581468467
2023-11-10 23:53:57 -08:00
MediaPipe Team
418680936d No public description
PiperOrigin-RevId: 581450685
2023-11-10 21:55:41 -08:00
MediaPipe Team
4ad67abd70 ...internal change...
PiperOrigin-RevId: 581375224
2023-11-10 14:46:01 -08:00
MediaPipe Team
5dec91226d No public description
PiperOrigin-RevId: 581322099
2023-11-10 11:39:24 -08:00
MediaPipe Team
64b21d758e Remove batch dimension from the output of tflite_with_tokenizer in text classifier.
PiperOrigin-RevId: 581292824
2023-11-10 10:05:40 -08:00
MediaPipe Team
d772bf8134 Add BinaryAUC metric and Best Checkpoint callback to Text Classifier
PiperOrigin-RevId: 581276382
2023-11-10 09:04:26 -08:00
MediaPipe Team
fd4859c178 Refactor OpenCV path out of TensorsToSegmentationCalculator main file.
ProcessCpu() is changed into an OpenCV converter that is owned by the calculator. The calculator should call converter.Convert() to get the conversion result.

PiperOrigin-RevId: 581103226
2023-11-09 20:06:47 -08:00
Youchuan Hu
1038f8176d Refactor OpenCV path out of TensorsToSegmentationCalculator main file.
ProcessCpu() is changed into an OpenCV converter that is owned by the calculator. The calculator should call converter.Convert() to get the conversion result.

PiperOrigin-RevId: 581073731
2023-11-09 17:28:24 -08:00
MediaPipe Team
333125ac20 Add some convenience getters to EglManager.
PiperOrigin-RevId: 581049412
2023-11-09 15:58:06 -08:00
Sebastian Schmidt
edca85c5d3 Create shared utilities to construct category lists
PiperOrigin-RevId: 581009898
2023-11-09 13:38:21 -08:00
MediaPipe Team
6532ce5c59 Refactor OpenCV path out of TensorsToSegmentationCalculator main file.
ProcessCpu() is changed into an OpenCV converter that is owned by the calculator. The calculator should call converter.Convert() to get the conversion result.

PiperOrigin-RevId: 580937591
2023-11-09 09:45:10 -08:00
MediaPipe Team
a9a169372a Fixes multiple typos in the calculator's internal files.
PiperOrigin-RevId: 580907788
2023-11-09 08:02:54 -08:00
MediaPipe Team
7c5c216652 Exposes a handle to AHardwareBuffers through a new GpuBuffer view
PiperOrigin-RevId: 580754933
2023-11-08 20:06:35 -08:00
MediaPipe Team
252c7eef25 Add option to omit the checkpoint callback in text classifier.
PiperOrigin-RevId: 580658724
2023-11-08 14:30:00 -08:00
Youchuan Hu
ae606c1550 Refactor OpenCV path out of TensorsToSegmentationCalculator main file.
ProcessCpu() is changed into an OpenCV converter that is owned by the calculator. The calculator should call converter.Convert() to get the conversion result.

PiperOrigin-RevId: 580625461
2023-11-08 12:53:52 -08:00
Copybara-Service
d4d30768be Merge pull request from kinaryml:c-image-embedder-api
PiperOrigin-RevId: 580618718
2023-11-08 12:35:05 -08:00
MediaPipe Team
000314a545 No public description
PiperOrigin-RevId: 580614241
2023-11-08 12:17:12 -08:00
Copybara-Service
65e74dde0f Merge pull request from priankakariatyml:ios-pose-landmarker-implementation
PiperOrigin-RevId: 580578919
2023-11-08 10:39:24 -08:00
Copybara-Service
8d4407b04e Merge pull request from priankakariatyml:ios-language-detector-tests
PiperOrigin-RevId: 580577290
2023-11-08 10:34:06 -08:00
MediaPipe Team
81a07e2e32 No public description
PiperOrigin-RevId: 580504831
2023-11-08 05:53:54 -08:00
MediaPipe Team
6ea6f28250 Creates GpuBuffers around pre-allocated AHardware_Buffer objects.
PiperOrigin-RevId: 580358465
2023-11-07 18:01:37 -08:00
Kinar
c442d6117e Resolved issues and added a common header to hold all the necessary structures for the vision tasks 2023-11-07 14:23:15 -08:00
MediaPipe Team
c375761480 No public description
PiperOrigin-RevId: 580292393
2023-11-07 14:02:30 -08:00
Sebastian Schmidt
8d370f4f5b Remove const from input types of C API
PiperOrigin-RevId: 580217902
2023-11-07 10:08:51 -08:00
Kinar
197358dfee Drop default arguments in Image Embedder C API 2023-11-07 07:34:08 -08:00
Kinar
60fcfa74cc Fixed some typos in the error message 2023-11-07 07:26:57 -08:00
Kinar
b0725b46fb Fixed merge conflicts 2023-11-07 07:12:58 -08:00
Kinar R
42a916ad4f
Merge branch 'master' into c-image-embedder-api 2023-11-07 20:37:09 +05:30
Kinar
d9080c0d38 Updated the Image Embedder C API and added tests for cosine similarity 2023-11-07 07:02:08 -08:00
Prianka Liz Kariat
9d9a5dc5e7 Added iOS language detector tests 2023-11-07 11:15:01 +05:30
Prianka Liz Kariat
b5b0d6eee7 Fixed graph name in iOS language detector 2023-11-07 11:13:25 +05:30
Prianka Liz Kariat
32571a37d2 Added pose landmarker protobuf utils 2023-11-07 09:49:53 +05:30
Prianka Liz Kariat
91095c2d6a Added null check for segmentation masks in pose landmarker helper initializer 2023-11-07 09:49:42 +05:30
Prianka Liz Kariat
1d0f3734b4 Added iOS MPPPoseLandmarker.mm 2023-11-07 09:46:39 +05:30
Sebastian Schmidt
2abaabce0e Drop default arguments in C API
PiperOrigin-RevId: 579965820
2023-11-06 14:55:41 -08:00
MediaPipe Team
a8d88bf7cf Creates GpuBuffers around pre-allocated AHardware_Buffer objects.
PiperOrigin-RevId: 579961642
2023-11-06 14:42:13 -08:00
Sebastian Schmidt
077b52250d Pass Model Asset Buffer as byte array + length
PiperOrigin-RevId: 579944283
2023-11-06 13:42:40 -08:00
Kinar R
3b122a1e61
Merge branch 'google:master' into c-image-embedder-api 2023-11-07 02:00:23 +05:30
MediaPipe Team
5f0d24d741 Fixes typo in GlCalculatorHelper::UpdateContract argument name
PiperOrigin-RevId: 579832146
2023-11-06 07:08:33 -08:00
MediaPipe Team
0b53c9752f Fixes multiple typos in the calculator's internal files.
PiperOrigin-RevId: 579718764
2023-11-05 20:49:16 -08:00
MediaPipe Team
e22b7d5dd4 Example updated for mp.Image in documentation
PiperOrigin-RevId: 579277510
2023-11-03 12:58:47 -07:00
Sebastian Schmidt
1c46e43088 Update WASM files for 0.10.8 relese
PiperOrigin-RevId: 579032432
2023-11-02 18:00:54 -07:00
Sebastian Schmidt
8f564c4b7b Allow OffscreenCanvas to be used by DrawingUtils
PiperOrigin-RevId: 579021013
2023-11-02 17:03:07 -07:00
Copybara-Service
1cc79001f4 Merge pull request from priankakariatyml:ios-image-segmenter-cocoapods-build
PiperOrigin-RevId: 578993411
2023-11-02 15:24:59 -07:00
Copybara-Service
1b8a0ee6af Merge pull request from priankakariatyml:ios-pose-landmarker-impl
PiperOrigin-RevId: 578991151
2023-11-02 15:23:04 -07:00
Copybara-Service
35b9453da4 Merge pull request from google:mrschmidt/gpu
PiperOrigin-RevId: 578991016
2023-11-02 15:18:10 -07:00
Copybara-Service
b4ce39cbf7 Merge pull request from priankakariatyml:ios-image-utils-fix
PiperOrigin-RevId: 578990990
2023-11-02 15:15:58 -07:00
Copybara-Service
35010894c1 Merge pull request from priankakariatyml:ios-language-detector
PiperOrigin-RevId: 578990815
2023-11-02 15:10:37 -07:00
MediaPipe Team
9018ca699b Creates GpuBuffers around pre-allocated AHardware_Buffer objects.
PiperOrigin-RevId: 578850184
2023-11-02 07:46:51 -07:00
MediaPipe Team
f8197651e8 Add AT_FIRST_TICK processing to SidePacketToStreamCalculator.
PiperOrigin-RevId: 578824863
2023-11-02 05:58:35 -07:00
Sebastian Schmidt
e81fc5d0aa Access document via self.document
PiperOrigin-RevId: 578635298
2023-11-01 14:08:09 -07:00
Sebastian Schmidt
9474394768 Add drawCategoryMask() to our public API
PiperOrigin-RevId: 578526413
2023-11-01 08:33:18 -07:00
MediaPipe Team
3a55f1156a No public description
PiperOrigin-RevId: 578496866
2023-11-01 06:21:05 -07:00
MediaPipe Team
c6aa9cbaef No public description
PiperOrigin-RevId: 578303180
2023-10-31 14:29:38 -07:00
MediaPipe Team
35f2f98a1c No public description
PiperOrigin-RevId: 578266141
2023-10-31 12:30:04 -07:00
MediaPipe Team
b9ff9708e3 Upgrade to use Gradle 8.4
PiperOrigin-RevId: 578259506
2023-10-31 12:07:37 -07:00
MediaPipe Team
a4048eee11 Add video and live stream processing and tests for Image Classifier C API
PiperOrigin-RevId: 578242391
2023-10-31 11:14:28 -07:00
MediaPipe Team
7da2810b83 Move filtering logic of score to ConvertToDetection.
PiperOrigin-RevId: 578189518
2023-10-31 08:20:03 -07:00
Sebastian Schmidt
95692c64a9 Add GPU support 2023-10-30 16:05:12 -06:00
Sebastian Schmidt
ec032fb018 Use SRGBA for Mac on Python for image test
PiperOrigin-RevId: 577931014
2023-10-30 13:07:10 -07:00
Sebastian Schmidt
7256bd2638 No public description
PiperOrigin-RevId: 577873616
2023-10-30 09:46:16 -07:00
MediaPipe Team
2f4d7b4079 No public description
PiperOrigin-RevId: 577410310
2023-10-28 01:10:02 -07:00
MediaPipe Team
a96581e3b7 TensorsToDetectionsCalculator supports multi clasees for a bbox.
PiperOrigin-RevId: 577300797
2023-10-27 14:13:02 -07:00
Sebastian Schmidt
d73ef24406 Support 3-channel RGB images for Mac Python
PiperOrigin-RevId: 577240413
2023-10-27 10:34:08 -07:00
MediaPipe Team
eaf0807849 Fixes multiple typos in the calculator's internal files.
PiperOrigin-RevId: 577202836
2023-10-27 08:08:52 -07:00
MediaPipe Team
46cca0d486 Rolling back.
PiperOrigin-RevId: 577128565
2023-10-27 02:25:42 -07:00
Sebastian Schmidt
2cb0100fe6 Use mp.ImageFormat instead of just ImageFormat
Fixes https://github.com/google/mediapipe/issues/4911

PiperOrigin-RevId: 577003083
2023-10-26 15:32:28 -07:00
MediaPipe Team
5459705038 Adding two new immutable texture GpuBufferFormat types
PiperOrigin-RevId: 577002534
2023-10-26 15:27:43 -07:00
Youchuan Hu
e7121e4feb Use designated initializers for TensorsToSegmentationCalculator tests.
PiperOrigin-RevId: 576671943
2023-10-25 16:02:28 -07:00
Sebastian Schmidt
a277d853ea Don't drop status message in ConvertFromImageFrame
PiperOrigin-RevId: 576667666
2023-10-25 15:46:41 -07:00
MediaPipe Team
3017c02d3d No public description
PiperOrigin-RevId: 576663264
2023-10-25 15:30:54 -07:00
Copybara-Service
06dab1e526 Merge pull request from markmcd:ios-docgen
PiperOrigin-RevId: 576628799
2023-10-25 14:00:39 -07:00
MediaPipe Team
496a6ed809 No public description
PiperOrigin-RevId: 576314429
2023-10-24 16:08:19 -07:00
Sebastian Schmidt
5f2b9fd765 Speed up Python build by only building binary graph
PiperOrigin-RevId: 576260883
2023-10-24 13:41:17 -07:00
Sebastian Schmidt
c698414c71 Use cc_library for DrishtiMetalHelper
PiperOrigin-RevId: 576230898
2023-10-24 12:40:15 -07:00
Youchuan Hu
905a18c88c Add CPU tests for TensorsToSegmentationCalculator
PiperOrigin-RevId: 576208735
2023-10-24 11:35:58 -07:00
Sebastian Schmidt
5b0f1f9ac4 No public description
PiperOrigin-RevId: 576166645
2023-10-24 09:34:24 -07:00
MediaPipe Team
543b595971 Fix internal incensistency in parsing code
PiperOrigin-RevId: 576094494
2023-10-24 04:27:18 -07:00
Sebastian Schmidt
05564cbe9a No public description
PiperOrigin-RevId: 575930740
2023-10-23 14:36:03 -07:00
Sebastian Schmidt
aedafd63f9 Remove objc_library from Python build path for Mac GPU build
Addresses https://github.com/bazelbuild/bazel/issues/19912

PiperOrigin-RevId: 575896231
2023-10-23 12:36:14 -07:00
Copybara-Service
a39df33664 Merge pull request from kinaryml:face-stylizer-adding-unit-tests-to-api
PiperOrigin-RevId: 575895855
2023-10-23 12:31:33 -07:00
Sebastian Schmidt
b904ade0cf Allow Mac to use GPU Delegate
PiperOrigin-RevId: 575882254
2023-10-23 11:44:02 -07:00
Sebastian Schmidt
6aa27d9aeb Initialize GPU support for Python Task API
PiperOrigin-RevId: 575842513
2023-10-23 09:39:16 -07:00
Prianka Liz Kariat
d5a1bc03af Fixed deletion of iOS output MPImage buffer in MPImage Utils 2023-10-23 20:28:43 +05:30
Prianka Liz Kariat
7c45bc802f Added iOS Image Segmenter to CocoaPods build 2023-10-23 20:02:57 +05:30
Prianka Liz Kariat
305f076c7f Fixed extra condition check in iOS Image Segmenter Result Helper 2023-10-23 20:02:39 +05:30
Kinar
4b3cb5b758 Added files for the Image Embedder C API and tests 2023-10-23 00:30:51 -07:00
MediaPipe Team
0dee33ccba No public description
PiperOrigin-RevId: 575477678
2023-10-21 10:26:09 -07:00
Prianka Liz Kariat
3a43aff13c Added iOS language detector implementation 2023-10-21 10:42:48 +05:30
Prianka Liz Kariat
f185bc6635 Added language detector result helpers 2023-10-21 10:42:32 +05:30
Prianka Liz Kariat
c48a5668b8 Updated documentation 2023-10-21 03:57:55 +05:30
Prianka Liz Kariat
96ed3a7422 Added iOS pose landmarker header 2023-10-21 03:55:00 +05:30
Prianka Liz Kariat
3622ff9bff Added iOS pose landmarks connections 2023-10-21 03:53:54 +05:30
Prianka Liz Kariat
c4315c500d Added pose landmarker result helpers 2023-10-21 03:52:46 +05:30
MediaPipe Team
8fc3a0473f Add scaling support to surface view renderer.
PiperOrigin-RevId: 575134648
2023-10-20 01:08:17 -07:00
Sebastian Schmidt
305d7abec4 Add a field to GPUBuffer C struct so FFIGen can handle it
PiperOrigin-RevId: 575020084
2023-10-19 15:29:44 -07:00
Copybara-Service
1601073cf0 Merge pull request from priankakariatyml:ios-image-segmenter-populate-labels
PiperOrigin-RevId: 574977633
2023-10-19 13:07:53 -07:00
Copybara-Service
1c7ea02b0e Merge pull request from priankakariatyml:ios-image-segmenter-documentation-updates
PiperOrigin-RevId: 574966608
2023-10-19 12:32:23 -07:00
Sebastian Schmidt
5779f5e9da Allow GPU Origin Proto to be build by Maven
PiperOrigin-RevId: 574966597
2023-10-19 12:30:38 -07:00
Copybara-Service
02e0ce3f87 Merge pull request from priankakariatyml:ios-language-detector-containers
PiperOrigin-RevId: 574954531
2023-10-19 11:58:54 -07:00
Copybara-Service
ddf46a2a61 Merge pull request from priankakariatyml:ios-pose-landmarker-containers
PiperOrigin-RevId: 574954344
2023-10-19 11:54:25 -07:00
Sebastian Schmidt
2d0d258403 Delete arm64 only file in Mac wheel
Fixes https://github.com/google/mediapipe/issues/4888#issuecomment-1768861583

PiperOrigin-RevId: 574938905
2023-10-19 11:16:28 -07:00
Sebastian Schmidt
66570c3dfc No public description
PiperOrigin-RevId: 574938418
2023-10-19 11:11:52 -07:00
Fergus Henderson
f9fa7cfbeb No public description
PiperOrigin-RevId: 574913082
2023-10-19 10:10:26 -07:00
Prianka Liz Kariat
06d893a9f9 Revert "Updated deletion in FreeDataProviderReleaseCallback"
This reverts commit 69b7a21368.
2023-10-19 20:45:32 +05:30
Prianka Liz Kariat
69b7a21368 Updated deletion in FreeDataProviderReleaseCallback 2023-10-19 20:42:06 +05:30
Prianka Liz Kariat
af9a7e7e40 Added documentation 2023-10-19 20:27:51 +05:30
Prianka Liz Kariat
b9c869494d Fixed formatting of MPPImage+Utils.mm 2023-10-19 19:59:59 +05:30
Prianka Liz Kariat
4668d683d5 Updated implementation of MPPImage Utils to reduce lines of code 2023-10-19 19:59:09 +05:30
Prianka Liz Kariat
ad68122069 Added support for creating CVPixelBuffer from C++ Images to iOS MPPImage Utils 2023-10-19 19:58:40 +05:30
Prianka Liz Kariat
032d7a5d22 Removed support for CVPixelBuffer of type 32RGBA 2023-10-19 19:56:44 +05:30
Prianka Liz Kariat
0fe677b78f Updated supported pixel formats in iOS image classifier Documentation 2023-10-19 19:24:40 +05:30
MediaPipe Team
7dca7ad24e Internal change.
PiperOrigin-RevId: 574777627
2023-10-19 01:50:24 -07:00
MediaPipe Team
259fa86c62 Add implementation and tests for Image Classifier C API
PiperOrigin-RevId: 574679661
2023-10-18 18:57:19 -07:00
Sebastian Schmidt
364048daca Allow Python to be build on Mac with GPU support
PiperOrigin-RevId: 574625520
2023-10-18 15:45:17 -07:00
Sebastian Schmidt
4f29ffcc3e Add GPU Origin proto to Java Tasks Library
PiperOrigin-RevId: 574535005
2023-10-18 11:18:46 -07:00
MediaPipe Team
06cc6d1546 No public description
PiperOrigin-RevId: 574528013
2023-10-18 10:58:53 -07:00
MediaPipe Team
2bd6726c89 Plumb an optional default Executor and set of input side packets
through TaskApiFactory::Create so that consumers of that API
can provide these inputs to their underlying graph.

PiperOrigin-RevId: 574503266
2023-10-18 09:51:43 -07:00
MediaPipe Team
e27bbf15dc No public description
PiperOrigin-RevId: 574497996
2023-10-18 09:46:36 -07:00
MediaPipe Team
d006304f6a Migrate ParseTagAndName to use absl::string_view
PiperOrigin-RevId: 574492000
2023-10-18 09:44:39 -07:00
Youchuan Hu
de1b1b6b97 Initial test for TensorsToSegmentationCalculator
This test is a pass-through with no modification of the input tensor. CPU test.

PiperOrigin-RevId: 574210865
2023-10-17 11:22:03 -07:00
MediaPipe Team
dd215e00f5 No public description
PiperOrigin-RevId: 574045894
2023-10-17 00:11:39 -07:00
MediaPipe Team
2e11444f5c Introduce FixGraphBackEdges utils function.
PiperOrigin-RevId: 573925628
2023-10-16 14:13:18 -07:00
MediaPipe Team
a1e1b5d34c Internal change.
PiperOrigin-RevId: 573318330
2023-10-13 14:25:27 -07:00
MediaPipe Team
8993073f35 Internal change
PiperOrigin-RevId: 573254750
2023-10-13 10:25:00 -07:00
MediaPipe Team
1bd800697e GPU_ORIGIN configurable through base options proto.
PiperOrigin-RevId: 573251085
2023-10-13 10:10:52 -07:00
MediaPipe Team
8823046e4b Add check to avoid doing illegal memory access from an invalid iterator from std::prev()
PiperOrigin-RevId: 573248334
2023-10-13 10:02:09 -07:00
MediaPipe Team
652792ebaa Internal change
PiperOrigin-RevId: 573228351
2023-10-13 08:31:17 -07:00
MediaPipe Team
61dc7281e2 No public description
PiperOrigin-RevId: 573107636
2023-10-12 22:39:54 -07:00
MediaPipe Team
2a286cc790 Introduce AlignHandToPoseInWorldCalculator
PiperOrigin-RevId: 572959145
2023-10-12 11:14:03 -07:00
MediaPipe Team
ac2d5cedbd No public description
PiperOrigin-RevId: 572742286
2023-10-11 18:12:09 -07:00
Sebastian Schmidt
a97eaad10f No public description
PiperOrigin-RevId: 572722787
2023-10-11 16:41:08 -07:00
MediaPipe Team
dd29666296 Adding vector versions of input calls to TS GraphRunner API
PiperOrigin-RevId: 572711430
2023-10-11 15:55:08 -07:00
Sebastian Schmidt
4b8fd3b2d0 No public description
PiperOrigin-RevId: 572628807
2023-10-11 11:14:07 -07:00
Copybara-Service
84f6959f9d Merge pull request from kinaryml:c-language-detector-api
PiperOrigin-RevId: 572385111
2023-10-10 15:37:06 -07:00
MediaPipe Team
d6d92354ea Detection postprocessing support quantized tensor.
PiperOrigin-RevId: 572310272
2023-10-10 11:13:54 -07:00
Sebastian Schmidt
df13788883 No public description
PiperOrigin-RevId: 572309070
2023-10-10 11:08:47 -07:00
Sebastian Schmidt
0d5f35d351 No public description
PiperOrigin-RevId: 572292160
2023-10-10 10:23:35 -07:00
Sebastian Schmidt
dc63a5401c No public description
PiperOrigin-RevId: 572266397
2023-10-10 09:02:48 -07:00
Kinar R
91c5f84f9c Removed language_detection_result and moved the necessary containers to language_detector.h 2023-10-10 13:23:25 +05:30
MediaPipe Team
ef6e712a88 Internal change
PiperOrigin-RevId: 572125477
2023-10-09 21:28:52 -07:00
MediaPipe Team
f72542ae5d Internal change
PiperOrigin-RevId: 572122579
2023-10-09 21:11:24 -07:00
MediaPipe Team
ac954215cf Internal change
PiperOrigin-RevId: 572121726
2023-10-09 21:06:32 -07:00
MediaPipe Team
3adc068e97 Add OnCameraBoundListener and support for landscape orientation to CameraXPreviewHelper
PiperOrigin-RevId: 572054649
2023-10-09 15:21:46 -07:00
MediaPipe Team
3dd6480705 No public description
PiperOrigin-RevId: 572032324
2023-10-09 13:59:35 -07:00
Prianka Liz Kariat
3a97762569 Fixed typo in iOS image segmenter Swift delegate name 2023-10-09 17:48:57 +05:30
Prianka Liz Kariat
6c4b4469ae Updated iOS Image Segmenter documentation to use Swift names 2023-10-09 17:48:39 +05:30
Prianka Liz Kariat
fce7b19ad7 Added a test for getting labels from iOS image segmenter 2023-10-09 17:47:03 +05:30
Prianka Liz Kariat
dd823d16f8 Added property to get labels from iOS Image Segmenter 2023-10-09 17:46:34 +05:30
Sebastian Schmidt
69fe645c43 Update WASM files for 0.10.7 release
PiperOrigin-RevId: 571440444
2023-10-06 14:51:20 -07:00
Chris McClanahan
b503d71be4 No public description
PiperOrigin-RevId: 571412955
2023-10-06 13:00:09 -07:00
Kinar
882ec323f0 Added files for the Language Detector C API and tests 2023-10-06 11:39:23 -07:00
Copybara-Service
830ee092b9 Merge pull request from priankakariatyml:ios-image-segmenter-basic-tests
PiperOrigin-RevId: 571386542
2023-10-06 11:18:47 -07:00
Sebastian Schmidt
90e6a97b22 Fix WasmFileset compilation issue in 3P build
PiperOrigin-RevId: 571345702
2023-10-06 08:36:53 -07:00
Matt Kreileder
7389119a2e No public description
PiperOrigin-RevId: 571296889
2023-10-06 04:15:09 -07:00
MediaPipe Team
44a4dad58e Internal change
PiperOrigin-RevId: 571232374
2023-10-05 22:49:06 -07:00
MediaPipe Team
b3f9587bc2 Add stream API merge utils.
PiperOrigin-RevId: 571124981
2023-10-05 14:09:12 -07:00
Sebastian Schmidt
a1e542fc16 No public description
PiperOrigin-RevId: 571109389
2023-10-05 13:15:31 -07:00
Copybara-Service
24da737272 Merge pull request from priankakariatyml:ios-image-utils-updates
PiperOrigin-RevId: 571087863
2023-10-05 11:53:31 -07:00
Copybara-Service
d686b42b85 Merge pull request from kinaryml:c-text-embedder-api
PiperOrigin-RevId: 571065228
2023-10-05 10:43:30 -07:00
Kinar
ebfd7284c9 Fixed some issues with documentation 2023-10-05 04:25:18 -07:00
Kinar
92e13d43e4 Resolved some issues 2023-10-05 03:54:54 -07:00
MediaPipe Team
edc4db287c No public description
PiperOrigin-RevId: 570904787
2023-10-04 22:18:50 -07:00
MediaPipe Team
7ab3d70aa4 Add stream API presence utils.
PiperOrigin-RevId: 570901832
2023-10-04 21:59:05 -07:00
Nevena Kotlaja
2dd20822be No public description
PiperOrigin-RevId: 570789405
2023-10-04 13:33:51 -07:00
Sebastian Schmidt
1d8bd9c3ee No public description
PiperOrigin-RevId: 570765754
2023-10-04 12:14:31 -07:00
Daniel Cheng
d2baba6dbb Internal change
PiperOrigin-RevId: 570745425
2023-10-04 11:09:36 -07:00
MediaPipe Team
3b99f8d9dd Introduce SetJointsVisibilityCalculator
PiperOrigin-RevId: 570745171
2023-10-04 11:04:40 -07:00
MediaPipe Team
c81624d7b2 Introduce CombineJointsCalculator
PiperOrigin-RevId: 570739088
2023-10-04 10:45:11 -07:00
Daniel Cheng
7f1c17065a Prefix status macro implementation with MP_.
This makes it less likely for the implementation to conflict with other
ASSIGN_OR_RETURN() and RETURN_IF_ERROR() implementations.

PiperOrigin-RevId: 570726994
2023-10-04 10:04:59 -07:00
MediaPipe Team
9bb042cc86 GlSurfaceViewRenderer: Capture graph output texture
Captures the original graph output texture, not what has been copied to the screen. This will be important for zooming to prevent top/bottom letterboxes, and it preserves the original quality, so that high resolution images can be used.

PiperOrigin-RevId: 570604422
2023-10-04 00:07:13 -07:00
Prianka Liz Kariat
da7013c746 Updated error messages in MPPImage Utils 2023-10-03 23:59:46 +05:30
Prianka Liz Kariat
cebfa1cdac Fixed error messages 2023-10-03 23:52:58 +05:30
MediaPipe Team
da8fcb6bb2 Smooth pose landmarks
PiperOrigin-RevId: 570441366
2023-10-03 11:12:46 -07:00
Sebastian Schmidt
a72839ef99 See memory of freed result to nullptr
PiperOrigin-RevId: 570410751
2023-10-03 09:33:48 -07:00
MediaPipe Team
d0183b2c70 Fixes typos in the file mediapipe/python/pybind/image.cc and mediapipe/python/pybind
/image_frame.cc.

PiperOrigin-RevId: 570388388
2023-10-03 08:01:25 -07:00
Prianka Liz Kariat
0ee9b7f86e Added iOS language detector options helpers 2023-10-03 19:21:05 +05:30
Prianka Liz Kariat
38de7493df Added iOS language detector results 2023-10-03 19:20:45 +05:30
Prianka Liz Kariat
3c13e4b6d6 Added iOS language detector options 2023-10-03 19:20:33 +05:30
Prianka Liz Kariat
3067c20955 Added iOS pose landmarker result helpers 2023-10-03 19:18:29 +05:30
Prianka Liz Kariat
c560032a91 Added iOS pose landmarker options 2023-10-03 19:18:06 +05:30
Prianka Liz Kariat
8d5cf33ca4 Added iOS Pose Landmarker Result 2023-10-03 19:17:49 +05:30
Kinar
753ba916a1 Fixed some typos 2023-10-03 01:51:18 -07:00
Kinar
3564fc0d9b Added files for the TextEmbedder C API and tests 2023-10-03 01:48:07 -07:00
MediaPipe Team
5366aa9d0a Internal update
PiperOrigin-RevId: 570204415
2023-10-02 15:55:31 -07:00
Sebastian Schmidt
a00759007d Add error handling to C API
PiperOrigin-RevId: 570094642
2023-10-02 09:49:09 -07:00
Sebastian Schmidt
c7402efe5e Add End to End test for Text Classifier C API
PiperOrigin-RevId: 569658768
2023-09-29 20:53:54 -07:00
Sebastian Schmidt
96fa10b906 Add unit tests for C layer for the input types of Text Classifier
PiperOrigin-RevId: 569553038
2023-09-29 12:08:00 -07:00
Sebastian Schmidt
6915a79e28 Add tests for C API containers
PiperOrigin-RevId: 569526282
2023-09-29 10:27:15 -07:00
Sebastian Schmidt
d4561fb5c2 Do not use full filename when FileLocator decides which asset to load
Fixes https://github.com/google/mediapipe/issues/4819

PiperOrigin-RevId: 569506907
2023-09-29 09:11:01 -07:00
MediaPipe Team
09a51bcdeb Internal change
PiperOrigin-RevId: 569310433
2023-09-28 15:44:37 -07:00
Sebastian Schmidt
5ca1be6f21 Populate the classification result output param instead of a copy
PiperOrigin-RevId: 569293617
2023-09-28 14:38:02 -07:00
MediaPipe Team
f78f24f576 segmentation smoothing stream utility function.
PiperOrigin-RevId: 569283980
2023-09-28 14:03:24 -07:00
Sebastian Schmidt
636cf99a3e Fix memory access issue in C layer
PiperOrigin-RevId: 569279959
2023-09-28 13:50:28 -07:00
MediaPipe Team
e169849041 No public description
PiperOrigin-RevId: 569274219
2023-09-28 13:31:00 -07:00
Sebastian Schmidt
33d6143a1a Don't convert nullptr to std::string in C layer
PiperOrigin-RevId: 569232756
2023-09-28 11:04:44 -07:00
Prianka Liz Kariat
120f82508c Chnaged de allocation method in data provider release callback 2023-09-28 21:43:18 +05:30
Prianka Liz Kariat
8ea805b6f0 Added methods to create iOS MPImage with source type UIImage from a C++ image. 2023-09-28 21:37:03 +05:30
MediaPipe Team
a577dc3043 smoothing stream utility function.
PiperOrigin-RevId: 569074973
2023-09-27 23:19:37 -07:00
MediaPipe Team
9edb4cd753 Introduce LandmarksTransformationCalculator
PiperOrigin-RevId: 569050686
2023-09-27 21:12:19 -07:00
MediaPipe Team
66a279418c tensor_to_joints stream utility function.
PiperOrigin-RevId: 569043195
2023-09-27 20:34:20 -07:00
MediaPipe Team
0ae9ff6b98 Introduce TensorToJointsCalculator
PiperOrigin-RevId: 569040914
2023-09-27 20:27:24 -07:00
MediaPipe Team
da02052c70 landmarks_to_tensor stream utility function.
PiperOrigin-RevId: 569003241
2023-09-27 17:13:46 -07:00
MediaPipe Team
8837b49026 get_vector_item stream utility function.
PiperOrigin-RevId: 568998504
2023-09-27 16:55:43 -07:00
MediaPipe Team
2ecccaf076 concatenate stream utility function.
PiperOrigin-RevId: 568997695
2023-09-27 16:50:48 -07:00
MediaPipe Team
983fda5d4e No public description
PiperOrigin-RevId: 568953918
2023-09-27 14:04:33 -07:00
MediaPipe Team
8f8c66430f Update PackMediaSequenceCalculator to support index feature inputs on the CLIP_MEDIA_ input tag.
For Detection protos representing index features, the `label` field might be empty.

With this change, only the `Detection::score` field is required, and `Detection.label` and `Detection.label_id` are both optional but at least one of them should be set.

PiperOrigin-RevId: 568944596
2023-09-27 13:33:55 -07:00
MediaPipe Team
698b154ff4 Only recreate immutable texture when necessary for Android TensorsToSegmentationCalculator.
PiperOrigin-RevId: 568937611
2023-09-27 13:09:29 -07:00
MediaPipe Team
787371cfba No public description
PiperOrigin-RevId: 568927297
2023-09-27 12:27:57 -07:00
Sebastian Schmidt
61ce228576 Add cc_binary target for C Libraries
PiperOrigin-RevId: 568902427
2023-09-27 11:04:41 -07:00
Sebastian Schmidt
b01ad84c6f Add export declaration to FaceDetector.detect()
PiperOrigin-RevId: 568872459
2023-09-27 09:28:53 -07:00
Sebastian Schmidt
3134625508 No public description
PiperOrigin-RevId: 568660415
2023-09-26 15:14:16 -07:00
Copybara-Service
0417817886 Merge pull request from priankakariatyml:ios-vision-api-name-changes
PiperOrigin-RevId: 568622587
2023-09-26 12:51:31 -07:00
MediaPipe Team
199b42278b Fixes multiple typos in the tasks internal files.
PiperOrigin-RevId: 568585517
2023-09-26 10:45:07 -07:00
Sebastian Schmidt
e5e75eac5e No public description
PiperOrigin-RevId: 568581409
2023-09-26 10:34:47 -07:00
MediaPipe Team
573fdad173 Add export_model_with_tokenizer to Text Classifier API.
PiperOrigin-RevId: 567744604
2023-09-22 16:32:38 -07:00
Chris McClanahan
9d85141227 No public description
PiperOrigin-RevId: 567726262
2023-09-22 15:07:11 -07:00
Prianka Liz Kariat
b1f717e111 Added iOS Image Segmenter tests for methods with completion handlers 2023-09-23 00:15:10 +05:30
Prianka Liz Kariat
2d4e5a75b3 Updated iOS Object Detector Objective C API names 2023-09-23 00:08:43 +05:30
Prianka Liz Kariat
435bee71e8 Updated iOS hand landmarker Objective C API names 2023-09-23 00:08:07 +05:30
Prianka Liz Kariat
9d42744f8a Updated iOS Face Landmarker Objective C API names 2023-09-23 00:07:49 +05:30
Prianka Liz Kariat
d7c57e4eda Updated iOS Face Detector Objective C API names 2023-09-23 00:07:20 +05:30
MediaPipe Team
34cedb980b No public description
PiperOrigin-RevId: 567562548
2023-09-22 02:24:25 -07:00
MediaPipe Team
743118a04a Fixes multiple typos in the tasks internal files.
PiperOrigin-RevId: 567506050
2023-09-21 21:24:45 -07:00
MediaPipe Team
859d90b68b No public description
PiperOrigin-RevId: 567439132
2023-09-21 15:40:19 -07:00
MediaPipe Team
abf0ee892a Internal Changes
PiperOrigin-RevId: 567374962
2023-09-21 11:55:02 -07:00
MediaPipe Team
82d83f2dd8 Update glog to latest commit
PiperOrigin-RevId: 567337708
2023-09-21 10:10:04 -07:00
Mark McDonald
acca31503a
Remove pinned versions from deps 2023-09-21 13:21:45 +08:00
Copybara-Service
19c9d328cb Merge pull request from priankakariatyml:ios-image-segmenter-basic-tests
PiperOrigin-RevId: 567102079
2023-09-20 15:46:14 -07:00
MediaPipe Team
223641a73c Fix depth condition bug when only depth condition is configured.
PiperOrigin-RevId: 567080598
2023-09-20 14:29:18 -07:00
Mark McDonald
308f4f0e73
Adds an empty skeleton project for iOS docgen.
Dependencies tracked in `Podfile` are used to generate reference docs.
2023-09-20 16:53:34 +08:00
MediaPipe Team
41a012721f Fix bug missing SHOW_RESULT in image generator
PiperOrigin-RevId: 566810243
2023-09-19 18:37:35 -07:00
MediaPipe Team
867d5dc5a7 No public description
PiperOrigin-RevId: 566794388
2023-09-19 17:27:55 -07:00
MediaPipe Team
bbf40cba87 split stream utility function.
PiperOrigin-RevId: 566722901
2023-09-19 13:21:39 -07:00
Copybara-Service
58bb2d1b92 Merge pull request from shmishra99:patch-1
PiperOrigin-RevId: 566676755
2023-09-19 10:43:12 -07:00
Sebastian Schmidt
12600e03e9 Do not convert milliseconds to microseconds twice
Fixes https://github.com/google/mediapipe/issues/4809

PiperOrigin-RevId: 566644379
2023-09-19 08:47:31 -07:00
Prianka Liz Kariat
f1a5c8d549 Fixed formatting in MPPImageSegmenter.mm 2023-09-19 20:10:23 +05:30
Prianka Liz Kariat
d9d4016334 Uncommented live stream test in iOS image segmenter tests 2023-09-19 20:06:25 +05:30
Prianka Liz Kariat
bac60548dc Added selfie segmentation and running mode tests to image segmenter 2023-09-19 20:00:41 +05:30
Prianka Liz Kariat
08a5d55ac1 Updated interface of iOS image segmenter 2023-09-19 19:59:33 +05:30
Prianka Liz Kariat
6e80941215 Fixed premature deallocation of C++ masks in iOS Image Segmenter 2023-09-19 19:59:07 +05:30
Kinar
1c40ecf8a5 Added files for Face Stylizer Unit Tests 2023-09-19 03:08:01 -07:00
MediaPipe Team
0ed199186b Fix glScalerCalculator not clearing background in FIT mode
In FIT mode, the image is scaled in an aspect ratio preserving way. That means, the calculator does not render a full-screen quad. The letterbox areas are not drawn. This can cause artifacts, e.g. when MediaPipe reuses the GPU buffer from some other operation. This CL always clears the render target in FIT mode.

PiperOrigin-RevId: 566562715
2023-09-19 02:19:22 -07:00
Shivam Mishra
fd062a2c3f
Remove 'awaiting' labels when user issue/PR updated.
Remove the label "stat:awaiting response", when issue/PR unstale.
2023-09-19 11:28:20 +05:30
MediaPipe Team
94cda40a83 No public description
PiperOrigin-RevId: 566435327
2023-09-18 15:50:10 -07:00
MediaPipe Team
36f78f6e4a threshold stream utility function.
PiperOrigin-RevId: 566417914
2023-09-18 14:44:28 -07:00
MediaPipe Team
58a7790081 detections_to_rects stream utility function.
PiperOrigin-RevId: 566358715
2023-09-18 11:17:27 -07:00
MediaPipe Team
f4477f1739 A minor typo fix in model maker image classifier hyperparameters python docstring.
PiperOrigin-RevId: 566355937
2023-09-18 11:07:58 -07:00
Copybara-Service
d5fa4a157e Merge pull request from priankakariatyml:ios-image-segmenter-basic-tests
PiperOrigin-RevId: 565797057
2023-09-15 15:45:54 -07:00
Copybara-Service
838c89a3ff Merge pull request from priankakariatyml:ios-face-stylizer
PiperOrigin-RevId: 565784200
2023-09-15 14:49:50 -07:00
Sebastian Schmidt
94477b1342 No public description
PiperOrigin-RevId: 565755048
2023-09-15 12:55:00 -07:00
Sebastian Schmidt
a933e324b5 Add export declaration for FaceDetector
Fixes https://github.com/google/mediapipe/issues/4799

PiperOrigin-RevId: 565706741
2023-09-15 10:06:06 -07:00
Sebastian Schmidt
30590fe8d3 Add helper to create Connection array
PiperOrigin-RevId: 565706612
2023-09-15 10:00:28 -07:00
Prianka Liz Kariat
0f511d52d6 Fixed typo in iOS MPPImageSegmenterResult helpers 2023-09-15 14:24:15 +05:30
Prianka Liz Kariat
b3be1418da Updated multiply function in iOS Image Segmenter tests to use C++ vectors 2023-09-15 14:21:33 +05:30
Prianka Liz Kariat
fad7f9cdb4 Added iOS image segmenter basic Objective C tests 2023-09-15 14:18:54 +05:30
Prianka Liz Kariat
d3f7368b27 Added iOS MPPMask test utils 2023-09-15 14:18:23 +05:30
Prianka Liz Kariat
81ec5801ea Added new initializers for iOS MPPImage in test utils 2023-09-15 14:18:10 +05:30
Prianka Liz Kariat
e0b059da58 Added iOS MPPFileInfo for tests 2023-09-15 14:16:50 +05:30
Prianka Liz Kariat
21d000490c Added iOS face stylizer header 2023-09-15 14:06:11 +05:30
Prianka Liz Kariat
bb93b775f4 Added iOS face stylizer options 2023-09-15 14:05:59 +05:30
Prianka Liz Kariat
a259300bfe Added iOS face stylizer result 2023-09-15 14:05:38 +05:30
Sebastian Schmidt
4a8a811373 No public description
PiperOrigin-RevId: 565516592
2023-09-14 17:00:02 -07:00
MediaPipe Team
81964608ba Fixes typo in MediaPipe namespace
PiperOrigin-RevId: 565478366
2023-09-14 14:32:35 -07:00
Daniel Cheng
65e7cd5236 Fix win32 build break in mediapipe.
buffer_aligned_size_ is not used in tflite_support, but is used
in mediapipe.

PiperOrigin-RevId: 565477047
2023-09-14 14:27:05 -07:00
MediaPipe Team
f2b11bf250 No public description
PiperOrigin-RevId: 565446429
2023-09-14 12:41:12 -07:00
Sebastian Schmidt
85b19383b9 Fixes iOS hand landmarker connections
PiperOrigin-RevId: 565442497
2023-09-14 12:24:25 -07:00
MediaPipe Team
124a4de08d Clean up TensorConverterCalculator flipping behavior
Returns an error if
- gpu_origin is specified for a CPU image, and
- gpu_origin and flip_vertically are both specified.
Adds a test for an IMAGE_GPU input to validate flipping.

PiperOrigin-RevId: 565311456
2023-09-14 02:56:02 -07:00
Daniel Cheng
21646008d5 Don't define field in ExternalFileHandler that's not used on Windows.
This fixes:
```
error: private field 'buffer_aligned_size_' is not used [-Werror,-Wunused-private-field]
   87 |   int64 buffer_aligned_size_{};
      |         ^
```
in the downstream Chrome build.
PiperOrigin-RevId: 565221813
2023-09-13 18:42:32 -07:00
MediaPipe Team
7333329470 No public description
PiperOrigin-RevId: 565215664
2023-09-13 18:11:03 -07:00
MediaPipe Team
e1d1877e07 Modifying tensor_to_vector_float_calculator to take in D_BFLOAT16 values
PiperOrigin-RevId: 565189254
2023-09-13 16:10:35 -07:00
MediaPipe Team
6dc1239aa9 No public description
PiperOrigin-RevId: 565167086
2023-09-13 14:48:48 -07:00
Sebastian Schmidt
50bd79a317 Add exports to ImageSegmenterResult and InteractiveSegmenterResult
PiperOrigin-RevId: 565138661
2023-09-13 13:11:25 -07:00
Sebastian Schmidt
7b091dbe53 Fix missing exports for FilesetResolver and static constants
PiperOrigin-RevId: 565113006
2023-09-13 11:40:36 -07:00
MediaPipe Team
d6ee884200 No public description
PiperOrigin-RevId: 565087299
2023-09-13 10:23:00 -07:00
MediaPipe Team
8c9cd8a2fb fixes the non-unicode path of file_helpers on windows
Macros can't start with ##, this fixes it.

PiperOrigin-RevId: 565066376
2023-09-13 09:04:33 -07:00
MediaPipe Team
90e18eab91 Internal change.
PiperOrigin-RevId: 565062314
2023-09-13 08:49:16 -07:00
MediaPipe Team
38f421acf0 This will fix multiple typos in the tasks internal files.
PiperOrigin-RevId: 565055843
2023-09-13 08:22:19 -07:00
Sebastian Schmidt
a5a3e9d36b No public description
PiperOrigin-RevId: 564894013
2023-09-12 18:41:10 -07:00
MediaPipe Team
df211d211e Internal update.
PiperOrigin-RevId: 564883563
2023-09-12 17:40:28 -07:00
MediaPipe Team
1d8dda3337 Remove uncoditional texture params reset to make float textures handled correctly.
PiperOrigin-RevId: 564869245
2023-09-12 16:40:13 -07:00
MediaPipe Team
5b08a09446 Fixes two issues with file handling on windows:
. If UNICODE is set, then win32 functions taking file paths use wide
  (utf-16) strings. For example, FindFirstFile really calls to
  FindFirstFileW, which takes a wchar_t*. This adds support for
  the unicode path.
. SetContents() changes from "w" to "wb". This is necessary as
  windows will do some amount of encoding without "b", which results
  in much different values being written.

PiperOrigin-RevId: 564842317
2023-09-12 15:00:05 -07:00
MediaPipe Team
dbcdb44f7c Move loading tasks-vision-jni to individual vision task class
PiperOrigin-RevId: 564840343
2023-09-12 14:52:58 -07:00
MediaPipe Team
4ba1dadf92 Add option for nearest neighbor interpolation.
PiperOrigin-RevId: 564786213
2023-09-12 11:41:58 -07:00
MediaPipe Team
5daed78844 No public description
PiperOrigin-RevId: 564775970
2023-09-12 11:10:11 -07:00
MediaPipe Team
dd692c2395 Internal update
PiperOrigin-RevId: 564740487
2023-09-12 09:17:13 -07:00
MediaPipe Team
26a67f4424 No public description
PiperOrigin-RevId: 564651554
2023-09-12 02:15:53 -07:00
Sebastian Schmidt
12502b6f96 Add Handedness to JS, C++ and Android API
PiperOrigin-RevId: 564559718
2023-09-11 18:27:05 -07:00
MediaPipe Team
02bd0d95e7 Splitting GraphRunner into public API declared interfaces and private TS impls
PiperOrigin-RevId: 564551973
2023-09-11 17:48:21 -07:00
Sebastian Schmidt
0fec532ebe Add API exports for MPMask and MPImage
PiperOrigin-RevId: 564527405
2023-09-11 16:03:07 -07:00
Sebastian Schmidt
56c26dba84 Update WASM files for 10.5 release
PiperOrigin-RevId: 564511761
2023-09-11 15:07:51 -07:00
MediaPipe Team
7a04d60134 Set the default running model to Image for face stylizer.
PiperOrigin-RevId: 564511316
2023-09-11 15:03:07 -07:00
Sebastian Schmidt
81481df304 No public description
PiperOrigin-RevId: 564461274
2023-09-11 12:09:11 -07:00
Sebastian Schmidt
315982df0f Ensure that C header don't import C++ types
PiperOrigin-RevId: 564435119
2023-09-11 10:47:27 -07:00
Sebastian Schmidt
e206f9acdb No public description
PiperOrigin-RevId: 564429453
2023-09-11 10:36:06 -07:00
Copybara-Service
cdf199cf96 Merge pull request from priankakariatyml:ios-doc-updates-part2
PiperOrigin-RevId: 564429285
2023-09-11 10:31:13 -07:00
Chris McClanahan
e51b923bda internal fix
PiperOrigin-RevId: 564404269
2023-09-11 09:11:49 -07:00
MediaPipe Team
7f245bc84b Internal Change
PiperOrigin-RevId: 564316003
2023-09-11 02:39:40 -07:00
MediaPipe Team
b2494fe3c1 This will fix multiple typos in the tasks internal files.
PiperOrigin-RevId: 564264998
2023-09-10 21:56:57 -07:00
MediaPipe Team
d1b04a9309 Set enableFlowLimiting to false since only Image model is supported for face stylizer.
PiperOrigin-RevId: 563939653
2023-09-08 22:46:15 -07:00
Sebastian Schmidt
7accc79018 Internal
PiperOrigin-RevId: 563907673
2023-09-08 19:16:14 -07:00
Copybara-Service
1514304ab3 Merge pull request from priankakariatyml:ios-vision-task-refactoring-impl3
PiperOrigin-RevId: 563859728
2023-09-08 15:00:36 -07:00
Sebastian Schmidt
6df05b7d2a Internal
PiperOrigin-RevId: 563843599
2023-09-08 13:55:19 -07:00
Copybara-Service
b89ca28fe1 Merge pull request from kuaashish:master
PiperOrigin-RevId: 563840414
2023-09-08 13:44:20 -07:00
Prianka Liz Kariat
9d31827de8 Moved iOS MPPHandLandmark enum to MPPHandLandmarker.h 2023-09-08 20:06:47 +05:30
Prianka Liz Kariat
75daf4e756 Updated iOS hand landmarker documentation to use swift names 2023-09-08 19:16:15 +05:30
Prianka Liz Kariat
18f16f6bb5 Updated iOS gesture recognizer documentation to use Swift names 2023-09-08 19:15:56 +05:30
Prianka Liz Kariat
900e637b6a Fixed typos in iOS documentation 2023-09-08 19:15:32 +05:30
MediaPipe Team
886a118232 landmarks_to_detection stream utility function.
PiperOrigin-RevId: 563633314
2023-09-07 21:40:45 -07:00
MediaPipe Team
7549677408 Internal update
PiperOrigin-RevId: 563553758
2023-09-07 14:58:39 -07:00
MediaPipe Team
80b762a281 No public description
PiperOrigin-RevId: 563543098
2023-09-07 14:19:08 -07:00
Sebastian Schmidt
6c38483b37 Add externs to js_library targets
PiperOrigin-RevId: 563500180
2023-09-07 11:52:30 -07:00
vrabaud
55536c4382 No public description
PiperOrigin-RevId: 563333271
2023-09-07 00:00:38 -07:00
MediaPipe Team
5f4a6e313e Format improvement.
PiperOrigin-RevId: 563321343
2023-09-06 23:02:05 -07:00
MediaPipe Team
3ce457006f Remove video and streaming mode for face stylizer.
PiperOrigin-RevId: 563312344
2023-09-06 22:20:43 -07:00
MediaPipe Team
a9da6d325c Move stream API landmarks_projection to third_party.
PiperOrigin-RevId: 563246209
2023-09-06 16:21:09 -07:00
MediaPipe Team
7252f6f2e7 Remove video and stream model in face stylizer.
PiperOrigin-RevId: 563233996
2023-09-06 15:33:58 -07:00
MediaPipe Team
b40b3973fb Add notes/warnings for calculators which use dedicated GL contexts.
PiperOrigin-RevId: 563167765
2023-09-06 11:40:21 -07:00
MediaPipe Team
e58ec2d039 No public description
PiperOrigin-RevId: 563163901
2023-09-06 11:30:53 -07:00
MediaPipe Team
967007f250 No public description
PiperOrigin-RevId: 563145860
2023-09-06 10:35:52 -07:00
Prianka Liz Kariat
1ffa999abb Replaced the old iOS vision task runner with the refactored task runner 2023-09-06 18:55:03 +05:30
MediaPipe Team
e39119ae53 Add missing cache writing implementation in InferenceCalculatorAdvancedGL
Add missing implementation for absl::Status SaveGpuCachesBasedOnBehavior(tflite::gpu::TFLiteGPURunner* gpu_runner) const for non android/chromeos.

PiperOrigin-RevId: 562973338
2023-09-05 20:51:36 -07:00
MediaPipe Team
bf32d1acb2 No public description
PiperOrigin-RevId: 562915674
2023-09-05 15:52:21 -07:00
MediaPipe Team
4e52e96973 No public description
PiperOrigin-RevId: 562865700
2023-09-05 13:03:27 -07:00
Sebastian Schmidt
2aefa2308b Internal
PiperOrigin-RevId: 562834129
2023-09-05 11:10:55 -07:00
Copybara-Service
a87613aa6c Merge pull request from priankakariatyml:ios-vision-task-runner-refactor-impl-part2
PiperOrigin-RevId: 562823970
2023-09-05 10:39:19 -07:00
Fergus Henderson
a19da25565 Some spelling and grammar fixes in the comments.
PiperOrigin-RevId: 562802023
2023-09-05 09:28:50 -07:00
MediaPipe Team
be0cde8c2e No public description
PiperOrigin-RevId: 562724334
2023-09-05 03:39:37 -07:00
MediaPipe Team
223544ca4b No public description
PiperOrigin-RevId: 562711473
2023-09-05 02:35:24 -07:00
Ayush Gupta
4f5069b402
Merge pull request from kuaashish/master
Updated Issue Templates
2023-09-04 12:15:58 +05:30
MediaPipe Team
cac462c486 Add allow_custom_ops to model_util.convert_to_tflite and enable custom ops for face stylizer.
PiperOrigin-RevId: 562212965
2023-09-02 09:56:40 -07:00
MediaPipe Team
2b5e281c27 internal update
PiperOrigin-RevId: 562090520
2023-09-01 17:52:50 -07:00
MediaPipe Team
d6119957a4 No public description
PiperOrigin-RevId: 562075110
2023-09-01 16:31:33 -07:00
MediaPipe Team
ab70d92752 No public description
PiperOrigin-RevId: 562071599
2023-09-01 16:14:06 -07:00
MediaPipe Team
23057ac146 Update PackMediaSequenceCalculator to support setting clip/media/string, clip/media/confidence and clip/label/index.
The input stream is provided as drishti::Detection.

PiperOrigin-RevId: 562070790
2023-09-01 16:08:52 -07:00
Copybara-Service
e7d071ab39 Merge pull request from priankakariatyml:ios-image-segmenter-impl
PiperOrigin-RevId: 562020873
2023-09-01 12:34:30 -07:00
MediaPipe Team
6c43d37e5a Provide API/options to show intermediate results and generating progress for Java Image Generator.
PiperOrigin-RevId: 562014712
2023-09-01 12:32:26 -07:00
MediaPipe Team
ceb8cd3c78 internal update.
PiperOrigin-RevId: 561995330
2023-09-01 10:57:40 -07:00
MediaPipe Team
823493ee82 Internal update.
PiperOrigin-RevId: 561995055
2023-09-01 10:53:00 -07:00
MediaPipe Team
007824594b Rollback of "Enable defining and using internal executors in subgraphs."
PiperOrigin-RevId: 561921927
2023-09-01 04:57:34 -07:00
Prianka Liz Kariat
40da111ba7 Updated iOS object detector to use refactored vision task runner 2023-09-01 14:07:42 +05:30
Prianka Liz Kariat
188321ace4 Updated iOS hand landmarker to use refactored vision task runner 2023-09-01 14:07:25 +05:30
Prianka Liz Kariat
020ca5eb77 Updated iOS gesture recognizer to use refactored vision task runner 2023-09-01 14:07:07 +05:30
Prianka Liz Kariat
fe9c7a47e9 Updated iOS face landmarker to use refactored vision task runner 2023-09-01 14:06:50 +05:30
kuaashish
b60355dee9
Update 18-solution-legacy-issue-template.yaml 2023-09-01 14:06:47 +05:30
kuaashish
f371f8f4ea
Update 16-bug-issue-template.yaml 2023-09-01 14:04:24 +05:30
kuaashish
8642a22985
Update 15-build-install-issue-template.yaml 2023-09-01 14:03:49 +05:30
kuaashish
d8a9f3ac8e
Update 14-feature-request-issue-template.yaml 2023-09-01 14:03:07 +05:30
kuaashish
1378fb63a7
Update 12-studio-issue-template.yaml 2023-09-01 14:01:20 +05:30
kuaashish
0e8f5c168a
Update 11-model-maker-issue-template.yaml 2023-09-01 14:00:48 +05:30
kuaashish
e060824cd7
Merge branch 'google:master' into master 2023-09-01 13:59:13 +05:30
MediaPipe Team
de0c7f2a30 Make cache writes optional in InferenceCalculatorAdvancedGL
Previously, caches were always written, and an error would cause the graph to close abruptly. This prevented services with read-only access to the cache from using the calculator.

The new behavior allows services to choose whether or not to write caches.

PiperOrigin-RevId: 561866791
2023-08-31 23:31:27 -07:00
MediaPipe Team
dea6ccba25 Remove unnecessary includes in threadpool_std_thread_impl.cc.
The windows.h was causing conflicts with LOG. Also the the posix headers weren't needed because the code doesn't use OS specific code anymore.

PiperOrigin-RevId: 561848229
2023-08-31 21:52:22 -07:00
Sebastian Schmidt
9bb852c33d Add libimagegenerator_gpu.so
PiperOrigin-RevId: 561800710
2023-08-31 17:10:00 -07:00
Copybara-Service
827c2983bd Merge pull request from priankakariatyml:ios-vision-task-runner-refactor-impl
PiperOrigin-RevId: 561796747
2023-08-31 16:53:14 -07:00
MediaPipe Team
81732944c4 No public description
PiperOrigin-RevId: 561775271
2023-08-31 15:22:43 -07:00
MediaPipe Team
afcb9c4216 No public description
PiperOrigin-RevId: 561773992
2023-08-31 15:17:51 -07:00
MediaPipe Team
62e682363c Remove reference pointer to prevent using a constant reference in the looped iteration variable
PiperOrigin-RevId: 561758116
2023-08-31 14:17:51 -07:00
MediaPipe Team
7c2d654d67 Convert CHECK macro to ABSL_CHECK.
Chrome can't use Absl's CHECK because of collisions with its own version.

PiperOrigin-RevId: 561740965
2023-08-31 13:20:29 -07:00
Prianka Liz Kariat
d16cb72438 Fixed method call in MPPImageSegmenter.mm 2023-08-31 18:04:09 +05:30
Prianka Liz Kariat
9f01540191 Changed order of methods in MPPImageSegmenter.mm 2023-08-31 18:02:34 +05:30
Prianka Liz Kariat
ba685567dd Updated iOS image classifier to use refactored vision task runner 2023-08-31 17:56:36 +05:30
Prianka Liz Kariat
e7a0ed84e6 Updated iOS face detector to use refactored vision task runner 2023-08-31 17:37:15 +05:30
Prianka Liz Kariat
ec87f068c1 Renamed option in MPPImageSegmenterOptions 2023-08-31 17:31:54 +05:30
Prianka Liz Kariat
bac3efdf6a Fixed typo in MPPImageSegmenter.h 2023-08-31 17:31:17 +05:30
Prianka Liz Kariat
5a1564e04c Updated image segmenter bazel target to add MPPImageSegmenter.mm 2023-08-31 14:22:17 +05:30
Prianka Liz Kariat
0863d8def5 Added iOS image segmenter implementation file 2023-08-31 14:04:34 +05:30
Prianka Liz Kariat
f74f7b8657 Fixed typo 2023-08-31 14:04:17 +05:30
Prianka Liz Kariat
47e7ec47a2 Changed delegate method to optional 2023-08-31 14:04:09 +05:30
kuaashish
15c8e4b087
Update 00-task-issue-template.yaml 2023-08-31 11:02:09 +05:30
kuaashish
fdc1207a40
Update 00-task-issue-template.yaml 2023-08-31 11:00:45 +05:30
kuaashish
74ebb89dec
Update 00-task-issue-template.yaml 2023-08-31 10:51:16 +05:30
kuaashish
f88db254da
Update 00-task-issue-template.yaml 2023-08-31 10:50:44 +05:30
Copybara-Service
30802b80cd Merge pull request from priankakariatyml:ios-doc-updates
PiperOrigin-RevId: 561469442
2023-08-30 15:39:20 -07:00
MediaPipe Team
612162d765 Check if the image contains valid face that can be aligned for stylization. If not, throw an exception for invalid input image. This is applied to both input stylized face and raw face.
PiperOrigin-RevId: 561439600
2023-08-30 13:54:11 -07:00
MediaPipe Team
c92570f844 Use ABSL_LOG in MediaPipe.
This is needed in Chrome builds to avoid collisions with its own LOG.

PiperOrigin-RevId: 561436864
2023-08-30 13:43:49 -07:00
Jiuqiang Tang
f60da2120d Internal changes
PiperOrigin-RevId: 561398473
2023-08-30 11:26:57 -07:00
MediaPipe Team
5434b840f6 Improving throttling logs by providing a node info corresponding to a throttling stream.
PiperOrigin-RevId: 561396272
2023-08-30 11:21:31 -07:00
MediaPipe Team
45b0271ded No public description
PiperOrigin-RevId: 561379537
2023-08-30 10:27:02 -07:00
Prianka Liz Kariat
3e90e8d464 Fixed directory creation issues in build_ios_framework.sh 2023-08-30 16:28:17 +05:30
Prianka Liz Kariat
763bc8c71c Fixed typos 2023-08-30 16:27:52 +05:30
Prianka Liz Kariat
298578e10e Added gesture recognizer and hand landmarker to iOS vision framework 2023-08-30 14:51:05 +05:30
MediaPipe Team
6c2638592e Internal update.
PiperOrigin-RevId: 561184322
2023-08-29 17:34:35 -07:00
MediaPipe Team
e18e749e3e Internal update
PiperOrigin-RevId: 561148365
2023-08-29 15:04:33 -07:00
MediaPipe Team
01fbbd9f67 No public description
PiperOrigin-RevId: 561067189
2023-08-29 10:18:06 -07:00
MediaPipe Team
f56b8a13a3 Add a custom op resolver for fused batch norm.
PiperOrigin-RevId: 560795170
2023-08-28 13:04:10 -07:00
MediaPipe Team
442940cd55 No public description
PiperOrigin-RevId: 560743684
2023-08-28 10:08:49 -07:00
MediaPipe Team
1aa5e0d46f No public description
PiperOrigin-RevId: 560689326
2023-08-28 06:21:09 -07:00
MediaPipe Team
b22dcf9ce6 No public description
PiperOrigin-RevId: 560652313
2023-08-28 02:50:07 -07:00
Sebastian Schmidt
d0bf0dd021 Update TF to solve OneDNN build
PiperOrigin-RevId: 560241320
2023-08-25 18:05:50 -07:00
MediaPipe Team
d6dce193fc Internal update
PiperOrigin-RevId: 560147650
2023-08-25 11:22:58 -07:00
Copybara-Service
5d2d8f9ab2 Merge pull request from priankakariatyml:ios-doc-updates
PiperOrigin-RevId: 560133185
2023-08-25 10:37:51 -07:00
Prianka Liz Kariat
3f0ec5969b Updated iOS docs to use swift names in place of objective c names 2023-08-25 18:06:50 +05:30
MediaPipe Team
6e6978cdbf New image test utilities and memory management fixes.
PiperOrigin-RevId: 559926378
2023-08-24 18:02:55 -07:00
MediaPipe Team
dd09c8d3f7 Update port includes with IWYU to fix clang warnings in code where corresponding ports are used.
PiperOrigin-RevId: 559920115
2023-08-24 17:33:34 -07:00
Zu Kim
c56f45bce5 Change the image label input from Classification to Detection.
PiperOrigin-RevId: 559828139
2023-08-24 12:08:25 -07:00
Richard Levasseur
f2e9a553d6 No public description
PiperOrigin-RevId: 559787614
2023-08-24 10:06:00 -07:00
Sebastian Schmidt
4fb52bb7ef Add 'types' to package.json
Fixes gttps://github.com/google/mediapipe/issues/4659

PiperOrigin-RevId: 559785635
2023-08-24 09:58:44 -07:00
MediaPipe Team
4b1b6ae7fb Move stream API rect_transformation to third_party.
PiperOrigin-RevId: 559652775
2023-08-23 23:11:47 -07:00
MediaPipe Team
b2446c6ca8 No public description
PiperOrigin-RevId: 559566037
2023-08-23 15:50:34 -07:00
Sebastian Schmidt
f3d069175c Add C++ converters for C Text Classifier API
PiperOrigin-RevId: 559519880
2023-08-23 13:08:40 -07:00
MediaPipe Team
f645c59746 Move stream API image_size to third_party.
PiperOrigin-RevId: 559475476
2023-08-23 10:45:18 -07:00
Nevena Kotlaja
8689f4f595 No public description
PiperOrigin-RevId: 559466191
2023-08-23 10:21:28 -07:00
MediaPipe Team
2ebdb01d43 ImageGenerator Java API
PiperOrigin-RevId: 559310074
2023-08-22 21:42:16 -07:00
MediaPipe Team
90781669cb No public description
PiperOrigin-RevId: 559275983
2023-08-22 18:04:11 -07:00
Sebastian Schmidt
1dfdeb6ebb No public description
PiperOrigin-RevId: 559239912
2023-08-22 15:25:03 -07:00
MediaPipe Team
3443fe4c8e No public description
PiperOrigin-RevId: 559211117
2023-08-22 13:43:27 -07:00
MediaPipe Team
8c4b971c14 Add an API in model_task_graph to create or use cached model resources.
PiperOrigin-RevId: 559174528
2023-08-22 11:34:54 -07:00
MediaPipe Team
bcb83302bf Add pose landmarks constants
PiperOrigin-RevId: 559153433
2023-08-22 10:32:10 -07:00
MediaPipe Team
7517b56476 No public description
PiperOrigin-RevId: 559133490
2023-08-22 09:26:33 -07:00
MediaPipe Team
edb0a64d0e Move stream API loopback to third_party.
PiperOrigin-RevId: 559037020
2023-08-22 01:44:24 -07:00
MediaPipe Team
9bc8b3bb4f Update the header information for EnsureMinimumDefaultExecutorStackSize.
PiperOrigin-RevId: 558981535
2023-08-21 21:26:32 -07:00
MediaPipe Team
7ba4edc372 Internal Change
PiperOrigin-RevId: 558937644
2023-08-21 16:55:44 -07:00
MediaPipe Team
7f8150776a Add an API to run inference with face stylizer TF model.
PiperOrigin-RevId: 558926645
2023-08-21 16:08:58 -07:00
MediaPipe Team
bbf168ddda Add a new from_image API to create face stylizer dataset from a single image. Also deprecate the from_folder API since we only support one-shot use case now.
PiperOrigin-RevId: 558912896
2023-08-21 15:14:36 -07:00
MediaPipe Team
ae9e945e0c Change SegmentationOptions.builder() to be public
PiperOrigin-RevId: 558864872
2023-08-21 12:18:17 -07:00
MediaPipe Team
737c103940 Add output size as parameters in Java ImageSegmenter
PiperOrigin-RevId: 558834692
2023-08-21 10:45:08 -07:00
MediaPipe Team
cd9d32e797 update pose rendering
PiperOrigin-RevId: 558424354
2023-08-19 10:40:26 -07:00
MediaPipe Team
a44c810921 Update PackMediaSequenceCalculator to support adding clip/media/id to the MediaSequence.
As the media ID is usually a video ID which is provided to the graph as a side packet, in this graph it expects it to be provided as as a input side packet instead of an input stream.

PiperOrigin-RevId: 558266967
2023-08-18 15:48:40 -07:00
MediaPipe Team
fda0d19337 Adds option to use tensor_ahwb in Android vendor processes
PiperOrigin-RevId: 558086646
2023-08-18 02:31:58 -07:00
Chris McClanahan
a04a3a1c81 internal fix
PiperOrigin-RevId: 557934477
2023-08-17 14:20:58 -07:00
Copybara-Service
6866d338e0 Merge pull request from priankakariatyml:ios-vision-task-runner-refactoring
PiperOrigin-RevId: 557894034
2023-08-17 12:02:07 -07:00
MediaPipe Team
b213256cbd Change supported_ops to a Tuple instead of List to match the API definition.
PiperOrigin-RevId: 557890361
2023-08-17 11:48:56 -07:00
Sebastian Schmidt
990bfd2e3e Don't access "document" in WebWorker
Fixes https://github.com/google/mediapipe/issues/4694

PiperOrigin-RevId: 557885230
2023-08-17 11:32:55 -07:00
Prianka Liz Kariat
22dc08be0e Removed convenience initializer from refactored MPPVisionTaskRunner 2023-08-17 14:15:14 +05:30
MediaPipe Team
ed0c8d8d8b Swap left and right hand labels.
PiperOrigin-RevId: 557625660
2023-08-16 15:51:19 -07:00
MediaPipe Team
13bb65db96 Internal Changes
PiperOrigin-RevId: 557563669
2023-08-16 12:16:16 -07:00
MediaPipe Team
9e45e2b6e9 Setting training for the encoder and decoder when converting to TFLite.
Also add selected TF ops to TFLite converter.

PiperOrigin-RevId: 557520277
2023-08-16 10:02:29 -07:00
MediaPipe Team
ee217ceb67 Fix MediaPipe build in Chromium.
When building Chromium with Clang on Windows, it needs the template specializations to be declared as well.

PiperOrigin-RevId: 557508703
2023-08-16 09:23:15 -07:00
Sebastian Schmidt
251ffc21c8 No public description
PiperOrigin-RevId: 557501469
2023-08-16 08:58:14 -07:00
MediaPipe Team
ff17846c6a No public description
PiperOrigin-RevId: 557490568
2023-08-16 08:16:30 -07:00
MediaPipe Team
ff3f0433d3 Fix image_util shortcut import line
PiperOrigin-RevId: 557311617
2023-08-15 18:19:13 -07:00
MediaPipe Team
1c98270ef0 Import image_util for using it in mediapipe face stylizer open sourcing.
PiperOrigin-RevId: 557254489
2023-08-15 14:41:57 -07:00
MediaPipe Team
cda0ba04ed Dry-Run mode for static registration to make it easier to find all required static registrations
PiperOrigin-RevId: 557185347
2023-08-15 11:03:18 -07:00
MediaPipe Team
c1d7e6023a Expose tool calculators in headers to enable dynamic registration by superusers.
PiperOrigin-RevId: 557174440
2023-08-15 10:32:45 -07:00
MediaPipe Team
a392561b31 Internal change
PiperOrigin-RevId: 557015628
2023-08-14 22:16:20 -07:00
MediaPipe Team
0da296536b Expose stream handlers in headers to allow dynamic registration for superusers
PiperOrigin-RevId: 556988288
2023-08-14 20:01:50 -07:00
MediaPipe Team
b6f5414b3d Support more GPU formats in tensor converter calculator.
PiperOrigin-RevId: 556987807
2023-08-14 19:57:05 -07:00
MediaPipe Team
a183212a13 Header for callback_packet_calculator to allow dynamic registration for superusers
PiperOrigin-RevId: 556977122
2023-08-14 18:50:11 -07:00
MediaPipe Team
9c5bdd2eb9 Clarify deprecated GraphStatus usage in Close documentation
PiperOrigin-RevId: 556963967
2023-08-14 17:53:32 -07:00
MediaPipe Team
dd940707ca Provide a way to disable static registration using MEDIAPIPE_DISABLE_STATIC_REGISTRATION
PiperOrigin-RevId: 556963956
2023-08-14 17:48:25 -07:00
MediaPipe Team
6605fdb16f add end loop calculator for image size
PiperOrigin-RevId: 556955370
2023-08-14 17:09:02 -07:00
MediaPipe Team
a8bee6baf3 Updates the runners to support wasm-style binary assets files, and allows their URLs to be explicitly specified as part of the WasmFileset.
PiperOrigin-RevId: 556903356
2023-08-14 13:59:53 -07:00
MediaPipe Team
c8ad606e7c Refactor text_classifier preprocessor to move away from using classifier_data_lib
PiperOrigin-RevId: 556859900
2023-08-14 11:41:09 -07:00
MediaPipe Team
3ac3b03ed5 Migrate packet messages auto registration to rely on MEDIAPIPE_STATIC_REGISTRATOR_TEMPLATE
PiperOrigin-RevId: 556063007
2023-08-11 13:14:29 -07:00
Yuqi Li
c448d54aa7 add metadata writer into face stylizer.
PiperOrigin-RevId: 555596257
2023-08-10 12:09:27 -07:00
MediaPipe Team
91f15d8e4a Enable run inference with a TFLite model containing multiple subgraphs. It uses the subgraph 0 as the default primary subgraph for inference. It will also log a warning in the case that there are more than one subgraph in the model.
PiperOrigin-RevId: 555579131
2023-08-10 11:30:32 -07:00
MediaPipe Team
a9c7e22ca4 apply affine transform before drawing, in order to keep constant line width regardless of face cropping.
PiperOrigin-RevId: 555173659
2023-08-09 08:42:57 -07:00
MediaPipe Team
00e0314040 Remove unsafe cast.
PiperOrigin-RevId: 555007705
2023-08-08 18:50:11 -07:00
MediaPipe Team
f9a0244c5b No public description
PiperOrigin-RevId: 555005770
2023-08-08 18:38:34 -07:00
MediaPipe Team
e558a71597 Include calculator_context.h and calculator_contract.h from calculator_framework.h
PiperOrigin-RevId: 554931086
2023-08-08 13:54:59 -07:00
MediaPipe Team
39b31e51a9 No public description
PiperOrigin-RevId: 554673463
2023-08-07 20:15:34 -07:00
MediaPipe Team
032ed973b6 Add setGpuBufferVerticalFlip to GraphRunner TS API
PiperOrigin-RevId: 554667869
2023-08-07 19:44:21 -07:00
MediaPipe Team
c1c51c2fe7 Internal
PiperOrigin-RevId: 554595324
2023-08-07 14:36:42 -07:00
Zu Kim
22054cd468 Set confidence score of the bounding box label.
PiperOrigin-RevId: 554508925
2023-08-07 10:01:59 -07:00
MediaPipe Team
e10bcd1bfd No public description
PiperOrigin-RevId: 554084475
2023-08-05 08:36:24 -07:00
Zu Kim
460346ed13 Add a support for label annotations (image/label/string and image/label/confidence). Also fixed some clang tidy issues.
PiperOrigin-RevId: 553900667
2023-08-04 13:43:44 -07:00
MediaPipe Team
11508f2291 Internal Change
PiperOrigin-RevId: 553652444
2023-08-03 18:49:35 -07:00
MediaPipe Team
360959e325 Replace some size EXPECTs by ASSERTs
PiperOrigin-RevId: 553555650
2023-08-03 12:27:52 -07:00
MediaPipe Team
a0b91e4062 Add a GpuOrigin parameter to TensorConverterCalculator
The parameter superseeds flip_vertically. GpuOrigin works more generally than flip_vertically because CONVENTIONAL works on both iOS (no flip) and Android (yes flip). If not set, the calculator falls back to flip_vertically for backwards compatibility.

Note that web demos actually use TOP_LEFT image orientation, so they shouldn't be flipped, but they still are by CONVENTIONAL. That's being discussed right now.

PiperOrigin-RevId: 553400525
2023-08-03 01:40:13 -07:00
MediaPipe Team
9325af0af3 vlog default executor and its config usage
PiperOrigin-RevId: 553298440
2023-08-02 17:01:05 -07:00
MediaPipe Team
e56636b6d1 internal change
PiperOrigin-RevId: 553250547
2023-08-02 14:06:16 -07:00
MediaPipe Team
366a3290cf Change to add the w_avg latent code to style encoding before layer swapping. This is a bug in the previous code. Also set training=True for encoder since this affect the encoding performance.
PiperOrigin-RevId: 553234376
2023-08-02 13:11:22 -07:00
MediaPipe Team
6e54d8c204 Log stack traces for combined CalculatorGraph statuses
PiperOrigin-RevId: 553111356
2023-08-02 05:10:52 -07:00
MediaPipe Team
557ed0b1ea Add tensorflow-addons to model_maker requirements.txt
PiperOrigin-RevId: 552610011
2023-07-31 15:36:25 -07:00
MediaPipe Team
6f916a001c Fix crash in SavePngTestOutput
Do not call SavePngTestOutput in CompareAndSaveImageOutput in case diff_img is null. This can happen if for instance the expected and the actual image have non-matching format or size. Currently, this crashes.
Support single channel golden images.

PiperOrigin-RevId: 552519834
2023-07-31 10:20:06 -07:00
Sebastian Schmidt
d392f8ad98 Ensure that -std=c++14/17 is the first argument passed to Glog
PiperOrigin-RevId: 552509553
2023-07-31 09:47:32 -07:00
Sebastian Schmidt
81cf7fa173 Updat WASM binaries for 0.10.3 release
PiperOrigin-RevId: 551975834
2023-07-28 16:17:30 -07:00
MediaPipe Team
8e313b4b0c Fix typo in model maker requirements.txt
PiperOrigin-RevId: 551973577
2023-07-28 16:07:12 -07:00
Sebastian Schmidt
b4bcfab4f5 Remove extra letter from text classifier API
PiperOrigin-RevId: 551942087
2023-07-28 13:56:56 -07:00
Sebastian Schmidt
8ab9185c1d Use C+++ 17 for Glog only on Windows
PiperOrigin-RevId: 551928369
2023-07-28 12:58:42 -07:00
MediaPipe Team
3f7752561b No public description
PiperOrigin-RevId: 551914786
2023-07-28 12:05:38 -07:00
MediaPipe Team
9edb059d9f No public description
PiperOrigin-RevId: 551868738
2023-07-28 09:09:39 -07:00
MediaPipe Team
7db0c1944b Internal change
PiperOrigin-RevId: 551789915
2023-07-28 02:29:52 -07:00
MediaPipe Team
db9a72a5df Internal Changes
PiperOrigin-RevId: 551674542
2023-07-27 16:35:35 -07:00
MediaPipe Team
5c007558f8 internal change.
PiperOrigin-RevId: 551645248
2023-07-27 14:45:18 -07:00
Sebastian Schmidt
4d5c6bd33a Internal
PiperOrigin-RevId: 551625147
2023-07-27 13:33:14 -07:00
Sebastian Schmidt
fdea10d230 Add C Headers for Text Classifier
PiperOrigin-RevId: 551618765
2023-07-27 13:09:49 -07:00
MediaPipe Team
5b31f1e3e9 Update glog to latest commit
PiperOrigin-RevId: 551601991
2023-07-27 12:07:20 -07:00
Sebastian Schmidt
7d9cb4ee67 No public description
PiperOrigin-RevId: 551586945
2023-07-27 11:17:54 -07:00
MediaPipe Team
f3f9e71ccb No public description
PiperOrigin-RevId: 551549511
2023-07-27 09:15:46 -07:00
MediaPipe Team
6de275834d internal change.
PiperOrigin-RevId: 551366789
2023-07-26 17:59:06 -07:00
Sebastian Schmidt
c9d79a0076 Rollback of "Fix duplicate condition error in :resource_util"
PiperOrigin-RevId: 551332734
2023-07-26 15:31:51 -07:00
Sebastian Schmidt
dad46e1e90 Update glog to 0.6
PiperOrigin-RevId: 551330044
2023-07-26 15:20:34 -07:00
Sebastian Schmidt
f156397e8f Fix Android build with any Protos
PiperOrigin-RevId: 551325541
2023-07-26 15:04:38 -07:00
MediaPipe Team
fa5c1b03d2 No public description
PiperOrigin-RevId: 551277242
2023-07-26 12:08:33 -07:00
Sebastian Schmidt
87b925795d Update glog to 0.6
PiperOrigin-RevId: 551269455
2023-07-26 11:41:24 -07:00
Sebastian Schmidt
750f498b14 Internal
PiperOrigin-RevId: 551247471
2023-07-26 10:33:19 -07:00
Prianka Liz Kariat
d2a86341bd Added refactored iOS vision task runner sources 2023-07-26 20:02:00 +05:30
MediaPipe Team
1f6851c577 C++ Image segmenter add output size parameters.
PiperOrigin-RevId: 550995124
2023-07-25 14:22:11 -07:00
MediaPipe Team
bd7888cc0c 1. Move evaluation onto GPU/TPU hardware if available.
2. Move desired_precision and desired_recall from evaluate to hyperparameters so recall@precision metrics will be reported for both training and evaluation. This also fixes a bug where recompiling the model with the previously initialized metric objects would not properly reset the metric states.
3. Remove redundant label_names from create_... class methods in text_classifier. This information is already provided by the datasets.
4. Change loss function to FocalLoss.
5. Re-enable text_classifier unit tests using ExBert
6. Add input names to avoid flaky auto-assigned input names.

PiperOrigin-RevId: 550992146
2023-07-25 14:12:26 -07:00
MediaPipe Team
85c3fed70a Add class weights to core hyperparameters and classifier library.
PiperOrigin-RevId: 550962843
2023-07-25 12:29:46 -07:00
MediaPipe Team
62538a9496 No public description
PiperOrigin-RevId: 550954023
2023-07-25 11:57:08 -07:00
MediaPipe Team
113c9b30c2 No public description
PiperOrigin-RevId: 550616150
2023-07-24 11:09:31 -07:00
Copybara-Service
66cceddb5e Merge pull request from priankakariatyml:ios-image-segmenter-container-utils
PiperOrigin-RevId: 550608973
2023-07-24 10:46:56 -07:00
Prianka Liz Kariat
72c62f7d5d Added iOS Image Segmenter Header 2023-07-24 20:38:16 +05:30
MediaPipe Team
25b01784de Fix documentation
PiperOrigin-RevId: 549968822
2023-07-21 09:33:48 -07:00
MediaPipe Team
9af637b125 Java API add visibility and presence for landmarks.
PiperOrigin-RevId: 549709256
2023-07-20 12:42:01 -07:00
Copybara-Service
236a36e39a Merge pull request from priankakariatyml:ios-vision-library-fixes
PiperOrigin-RevId: 549659874
2023-07-20 09:52:11 -07:00
Prianka Liz Kariat
540f4f7fe6 Fixed swift name of iOS face landmarker delegate 2023-07-20 15:57:37 +05:30
Prianka Liz Kariat
3198ccf6a5 Added missing headers in ios vision framework build 2023-07-20 15:57:16 +05:30
Steven Hickson
e47af74b15 Adding support for 2 things in tensors_to_image_calculator:
1) 1 channel support for conversion after inference.
2) multitask support by allowing for different tensor outputs.

PiperOrigin-RevId: 549412331
2023-07-19 13:41:46 -07:00
MediaPipe Team
085840388b Move waitOnCpu and waitOnGpu out of the synchronized block, which can cause deadlock.
PiperOrigin-RevId: 549217916
2023-07-18 23:42:01 -07:00
MediaPipe Team
4e72fcf0cb Replace CHECK with RET_CHECK in GetContract() implementation from six calculators.
PiperOrigin-RevId: 549158984
2023-07-18 17:38:44 -07:00
MediaPipe Team
4c60fe7365 add pose landmarks connections in C++ API
PiperOrigin-RevId: 549108310
2023-07-18 14:21:02 -07:00
MediaPipe Team
9b00582f21 add hand landmarks connections in C++ API.
PiperOrigin-RevId: 549108307
2023-07-18 14:16:27 -07:00
MediaPipe Team
cb915858fa Internal change
PiperOrigin-RevId: 549052451
2023-07-18 11:01:37 -07:00
Jiuqiang Tang
0c01187cf5 Internal change
PiperOrigin-RevId: 548886447
2023-07-17 21:57:24 -07:00
MediaPipe Team
ef12ce8575 Internal change
PiperOrigin-RevId: 548821518
2023-07-17 15:56:05 -07:00
MediaPipe Team
f1f9f80cd9 Internal change
PiperOrigin-RevId: 548746432
2023-07-17 11:18:00 -07:00
MediaPipe Team
17bc1a5ab5 Internal change
PiperOrigin-RevId: 548196034
2023-07-14 12:39:45 -07:00
MediaPipe Team
2fae07375c Discard outdated packets earlier in MuxInputStreamHandler.
In our pipeline, a deadlock is detected because the packets in deselected
data streams get piled up. In the current implementation, those packets only get
removed in FillInputSet(), but we should also do that in GetNodeReadiness().

PiperOrigin-RevId: 548051369
2023-07-14 01:12:14 -07:00
MediaPipe Team
723e91cec1 Generalize non-define registration with MEDIAPIPE_STATIC_REGISTRATOR_TEMPLATE
PiperOrigin-RevId: 547929982
2023-07-13 14:52:37 -07:00
MediaPipe Team
c2c67c20fa Internal change
PiperOrigin-RevId: 547924907
2023-07-13 14:37:40 -07:00
Sebastian Schmidt
327feb42d1 Support WASM asset loading for MediaPipe Task Web
PiperOrigin-RevId: 547882566
2023-07-13 12:26:59 -07:00
MediaPipe Team
8b59567cb7 Add proto3 Any proto support for Java task api
PiperOrigin-RevId: 547836041
2023-07-13 10:10:17 -07:00
MediaPipe Team
e37bedd344 Fix Halide BUILD rules
PiperOrigin-RevId: 547755467
2023-07-13 04:47:34 -07:00
MediaPipe Team
251c5421f6 Internal change
PiperOrigin-RevId: 547735699
2023-07-13 02:53:16 -07:00
MediaPipe Team
450c933cb5 MEDIAPIPE_NODE/SUBGRAPH_IMPLEMENTATION to use common define for registration
PiperOrigin-RevId: 547669538
2023-07-12 20:10:15 -07:00
MediaPipe Team
cc2aa4f4cc InferenceCalculatorAdvancedGL save cache in Open().
PiperOrigin-RevId: 547652481
2023-07-12 18:09:51 -07:00
MediaPipe Team
a2cd3e7f95 Internal change
PiperOrigin-RevId: 547614484
2023-07-12 15:17:40 -07:00
MediaPipe Team
37b68714b8 Internal change
PiperOrigin-RevId: 547424721
2023-07-12 01:32:51 -07:00
MediaPipe Team
3e93cbc838 Internal change
PiperOrigin-RevId: 547404737
2023-07-12 00:04:40 -07:00
Yilei Yang
917af2ce6b Internal change
PiperOrigin-RevId: 547346939
2023-07-11 17:52:07 -07:00
Sebastian Schmidt
f2f49b9fc8 Add angle to BoundingBox
PiperOrigin-RevId: 547321781
2023-07-11 16:00:35 -07:00
MediaPipe Team
aabf61f28d Internal Change
PiperOrigin-RevId: 547299595
2023-07-11 14:35:18 -07:00
MediaPipe Team
56bc019819 Model Maker allow core dataset library to handle datasets with unknown sizes.
PiperOrigin-RevId: 547268411
2023-07-11 12:47:37 -07:00
MediaPipe Team
4788fddde9 Internal Change
PiperOrigin-RevId: 547265380
2023-07-11 12:34:32 -07:00
MediaPipe Team
e4ec4d2526 Internal change
PiperOrigin-RevId: 547258228
2023-07-11 12:05:58 -07:00
MediaPipe Team
bf6561ce91 add symmetric color style option
PiperOrigin-RevId: 547069284
2023-07-10 21:41:01 -07:00
MediaPipe Team
0bde987a38 Removed internal dependency on OpenCV 3.x, migrating it to OpenCV 4.x
PiperOrigin-RevId: 546945166
2023-07-10 12:17:54 -07:00
Copybara-Service
df3f4167ae Merge pull request from priankakariatyml:ios-orientation-fix
PiperOrigin-RevId: 546358930
2023-07-07 12:56:39 -07:00
Sebastian Schmidt
03bc9d64f2 Update glog to 0.6
PiperOrigin-RevId: 546349096
2023-07-07 12:22:13 -07:00
MediaPipe Team
d45b15ef84 Add face landmarks connections for C++.
PiperOrigin-RevId: 546345842
2023-07-07 12:08:09 -07:00
Sebastian Schmidt
1614c5a542 Update WASM files for 0.10.2 release
PiperOrigin-RevId: 546332490
2023-07-07 11:20:13 -07:00
Prianka Liz Kariat
cae10ea115 Updated documentation of MPImage 2023-07-07 22:03:15 +05:30
Prianka Liz Kariat
7556a3f1b4 Changed left and right image orientation angles to match iOS UIImageOrientation 2023-07-07 19:57:44 +05:30
MediaPipe Team
cb1035a9ee Internal change
PiperOrigin-RevId: 546090489
2023-07-06 14:24:31 -07:00
Yoni Ben-Meshulam
0a198d1f6a Fix a typo in proto doc.
PiperOrigin-RevId: 546049240
2023-07-06 14:20:09 -07:00
MediaPipe Team
15ee1210e5 Internal change
PiperOrigin-RevId: 546035969
2023-07-06 10:58:20 -07:00
Copybara-Service
a851863e9c Merge pull request from priankakariatyml:ios-image-segmenter-container-utils
PiperOrigin-RevId: 546018332
2023-07-06 09:57:59 -07:00
Prianka Liz Kariat
823d5b39af Fixed typo 2023-07-06 18:46:01 +05:30
Sebastian Schmidt
9861b3c8a8 Fix bounds calculation in RefineLandmarksFromHeatMapCalculator
Fixes https://github.com/google/mediapipe/issues/4414

PiperOrigin-RevId: 545794151
2023-07-05 14:58:36 -07:00
MediaPipe Team
74f484d96d Internal change
PiperOrigin-RevId: 545658434
2023-07-05 07:09:40 -07:00
MediaPipe Team
dbe8e40124 Internal change
PiperOrigin-RevId: 545045282
2023-07-03 10:04:19 -07:00
Prianka Liz Kariat
9b7e233fe3 Added Image Segmenter Result Helpers 2023-07-03 20:48:29 +05:30
Prianka Liz Kariat
cebb0a2c2e Added iOS Image Segmenter Options Helpers 2023-07-03 20:48:15 +05:30
MediaPipe Team
7ba21e9a9a Revert Add location info in registry (debug mode only)
PiperOrigin-RevId: 544842663
2023-07-01 01:11:02 -07:00
MediaPipe Team
422556c4a3 Internal change
PiperOrigin-RevId: 544663494
2023-06-30 08:34:32 -07:00
Jiuqiang Tang
6c7aa8a0d6 Internal change
PiperOrigin-RevId: 544563029
2023-06-29 23:05:37 -07:00
MediaPipe Team
687075e5b8 Add gpu to cpu fallback for tensors_to_detections_calculator.
PiperOrigin-RevId: 544480883
2023-06-29 15:36:33 -07:00
MediaPipe Team
0ea54b1461 Add delegate options to base options for java API. and add unit tset for BaseOptions.
PiperOrigin-RevId: 544458644
2023-06-29 14:13:46 -07:00
MediaPipe Team
e15d5a797b Do not send PreviousLoopback output packets to closed streams
PiperOrigin-RevId: 544449979
2023-06-29 13:44:56 -07:00
MediaPipe Team
52cea59d41 Add keys for the context that better match the featurelist for text.
PiperOrigin-RevId: 544430289
2023-06-29 12:29:49 -07:00
MediaPipe Team
0bb4ee8941 Add MobileNetV2_I320 and MobileNetMultiHWAVG_I384 to support larger input image sizes.
PiperOrigin-RevId: 544393692
2023-06-29 10:24:52 -07:00
MediaPipe Team
8278dbc38f Exposes OpenCV photo lib.
PiperOrigin-RevId: 544092832
2023-06-28 10:22:07 -07:00
MediaPipe Team
1ee55d1f1b Support ExBert training and option to select between AdamW and LAMB optimizers for BertClassifier
PiperOrigin-RevId: 543905014
2023-06-27 18:05:15 -07:00
MediaPipe Team
bed624f3b6 Shows the recently added warning when WaitUntilIdle is called with source nodes only once. Otherwise, it is very spammy as it's shown every frame. Moreover, display the names of the sources, so the warning is more actionable.
PiperOrigin-RevId: 543676454
2023-06-27 02:03:04 -07:00
MediaPipe Team
c8c5f3d062 Internal change
PiperOrigin-RevId: 543602625
2023-06-26 18:57:21 -07:00
MediaPipe Team
9de1b2577f Internal update
PiperOrigin-RevId: 543508346
2023-06-26 12:26:51 -07:00
MediaPipe Team
570880190b Internal change for proto library outputs.
PiperOrigin-RevId: 543368974
2023-06-26 01:52:50 -07:00
Copybara-Service
5d19a46956 Merge pull request from priankakariatyml:ios-segmentation-mask
PiperOrigin-RevId: 543295371
2023-06-25 17:37:35 -07:00
Copybara-Service
80a02f8f38 Merge pull request from priankakariatyml:ios-image-segmenter-containers
PiperOrigin-RevId: 542931120
2023-06-23 12:42:56 -07:00
Copybara-Service
0093f2040b Merge pull request from priankakariatyml:ios-running-mode-copy-fix
PiperOrigin-RevId: 542930036
2023-06-23 12:38:34 -07:00
Prianka Liz Kariat
3d79d58286 Updated variable name 2023-06-23 20:18:41 +05:30
Prianka Liz Kariat
bfb68491af Added copying of running mode in NSCopying implementation in iOS tasks 2023-06-23 20:13:29 +05:30
Prianka Liz Kariat
5dce8f283d Updated image segmenter delegate method to be required 2023-06-23 20:10:42 +05:30
Prianka Liz Kariat
7623c5a941 Added iOS Image Segmenter Options 2023-06-23 20:09:18 +05:30
Prianka Liz Kariat
7fe365489d Added iOS Image Segmenter Result 2023-06-23 20:09:05 +05:30
MediaPipe Team
a8899da45a Fix -Wsign-compare warning in api2/builder.h
PiperOrigin-RevId: 542673286
2023-06-22 14:49:23 -07:00
MediaPipe Team
4e862995ba Fix typo
PiperOrigin-RevId: 542660548
2023-06-22 14:02:16 -07:00
MediaPipe Team
2f5fc16a38 Fix timestamp computation when copying within first block.
When computing the last copied sample's timestamp, first_block_offset_ needs to be taken into account.

PiperOrigin-RevId: 542643291
2023-06-22 13:03:36 -07:00
Jiuqiang Tang
98d493f37a Add MatrixData as a packet option for ConstantSidePacketCalculatorOptions.
PiperOrigin-RevId: 542616847
2023-06-22 11:28:07 -07:00
MediaPipe Team
ba7e0e0e50 Add a face alignment preprocessor to face stylizer.
PiperOrigin-RevId: 542559764
2023-06-22 07:59:52 -07:00
Prianka Liz Kariat
7f39153ff3 Added MPPMask Tests 2023-06-22 17:44:07 +05:30
MediaPipe Team
825e3a8af0 Speed up TimeSeriesFramerCalculator.
Currently, TimeSeriesFramerCalculator constructs a distinct Matrix object for every input sample, which is inefficient. This CL revises buffering to keep each input packet's worth of samples as one grouped Matrix. A benchmark is added, showing a speed up of about 20x.

```
name                               old      new
BM_TimeSeriesFramerCalculator  48.45ms   2.26ms
```

PiperOrigin-RevId: 542462618
2023-06-21 23:03:54 -07:00
MediaPipe Team
0d2548cd65 Internal change
PiperOrigin-RevId: 542392817
2023-06-21 16:23:43 -07:00
MediaPipe Team
c86d80a031 Internal Changes
PiperOrigin-RevId: 542387813
2023-06-21 16:02:54 -07:00
MediaPipe Team
895c685df6 1. Model maker core classifier change _metric_function field to _metric_functions in order to support having multiple metrics.
2. Add SparsePrecision, SparseRecall, BinarySparsePrecisionAtRecall, and BinarySparseRecallAtPrecision to the shared metrics library.
3. Add SparsePrecision, SparseRecall to text classifier, and have the option to evaluate the model with BinarySparsePrecisionAtRecall and BinarySparseRecallAtPrecision

PiperOrigin-RevId: 542376451
2023-06-21 15:19:29 -07:00
MediaPipe Team
7edb6b8fcb add concatenate image vector calculator
PiperOrigin-RevId: 542084345
2023-06-20 16:40:11 -07:00
MediaPipe Team
0b6ff84e3c update face drawing function.
PiperOrigin-RevId: 542083042
2023-06-20 16:34:27 -07:00
Sebastian Schmidt
ef6aeb8828 Allow passing of HParams to MediaPipe training docker
PiperOrigin-RevId: 542052304
2023-06-20 14:39:38 -07:00
MediaPipe Team
86bc764b6e This will fix typos in tasks internal files.
PiperOrigin-RevId: 541945726
2023-06-20 09:18:01 -07:00
Copybara-Service
bd3a8d885d Merge pull request from priankakariatyml:ios-segmentation-mask
PiperOrigin-RevId: 541944396
2023-06-20 09:12:53 -07:00
MediaPipe Team
35c79b755e update face drawing function.
PiperOrigin-RevId: 541055040
2023-06-16 17:46:11 -07:00
MediaPipe Team
80208079d2 Use GFile for internal file systems.
PiperOrigin-RevId: 541041972
2023-06-16 16:45:56 -07:00
Copybara-Service
41215a3878 Merge pull request from priankakariatyml:ios-hand-landmarker-tests
PiperOrigin-RevId: 540995916
2023-06-16 14:07:49 -07:00
Sebastian Schmidt
c5b1edd709 Add "exports" field definitions to package.json
Fixes https://github.com/google/mediapipe/issues/4547

PiperOrigin-RevId: 540977469
2023-06-16 13:14:09 -07:00
Prianka Liz Kariat
d12dd88f51 Fixed implementation of init methods in MPPMask 2023-06-16 20:00:30 +05:30
Prianka Liz Kariat
4ab1a5de1b Reverted changes to iOS tasks deployment target 2023-06-16 19:59:59 +05:30
Prianka Liz Kariat
fec2fc77e0 Revert "Revert "Updated init method implementations in MPPMask""
This reverts commit 52f6b8d899.
2023-06-16 19:56:32 +05:30
Prianka Liz Kariat
52f6b8d899 Revert "Updated init method implementations in MPPMask"
This reverts commit 83486ed01b.
2023-06-16 19:56:23 +05:30
Prianka Liz Kariat
83486ed01b Updated init method implementations in MPPMask 2023-06-16 19:56:04 +05:30
MediaPipe Team
6f065bc405 Update Tensorflow dependency in MediaPipe
PiperOrigin-RevId: 540619536
2023-06-15 10:23:20 -07:00
Sebastian Schmidt
e73ea23261 Internal change
PiperOrigin-RevId: 540603621
2023-06-15 09:26:01 -07:00
Prianka Liz Kariat
1f77fa9de4 Removed generic methods for alloc and memcpy from MPPMask 2023-06-15 16:07:56 +05:30
Prianka Liz Kariat
327547ec2b Updated variable names in MPPMask 2023-06-15 14:16:34 +05:30
Prianka Liz Kariat
9d0fed89ff Fixed documentation in MPPMask 2023-06-15 14:11:08 +05:30
Prianka Liz Kariat
aa1ab18000 Updated documentation in MPPMask 2023-06-15 14:09:22 +05:30
Prianka Liz Kariat
a7f555fcc2 Fixed float calculations in MPPMask 2023-06-15 14:07:33 +05:30
Prianka Liz Kariat
c8f85ac060 Updated signature of initializer in MPPMask 2023-06-15 14:06:52 +05:30
MediaPipe Team
2e48a0bce0 Remove designated initializers
PiperOrigin-RevId: 540471772
2023-06-14 22:17:20 -07:00
MediaPipe Team
e02d70f8e5 internal change
PiperOrigin-RevId: 540404812
2023-06-14 16:00:00 -07:00
Copybara-Service
a2d4566845 Merge pull request from priankakariatyml:ios-hand-landmarker-updates
PiperOrigin-RevId: 540393678
2023-06-14 15:16:14 -07:00
MediaPipe Team
4776ecf402 Internal change
PiperOrigin-RevId: 540361672
2023-06-14 13:23:36 -07:00
MediaPipe Team
a1be5f3e72 Add a test case for "summary packet" to test failing upstream calculator
PiperOrigin-RevId: 540331486
2023-06-14 11:34:17 -07:00
MediaPipe Team
66a29bf371 Internal change
PiperOrigin-RevId: 540327302
2023-06-14 11:23:51 -07:00
Prianka Liz Kariat
9ed7acc0a3 Updated hand connections in iOS hand landmarker to class properties. 2023-06-14 15:59:54 +05:30
Prianka Liz Kariat
94a9464750 Fixed formatting in MPPHandLandmarkerTests.m 2023-06-14 15:52:26 +05:30
Prianka Liz Kariat
0ae27fad37 Updated iOS hand landmarker tests 2023-06-14 15:51:41 +05:30
Prianka Liz Kariat
dffca9e3b5 Updated protobuf helper method name in iOS Gesture Recognizer Helpers 2023-06-14 15:51:06 +05:30
Prianka Liz Kariat
086798e677 Merge branch 'master' into ios-hand-landmarker-tests 2023-06-14 15:35:02 +05:30
Prianka Liz Kariat
43e51c1094 Added live stream mode tests for iOS Hand Landmarker 2023-06-14 15:34:32 +05:30
Yuqi Li
eaeca82b76 Internal change
PiperOrigin-RevId: 540134258
2023-06-13 18:41:30 -07:00
MediaPipe Team
3742bc8c1b Add metadata for all PREFIX/image... prefixes.
PiperOrigin-RevId: 540117214
2023-06-13 17:12:17 -07:00
MediaPipe Team
02d55dfb0a Modify the TensorToImageFrameCalculator to support normalized outputs.
PiperOrigin-RevId: 540104988
2023-06-13 16:20:42 -07:00
MediaPipe Team
b97d11fa76 Internal MediaPipe Tasks change
PiperOrigin-RevId: 540083633
2023-06-13 15:05:04 -07:00
Copybara-Service
6cf7148f3b Merge pull request from priankakariatyml:ios-hand-landmarker-tests
PiperOrigin-RevId: 540030514
2023-06-13 11:58:26 -07:00
Prianka Liz Kariat
2cdb291e54 Removed core video import 2023-06-13 22:29:15 +05:30
Prianka Liz Kariat
dddbcc4449 Updated data types of width and height 2023-06-13 22:28:09 +05:30
MediaPipe Team
e468bee584 Deprecate GraphStatus()
PiperOrigin-RevId: 539992850
2023-06-13 09:54:22 -07:00
Prianka Liz Kariat
5e2bb0e1db Updated documentation of MPPMask 2023-06-13 22:19:40 +05:30
Prianka Liz Kariat
de9acdfa68 Added iOS segmentation mask 2023-06-13 22:17:41 +05:30
MediaPipe Team
b19b80e10f Add support for int64 constant side package value.
PiperOrigin-RevId: 539893314
2023-06-13 01:53:13 -07:00
MediaPipe Team
96cc0fd07b Internal change
PiperOrigin-RevId: 539719443
2023-06-12 11:53:48 -07:00
MediaPipe Team
fe0d1b1e83 Internal change
PiperOrigin-RevId: 539675912
2023-06-12 09:28:26 -07:00
Sebastian Schmidt
8a2ec518de Use .mjs for ESM Modules and use .cjs for CommonJS
PiperOrigin-RevId: 539664711
2023-06-12 08:45:01 -07:00
Prianka Liz Kariat
baa79046b9 Added iOS Objective C hand landmarker tests 2023-06-12 19:56:34 +05:30
Prianka Liz Kariat
eff56045e4 Added hand landmarker protobuf utils 2023-06-12 19:56:20 +05:30
MediaPipe Team
ac4f60a793 Annotate in model input scale for InteractiveSegmenter
PiperOrigin-RevId: 539245617
2023-06-09 21:13:20 -07:00
MediaPipe Team
1d4a205c2e Internal change
PiperOrigin-RevId: 539220863
2023-06-09 18:06:50 -07:00
MediaPipe Team
53f0736bf0 Add an option to disable explicit CPU sync for ExternalTextureRenderer
PiperOrigin-RevId: 539166965
2023-06-09 13:42:14 -07:00
Sebastian Schmidt
67c5d8d224 Add FaceLandmarker constants for iOS
PiperOrigin-RevId: 539160195
2023-06-09 13:15:26 -07:00
Copybara-Service
fb47218e10 Merge pull request from priankakariatyml:ios-hand-landmarker-implementation
PiperOrigin-RevId: 539145005
2023-06-09 12:12:42 -07:00
Prianka Liz Kariat
f528fa5de2 Updated constant names in MPPHandLandmarkConnections 2023-06-09 17:30:23 +05:30
Copybara-Service
4c4a1d93b2 Merge pull request from priankakariatyml:ios-gesture-recognizer-add-tests
PiperOrigin-RevId: 538848389
2023-06-08 11:48:18 -07:00
Prianka Liz Kariat
f63c00b3c6 Added hand landmarker implementation file and hand landmarker connections 2023-06-08 18:09:42 +05:30
MediaPipe Team
943445fba8 Update base audio/vision tasks api to suuport proto3 graph options.
PiperOrigin-RevId: 538661975
2023-06-07 20:04:33 -07:00
Sebastian Schmidt
a7cd7b9a32 Add CommonJS bundle for MediaPipe Tasks
Fixes https://github.com/google/mediapipe/issues/4398

PiperOrigin-RevId: 538539711
2023-06-07 11:12:37 -07:00
Ilya Tokar
489e927410 Fix tests to work with arch haswell/sandybridge.
PiperOrigin-RevId: 538538356
2023-06-07 11:07:49 -07:00
Prianka Liz Kariat
10144a805a Added more tests to MPPGestureRecognizerTests.mm 2023-06-07 18:45:37 +05:30
Prianka Liz Kariat
8a5b443b86 Fixed typos in method names 2023-06-07 18:44:54 +05:30
MediaPipe Team
4b0f3cacae Internal change
PiperOrigin-RevId: 538313290
2023-06-06 15:52:55 -07:00
Sebastian Schmidt
d6f34f6aef Log the Bazel build
PiperOrigin-RevId: 538308030
2023-06-06 15:31:33 -07:00
Sebastian Schmidt
4a123445c4 Update rules_foreign_cc
Fixes https://github.com/google/mediapipe/issues/4365

PiperOrigin-RevId: 538301543
2023-06-06 15:08:00 -07:00
Sebastian Schmidt
d063ed2c1e Rename MPPFaceLandmarker.m to MPPFaceLandmarker.mm
PiperOrigin-RevId: 538281740
2023-06-06 13:52:23 -07:00
Copybara-Service
c71673d712 Merge pull request from priankakariatyml:ios-gesture-recognizer-tests
PiperOrigin-RevId: 538259988
2023-06-06 12:31:10 -07:00
Copybara-Service
70e00b4dbe Merge pull request from priankakariatyml:ios-hand-landmarker-utils
PiperOrigin-RevId: 538238944
2023-06-06 11:17:45 -07:00
Fergus Henderson
709eb812cc Internal change
PiperOrigin-RevId: 538215311
2023-06-06 10:00:52 -07:00
MediaPipe Team
37290f0224 Port StreamToSidePacketCalculator to api2
PiperOrigin-RevId: 538109898
2023-06-06 01:34:43 -07:00
MediaPipe Team
ab72fccca7 Internal change
PiperOrigin-RevId: 537928827
2023-06-05 11:14:28 -07:00
Prianka Liz Kariat
d256a3e670 Updated dictionary to generics in iOS gesture recognizer tests 2023-06-05 21:13:04 +05:30
Prianka Liz Kariat
f213e0a6f3 Fixed typos 2023-06-05 13:47:11 +05:30
Prianka Liz Kariat
1496b7c2d4 Updated MPPGestureRecognizer tests to use generics 2023-06-05 13:40:56 +05:30
Prianka Liz Kariat
32195e6a83 Updated MPPGestureRecognizerTests to use generics for file path dicts 2023-06-05 13:39:44 +05:30
Prianka Liz Kariat
e1d8854388 Merge branch 'master' into ios-gesture-recognizer-tests 2023-06-05 13:27:44 +05:30
Prianka Liz Kariat
db0da30f18 Updated comments 2023-06-05 13:26:17 +05:30
Prianka Liz Kariat
56a035cb1b Updated method names in MPPGestureRecognizer 2023-06-05 13:21:39 +05:30
Prianka Liz Kariat
0c2a7bee09 Update iOS Gesture Recognizer error assertion 2023-06-05 13:19:39 +05:30
MediaPipe Team
cbf1d97429 Internal change
PiperOrigin-RevId: 537613648
2023-06-03 20:19:16 -07:00
Sebastian Schmidt
549e09cace Add FaceLandmarker iOS Live Stream API
PiperOrigin-RevId: 537434786
2023-06-02 16:22:20 -07:00
Sebastian Schmidt
ace56b502a Add FaceLandmarker iOS API
PiperOrigin-RevId: 537424705
2023-06-02 15:35:48 -07:00
Sebastian Schmidt
5f50ac371f Internal
PiperOrigin-RevId: 537420663
2023-06-02 15:15:44 -07:00
Sebastian Schmidt
91a3c54d55 Internal change
PiperOrigin-RevId: 537405687
2023-06-02 14:12:35 -07:00
MediaPipe Team
b69f93fca6 Internal change
PiperOrigin-RevId: 537381138
2023-06-02 12:31:55 -07:00
Copybara-Service
09bad328ad Merge pull request from priankakariatyml:ios-delegate-fixes
PiperOrigin-RevId: 537369166
2023-06-02 11:49:18 -07:00
MediaPipe Team
280bd320b4 Fix more OSS warnings and build errors
-Wc++98-compat-extra-semi
* in type_map.h

-Winconsistent-missing-override
* in gl_texture_buffer.h

-Wdeprecated-declarations
* usage of (absl) Status in
  * status_util.cc
  * api2/packet.h
  * output_stream_shard.cc

-Wimplicit-const-int-float-conversion
* Adds a static_cast to handle the precision loss when converting from large ints to floating point

ANNOTATE_THREAD_NAME
* explicitly uses ABSL_ANNOTATE_THREAD_NAME instead. This is useful in Chromium's build where there are multiple ANNOTATE_THREAD_NAME symbols

Also ran clang-format over all of each edited file

PiperOrigin-RevId: 537351290
2023-06-02 10:46:42 -07:00
MediaPipe Team
9045a74ba3 Internal change
PiperOrigin-RevId: 537175065
2023-06-01 17:48:03 -07:00
Joe Fernandez
a6e63fa320 Adding redirects for old pages and updating pages for upgraded legacy solutions
PiperOrigin-RevId: 537145433
2023-06-01 15:31:42 -07:00
MediaPipe Team
15aff443b1 Internal change
PiperOrigin-RevId: 537089863
2023-06-01 12:00:44 -07:00
Sebastian Schmidt
194a301dd8 Update WASM files for 0.10.1 release
PiperOrigin-RevId: 537078723
2023-06-01 11:22:40 -07:00
Prianka Liz Kariat
9356dfcd46 Updated MPPHandLandmarker.h to return the hand connections via class mathods 2023-06-01 16:53:32 +05:30
Prianka Liz Kariat
e2f899e151 Updated documentation in MPPHandLandmarkResult+Helpers.h 2023-06-01 16:44:57 +05:30
Prianka Liz Kariat
961afc8928 Updated documentation in MPPHandLandmarkerResult Helpers 2023-06-01 16:43:33 +05:30
Paul Wankadia
f21ee4c197 Update MediaPipe to RE2 release 2023-06-01.
Note that RE2 has taken a dependency on Abseil, so the `main` branch
should be used from now on. The `abseil` branch will go away soon...

PiperOrigin-RevId: 536829679
2023-05-31 14:52:24 -07:00
Prianka Liz Kariat
77bb5e7202 Fixed import in iOS gesture recognizer test utils 2023-05-31 20:53:36 +05:30
Prianka Liz Kariat
ebeffc27eb Renamed iOS gesture recognizer protobuf utils 2023-05-31 20:51:43 +05:30
Prianka Liz Kariat
4326c97c95 Added MPPHandLandmark 2023-05-31 20:44:35 +05:30
Prianka Liz Kariat
0c33601510 Added MPPHandLandmarker 2023-05-31 20:44:25 +05:30
Prianka Liz Kariat
ad499c170a Added MPPConnection 2023-05-31 20:43:24 +05:30
Prianka Liz Kariat
71f2f8f43b Added MPPHandLandmarkerResult Helpers 2023-05-31 20:42:49 +05:30
Prianka Liz Kariat
955489d71d Removed a test from iOS ObjC Gesture Recognizer tests 2023-05-31 20:39:01 +05:30
Prianka Liz Kariat
e3b03866dc Removed unwanted import from MPPImageClassifier.h 2023-05-31 20:35:12 +05:30
Prianka Liz Kariat
f77e685ff9 Removed unwanted header import from MPPGestureRecognizer.h 2023-05-31 20:34:02 +05:30
Prianka Liz Kariat
c87e21206a Removed few test from MPPGestureRecognizerTests.m 2023-05-31 11:53:41 +05:30
Prianka Liz Kariat
365956807d Added gesture_recognizer.task to vision tasks test data 2023-05-31 11:52:29 +05:30
Prianka Liz Kariat
9546596b5a Updated variable name in MPPGestureRecognizerTests.m 2023-05-31 11:51:00 +05:30
Prianka Liz Kariat
f3f664300c Added convenience method for creating results for tests in MPPGestureRecognizerResult Helpers 2023-05-31 11:50:39 +05:30
Prianka Liz Kariat
84560f3e7d Added more recognize tests to iOS Gesture Recognizer Objective C tests 2023-05-31 11:36:29 +05:30
Prianka Liz Kariat
1e77468eec Added iOS Gesture Recognizer ObjC Test for simple recognition 2023-05-31 11:29:37 +05:30
Prianka Liz Kariat
746f466c3a Added iOS Gesture Recognizer Protobuf utils 2023-05-31 11:28:50 +05:30
Sebastian Schmidt
d76b48ec8b Add MP_DISABLE_GPU to .so target
PiperOrigin-RevId: 536537732
2023-05-30 16:18:02 -07:00
Copybara-Service
32e48dd2d9 Merge pull request from priankakariatyml:ios-gesture-recognizer-impl
PiperOrigin-RevId: 536516003
2023-05-30 14:53:04 -07:00
Sebastian Schmidt
b7c940ef8a Internal change
PiperOrigin-RevId: 536499053
2023-05-30 13:51:06 -07:00
MediaPipe Team
01cfb92e35 Add MultiLandmarksSmoothingCalculator
PiperOrigin-RevId: 536490704
2023-05-30 13:20:55 -07:00
MediaPipe Team
c73027926f Add MultiLandmarksSmoothingCalculator
PiperOrigin-RevId: 536478601
2023-05-30 12:37:05 -07:00
MediaPipe Team
a432559123 Port LandmarksSmoothingCalculator to api2
PiperOrigin-RevId: 536474279
2023-05-30 12:20:23 -07:00
Sebastian Schmidt
96357b1910 Internal change
PiperOrigin-RevId: 536457269
2023-05-30 11:21:17 -07:00
MediaPipe Team
056881f4a9 Only apply face landmarks smoothing for stream mode (VIDEO and LIVE_STREAM).
PiperOrigin-RevId: 536455842
2023-05-30 11:16:43 -07:00
Prianka Liz Kariat
aa7308498b Fixed typo 2023-05-30 23:38:04 +05:30
Copybara-Service
fabde5f129 Merge pull request from priankakariatyml:ios-hand-landmarker-containers
PiperOrigin-RevId: 536447484
2023-05-30 10:49:22 -07:00
Copybara-Service
21eeac9fd7 Merge pull request from priankakariatyml:ios-gesture-recognizer-updates
PiperOrigin-RevId: 536421680
2023-05-30 09:24:06 -07:00
Prianka Liz Kariat
b154dde19f Added iOS Gesture Recognizer implementation 2023-05-29 22:47:17 +05:30
Prianka Liz Kariat
6073d693d0 Added a method in iOS Object Detector to process packets for callbacks 2023-05-29 22:38:22 +05:30
Prianka Liz Kariat
250b11f5d1 Added a method in iOS image classifier to process result for the callback 2023-05-29 22:37:59 +05:30
MediaPipe Team
759e9fd56e Reorganize the face stylizer test data.
PiperOrigin-RevId: 536074239
2023-05-28 19:28:14 -07:00
MediaPipe Team
2e2b4d183e add “users” group to visibility
PiperOrigin-RevId: 536022725
2023-05-28 10:49:31 -07:00
MediaPipe Team
d4c7ed2217 Internal change
PiperOrigin-RevId: 535751178
2023-05-26 17:26:29 -07:00
Sebastian Schmidt
fddc3facf0 Add FaceLandmarker Result API
PiperOrigin-RevId: 535735431
2023-05-26 16:04:47 -07:00
MediaPipe Team
e483b31fcf Internal change
PiperOrigin-RevId: 535636593
2023-05-26 09:23:37 -07:00
Prianka Liz Kariat
41d0f89fd1 Updated variable names in MPPHandLandmarkerOptionsHelpers 2023-05-26 21:06:29 +05:30
Prianka Liz Kariat
2428ba49a3 Fixed typo in MPPHandLandmarkerOptions 2023-05-26 21:02:14 +05:30
Prianka Liz Kariat
881c6e2eef Fixed typo in MPPHandLandmarkerResult 2023-05-26 21:00:59 +05:30
Prianka Liz Kariat
bec7aeec22 Fixed typo in MPPHandLandmarkerOptions 2023-05-26 20:59:13 +05:30
Prianka Liz Kariat
ff064e536c Added new line 2023-05-26 20:57:32 +05:30
Prianka Liz Kariat
b442367fc9 Fixed formatting 2023-05-26 20:57:13 +05:30
Prianka Liz Kariat
23d97292a6 Updated face detector to use new methods from vision task runner 2023-05-26 18:49:24 +05:30
Prianka Liz Kariat
6fabc35ce7 Removed gesture recognizer implementation 2023-05-26 18:49:08 +05:30
Prianka Liz Kariat
ddf4d3fbd3 Added iOS hand landmarker options helpers 2023-05-26 10:58:30 +05:30
Prianka Liz Kariat
5ad7c9fd89 Added iOS hand landmarker options 2023-05-26 10:58:12 +05:30
Prianka Liz Kariat
f124cad095 Added iOS hand landmarker result 2023-05-26 10:57:58 +05:30
Copybara-Service
f4337356fe Merge pull request from priankakariatyml:ios-landmark-test-cpp-utils
PiperOrigin-RevId: 535441782
2023-05-25 17:26:30 -07:00
MediaPipe Team
e2cb327060 Give an example of the expected protoType syntax
PiperOrigin-RevId: 535413303
2023-05-25 15:47:15 -07:00
MediaPipe Team
e8f2541cbd Internal update
PiperOrigin-RevId: 535376471
2023-05-25 14:03:43 -07:00
Jiuqiang Tang
169bdf15b4 Make an option for adjusting the face alignment output image size, and add a "transformation_matrix" output stream of the face stylizer graph.
PiperOrigin-RevId: 535319310
2023-05-25 11:21:06 -07:00
MediaPipe Team
ea314ba455 Fix license typos.
PiperOrigin-RevId: 535309354
2023-05-25 10:53:37 -07:00
Sebastian Schmidt
c7703bfb21 Add FaceLandmarkerOptions API
PiperOrigin-RevId: 535292669
2023-05-25 10:05:08 -07:00
Prianka Liz Kariat
1ec4ae44a5 Added C++ utils for parsing protos from text files for iOS tests. 2023-05-25 20:53:07 +05:30
Prianka Liz Kariat
52f3333cc1 Added MPPGesture Recognizer implementation 2023-05-25 20:44:16 +05:30
Prianka Liz Kariat
e6fd39b3ee Updated the vision task runner to split the method that creates normalized rect based on ROI 2023-05-25 20:43:51 +05:30
Prianka Liz Kariat
9483ac4651 Updated iOS gesture recognizer results to initialize hand gestures with a default index 2023-05-25 20:42:24 +05:30
Khanh LeViet
952021f497 Remove unused MediaPipe Tasks Android sample
PiperOrigin-RevId: 535259478
2023-05-25 08:05:39 -07:00
MediaPipe Team
3ac903787a Internal change
PiperOrigin-RevId: 535162357
2023-05-25 01:49:30 -07:00
Copybara-Service
034caf3d87 Merge pull request from kinaryml:python-gpu-support
PiperOrigin-RevId: 535133616
2023-05-24 23:53:00 -07:00
Sebastian Schmidt
1baf72e46b Internal change
PiperOrigin-RevId: 535131938
2023-05-24 23:45:16 -07:00
MediaPipe Team
7800d238e9 add needed enum type for choose fuse pipeline.
PiperOrigin-RevId: 535076733
2023-05-24 20:17:54 -07:00
MediaPipe Team
c8ee09796b Internal change
PiperOrigin-RevId: 534959867
2023-05-24 13:26:53 -07:00
Copybara-Service
b84e6f97dd Merge pull request from priankakariatyml:ios-code-review-fixes
PiperOrigin-RevId: 534957807
2023-05-24 13:22:31 -07:00
Sebastian Schmidt
a7b81c7d10 Change "numberOfHands" property name to "numHands".
PiperOrigin-RevId: 534927982
2023-05-24 11:54:47 -07:00
Jiuqiang Tang
7facc925ba Allow FaceStylizerGraph to miss base options.
Fix the color issue when the graph is running on gpu and "face alignment only" mode.

PiperOrigin-RevId: 534912498
2023-05-24 11:14:30 -07:00
Sebastian Schmidt
acfaf3f1b6 Add unit test for FaceDetector iOS
PiperOrigin-RevId: 534874603
2023-05-24 09:40:08 -07:00
Sebastian Schmidt
d9f316e12a Rename ObjectDetctionResult to ObjectDetectorResult
PiperOrigin-RevId: 534858600
2023-05-24 09:00:00 -07:00
Sebastian Schmidt
2017fcc9ab Add FaceDetector iOS API
PiperOrigin-RevId: 534858193
2023-05-24 08:55:03 -07:00
Prianka Liz Kariat
1aa44abcab Revert "Added support to set delegates in MPPBaseOptions"
This reverts commit 1e1693d9aa.
2023-05-24 20:25:45 +05:30
Prianka Liz Kariat
8f1a56f3c2 Fixed typos 2023-05-24 20:24:41 +05:30
Prianka Liz Kariat
1e1693d9aa Added support to set delegates in MPPBaseOptions 2023-05-24 20:24:34 +05:30
Prianka Liz Kariat
e2e90dcac6 Merge branch 'master' into ios-code-review-fixes 2023-05-24 19:57:46 +05:30
Prianka Liz Kariat
69017381af Updated MPPObjectDetectorResult Helpers to return empty result instead of nil 2023-05-24 19:57:38 +05:30
MediaPipe Team
bc035d9146 This will fix the multiple typos in the tasks files.
PiperOrigin-RevId: 534679277
2023-05-23 21:49:34 -07:00
MediaPipe Team
201b2d739d Fix c++98-compat-extra-semi warnings
PiperOrigin-RevId: 534624086
2023-05-23 18:03:29 -07:00
MediaPipe Team
3dcfca3a73 Fix deprecated usages
* In status_builder.h to use absl::Status directly
* In type_map.h to use kTypeId.hash_code() directly

PiperOrigin-RevId: 534622923
2023-05-23 17:58:58 -07:00
Sebastian Schmidt
e8ee934bf9 Use empty keypoint array for Detection if no keypoints are detected
PiperOrigin-RevId: 534572162
2023-05-23 15:10:00 -07:00
Copybara-Service
1523cc48a1 Merge pull request from priankakariatyml:ios-code-review-fixes
PiperOrigin-RevId: 534526451
2023-05-23 12:55:35 -07:00
Sebastian Schmidt
1fe78180c8 Add quality scores to Segmenter tasks
PiperOrigin-RevId: 534497957
2023-05-23 11:37:26 -07:00
Prianka Liz Kariat
3eb97ae1ff Updated Image classifier result to return empty results if packet can't be validated. 2023-05-23 20:54:42 +05:30
Prianka Liz Kariat
fda001b666 Updated error tests to use XCTAssertEqualObjects 2023-05-23 19:31:14 +05:30
Sebastian Schmidt
87f525c76b Internal change
PiperOrigin-RevId: 534264040
2023-05-22 20:01:41 -07:00
Sebastian Schmidt
51730ec25c Add iOS support for MPMask
PiperOrigin-RevId: 534155657
2023-05-22 13:00:05 -07:00
MediaPipe Team
102cffdf4c Add some helpful error messages in case GL texture creation fails.
PiperOrigin-RevId: 534029187
2023-05-22 05:03:51 -07:00
Sebastian Schmidt
7c28c5d58f Fix rendering of MPMask and MPImage clone
PiperOrigin-RevId: 533551170
2023-05-19 14:26:18 -07:00
Copybara-Service
a6457d87b2 Merge pull request from priankakariatyml:ios-remove-delegate
PiperOrigin-RevId: 533472159
2023-05-19 09:24:26 -07:00
Copybara-Service
9044d62f61 Merge pull request from priankakariatyml:ios-gesture-recognizer-files
PiperOrigin-RevId: 533471803
2023-05-19 09:19:20 -07:00
Prianka Liz Kariat
f219829b1d Removed support for Delegates from iOS 2023-05-19 17:42:57 +05:30
MediaPipe Team
937a6b1422 Internal change
PiperOrigin-RevId: 533327411
2023-05-18 20:19:42 -07:00
MediaPipe Team
c248525eeb internal update
PiperOrigin-RevId: 533197055
2023-05-18 11:39:35 -07:00
MediaPipe Team
a1755044ea Internal change
PiperOrigin-RevId: 533187060
2023-05-18 11:10:42 -07:00
MediaPipe Team
03b901a443 Internal change
PiperOrigin-RevId: 533150010
2023-05-18 09:16:35 -07:00
Kinar R
b5148c8ce3
Update setup.py 2023-05-18 18:32:45 +05:30
Kinar R
01fdeaf1e1
Update Dockerfile 2023-05-18 18:29:22 +05:30
Kinar R
6100f0e76e
Update base_options.py 2023-05-18 18:09:39 +05:30
Kinar R
f63baaf8d2
Update BUILD 2023-05-18 18:08:04 +05:30
Kinar R
b5072c59e7
Update BUILD 2023-05-18 15:41:08 +05:30
Kinar R
14dba421c4
Update BUILD 2023-05-18 13:23:44 +05:30
Kinar R
620ff3508a
Update BUILD 2023-05-18 12:51:08 +05:30
Kinar R
126df20658
Included CPU binary graphs in setup.py 2023-05-18 11:00:12 +05:30
Prianka Liz Kariat
bb5fcc2d64 Fixed Typos 2023-05-18 10:00:31 +05:30
Prianka Liz Kariat
e905a9fe39 Removed roi methods from MPPGestureRecognizer 2023-05-18 09:52:23 +05:30
Rachel Hornung
25458138a9 #MediaPipe Add ConcatenateStringVectorCalculator.
PiperOrigin-RevId: 532956844
2023-05-17 17:11:20 -07:00
MediaPipe Team
02230f65d1 Internal change
PiperOrigin-RevId: 532934867
2023-05-17 15:54:32 -07:00
Sebastian Schmidt
1fb98f5ebd Don't double build ARM64 arch on M1 Macs
PiperOrigin-RevId: 532934646
2023-05-17 15:50:05 -07:00
Sebastian Schmidt
a4d0e68bee Internal change
PiperOrigin-RevId: 532890317
2023-05-17 13:37:25 -07:00
Prianka Liz Kariat
dc7c018b39 Added clearing of all graph options protos in MPPGestureRecognizerOptions Helpers 2023-05-17 22:03:10 +05:30
Prianka Liz Kariat
d6d5a94845 Reverted copy of gesture recognizer result containers 2023-05-17 21:59:26 +05:30
Prianka Liz Kariat
36b7514b19 Removed srcs in MPPGestureRecognizer target 2023-05-17 21:56:31 +05:30
Prianka Liz Kariat
dcb0414d4b Added MPPGestureRecognizer header 2023-05-17 21:53:25 +05:30
Prianka Liz Kariat
501b4bbc7b Added MPPGestureRecognizerResultHelpers 2023-05-17 21:52:05 +05:30
Prianka Liz Kariat
ebd1545506 Added MPPGestureRecognizerOptionsHelpers 2023-05-17 21:51:40 +05:30
Prianka Liz Kariat
a4c280310b Added delegates in iOS gesture recognizer options 2023-05-17 21:50:53 +05:30
Prianka Liz Kariat
ae2901459d Updated property types in MPPGestureRecognizerResult 2023-05-17 21:50:11 +05:30
kinaryml
45addac249 Testing MediaPipe Python with GPU support 2023-05-17 10:55:40 +05:30
vrabaud
4f8520af10 Internal change
PiperOrigin-RevId: 532611846
2023-05-16 16:48:54 -07:00
MediaPipe Team
5af496201b internal updating of flatbuffers
PiperOrigin-RevId: 532601578
2023-05-16 16:08:39 -07:00
MediaPipe Team
609a57f167 Internal change
PiperOrigin-RevId: 532597768
2023-05-16 15:56:25 -07:00
Copybara-Service
7eb5cab22d Merge pull request from priankakariatyml:ios-remove-opencv-dep
PiperOrigin-RevId: 532553181
2023-05-16 13:15:53 -07:00
Sebastian Schmidt
024f782cd9 Warn users that do not invoke "close()"
PiperOrigin-RevId: 532507235
2023-05-16 10:50:38 -07:00
Sebastian Schmidt
d53fbf2aeb Update links in README.md
PiperOrigin-RevId: 532506851
2023-05-16 10:45:30 -07:00
Sebastian Schmidt
8bf6c63e92 Write TFLite model to Wasm file system
PiperOrigin-RevId: 532482502
2023-05-16 09:25:44 -07:00
MediaPipe Team
d7fa4b95b5 Internal change.
PiperOrigin-RevId: 532474319
2023-05-16 08:56:30 -07:00
MediaPipe Team
e0eef9791e Internal change
PiperOrigin-RevId: 532113907
2023-05-15 08:06:33 -07:00
MediaPipe Team
fc9538533c Improve loop calculator documentation and add additional specializations
The documentation is confusing since it was unclear where e.g. BeginLoopWithIterableCalculator comes from. Also, input_to_loop_body wasn't connected to anything. loop_internal_ts is more confusing than helpful. This CL cleans up the docs. It also adds specializations for CPU image and GPU texture buffers to be used for the recompose effect.

PiperOrigin-RevId: 532083714
2023-05-15 05:58:58 -07:00
MediaPipe Team
12ba644393 Internal change
PiperOrigin-RevId: 531582116
2023-05-12 12:57:28 -07:00
Copybara-Service
c7ba201e6a Merge pull request from priankakariatyml:ios-image-classifier-async-fixes
PiperOrigin-RevId: 531517080
2023-05-12 08:50:14 -07:00
Copybara-Service
785f549130 Merge pull request from priankakariatyml:ios-typo-fixes
PiperOrigin-RevId: 531223233
2023-05-11 09:26:08 -07:00
Prianka Liz Kariat
4c32ff493e Fixed typo in MPPObjectDetectorOptions 2023-05-11 14:04:40 +05:30
MediaPipe Team
64af919107 Internal change
PiperOrigin-RevId: 531007009
2023-05-10 14:38:19 -07:00
Sebastian Schmidt
1666f3ed80 Add .close() method to ImageSegmenterResult/InteractiveSegmenterResult/PoseLandmarkerResult
PiperOrigin-RevId: 530973944
2023-05-10 12:37:48 -07:00
Prianka Liz Kariat
419701c615 Removed opencv dependency from MPPVIsionTaskRunner 2023-05-10 13:09:44 +05:30
Mark McDonald
a7ede9235c Internal change
PiperOrigin-RevId: 530806084
2023-05-09 22:34:07 -07:00
MediaPipe Team
ea1643f7f8 Internal update
PiperOrigin-RevId: 530777692
2023-05-09 19:47:43 -07:00
MediaPipe Team
f824424700 When returning multiple output streams together, keep them alive until callback.
PiperOrigin-RevId: 530771884
2023-05-09 19:00:00 -07:00
MediaPipe Team
e391c76433 Include object_detector_metadata_schema.fbs and image_segmenter_metadata_schema.fbs
PiperOrigin-RevId: 530769920
2023-05-09 18:45:01 -07:00
MediaPipe Team
f95a782399 Internal change
PiperOrigin-RevId: 530751565
2023-05-09 17:03:20 -07:00
MediaPipe Team
6ff39c418c Internal change
PiperOrigin-RevId: 530751097
2023-05-09 17:01:45 -07:00
MediaPipe Team
dd1779840d Update model_maker requirements.txt for release
PiperOrigin-RevId: 530748415
2023-05-09 16:49:41 -07:00
Sebastian Schmidt
a469f0151b
Merge pull request from priankakariatyml/ios-cocoapods-opencv-fixes
Removed opencv framework from MPPVisionTaskRunner dependendencies
2023-05-09 17:08:32 -06:00
MediaPipe Team
f77481f303 MediaPipe GPU: Log renderer.
We currently log GL version, but since we support multiple backends, logging the renderer as well takes away any doubt what is being used at runtime.

PiperOrigin-RevId: 530736209
2023-05-09 15:57:31 -07:00
Sebastian Schmidt
bea5eb766d Move Java Connections arrays to Task class
PiperOrigin-RevId: 530719994
2023-05-09 14:52:33 -07:00
Sebastian Schmidt
6f3c80ae8a Prevent property mangling for options types
PiperOrigin-RevId: 530707361
2023-05-09 14:05:05 -07:00
Jiuqiang Tang
05c565898a Add image_segmenter_metadata_schema and object_detector_metadata_schema python files to the mediapipe python wheels.
PiperOrigin-RevId: 530674961
2023-05-09 12:02:31 -07:00
MediaPipe Team
08d19739e0 Allow passing --resource_root_dir to resolve asset lookups.
PiperOrigin-RevId: 530618235
2023-05-09 08:40:11 -07:00
MediaPipe Team
9de52a4a30 Internal change
PiperOrigin-RevId: 530562491
2023-05-09 03:48:49 -07:00
Prianka Liz Kariat
99e3d355cb Removed opencv framework dep from MPPVisionTaskRunner deps 2023-05-09 11:28:19 +05:30
MediaPipe Team
10776ef86f Added error message if no provisioning profile found
PiperOrigin-RevId: 530498369
2023-05-08 22:20:19 -07:00
Sebastian Schmidt
65cb5f4e6b Do not depend on *.ts files in ts_declaration
PiperOrigin-RevId: 530435849
2023-05-08 16:20:18 -07:00
Copybara-Service
ee8d0383d6 Merge pull request from priankakariatyml:ios-cocoapods-fixes
PiperOrigin-RevId: 530409793
2023-05-08 14:35:09 -07:00
MediaPipe Team
83a8743a8b Internal change
PiperOrigin-RevId: 530408554
2023-05-08 14:31:04 -07:00
MediaPipe Team
b40f0d3b72 Internal change
PiperOrigin-RevId: 530385895
2023-05-08 13:04:51 -07:00
Sebastian Schmidt
ae8bedd352 Inline constants for FaceLandmarksConnections
PiperOrigin-RevId: 530384171
2023-05-08 12:58:18 -07:00
Sebastian Schmidt
e3c2f31ddf Update WASM files for Alpha 14
PiperOrigin-RevId: 530341569
2023-05-08 10:31:46 -07:00
Shuang Liu
0c75c76623 Fix a typo.
PiperOrigin-RevId: 530339315
2023-05-08 10:24:29 -07:00
Prianka Liz Kariat
4a192a6d87 Updated formatting in MPPImageClassifier 2023-05-08 16:58:00 +05:30
Prianka Liz Kariat
db732e2913 Updated formatting in MPPImageClassifierOptions 2023-05-08 16:57:17 +05:30
Prianka Liz Kariat
443418f6d5 Updated formatting 2023-05-08 16:45:16 +05:30
Prianka Liz Kariat
946042aca1 Reverted addition of flow limiter calculator in image classifier iOS 2023-05-08 16:33:09 +05:30
Prianka Liz Kariat
1865643486 Fixed deps in ios task BUILD file 2023-05-08 16:32:04 +05:30
Prianka Liz Kariat
26810b6b84 Reverted back to using containers and options in BUILD 2023-05-08 16:30:40 +05:30
Prianka Liz Kariat
f86188f8e1 Merged with master 2023-05-08 16:24:54 +05:30
Copybara-Service
1360977730 Merge pull request from priankakariatyml:ios-object-detector-async-fixes
PiperOrigin-RevId: 530233608
2023-05-08 01:14:01 -07:00
MediaPipe Team
613f645c74 Update CalculatorOptions to encourage proto3 options
PiperOrigin-RevId: 530127533
2023-05-07 11:25:43 -07:00
MediaPipe Team
876987b389 Remove auxiliary landmarks in PoseLandmarker API results.
PiperOrigin-RevId: 529989746
2023-05-06 12:58:00 -07:00
Sebastian Schmidt
ddb84702f6 Simplify MPMask by removing the Type Enums from the public API
PiperOrigin-RevId: 529975377
2023-05-06 10:26:13 -07:00
Sebastian Schmidt
e9fc66277a Simplify MPImage API by removing the Type Enums from the public API
PiperOrigin-RevId: 529960399
2023-05-06 07:49:46 -07:00
Sebastian Schmidt
8a6fe90759 Remove single-channel types from MPImage
PiperOrigin-RevId: 529956549
2023-05-06 07:04:14 -07:00
MediaPipe Team
800a7b4a27 Object detector handle empty packet when no object is detected.
PiperOrigin-RevId: 529919638
2023-05-06 01:11:01 -07:00
MediaPipe Team
cc8847def5 Update one-class segmentation category mask behavior on CPU to match latest API
PiperOrigin-RevId: 529917830
2023-05-06 00:55:26 -07:00
Sebastian Schmidt
fb7f06b509 Remove error check that canvas must be defined
PiperOrigin-RevId: 529906685
2023-05-05 23:22:40 -07:00
Sebastian Schmidt
6aad5742c3 Internal
PiperOrigin-RevId: 529890599
2023-05-05 21:51:51 -07:00
Sebastian Schmidt
e707c84a3d Create a MediaPipe Mask Type
PiperOrigin-RevId: 529868427
2023-05-05 19:23:43 -07:00
Prianka Liz Kariat
f713be7b6d Updated deps names in iOS test targets 2023-05-06 06:13:51 +05:30
MediaPipe Team
3562a7f7dc Update one-class segmentation category mask behavior on GPU to match latest API
PiperOrigin-RevId: 529853658
2023-05-05 17:32:06 -07:00
Prianka Liz Kariat
9f0dd03851 Updated comments 2023-05-06 05:15:23 +05:30
Prianka Liz Kariat
d79c0bbd39 Updated formatting 2023-05-06 05:10:05 +05:30
Prianka Liz Kariat
72d6081263 Declared arrays for duplicate depepndencies 2023-05-06 04:59:19 +05:30
Prianka Liz Kariat
648a24a97b Added conditional building of opencv xc framework to test targets 2023-05-06 04:58:59 +05:30
Prianka Liz Kariat
4349ac48b0 Changed opencv framework version to 4.5.3 2023-05-06 04:39:09 +05:30
Prianka Liz Kariat
d22a1318f6 Updated condition checks in third_party/BUILD 2023-05-06 04:37:09 +05:30
Prianka Liz Kariat
26fce393e8 Removed opencv framework target from vision runner deps 2023-05-06 04:36:49 +05:30
Prianka Liz Kariat
1daf4d74ee Updated common dependencies to link in helpers 2023-05-06 04:35:51 +05:30
Prianka Liz Kariat
6427c49d2d Aded version of dependency to podspec template 2023-05-06 04:25:24 +05:30
Prianka Liz Kariat
78224aaee6 Updated shell script to build ios opencv from source 2023-05-06 04:24:36 +05:30
Prianka Liz Kariat
2fa03a3699 Added flow limiter calculator and conditionally selected xcframework in iOS framework targets 2023-05-06 04:23:49 +05:30
Sebastian Schmidt
f6d0a5e03a Make the timestamp the second argument in all xForVideo() methods
PiperOrigin-RevId: 529814792
2023-05-05 14:29:33 -07:00
Copybara-Service
13187208ac Merge pull request from priankakariatyml:ios-opencv-build-from-source
PiperOrigin-RevId: 529800547
2023-05-05 13:34:46 -07:00
Sebastian Schmidt
f065910559 Create non-callback APIs for APIs that return callbacks.
PiperOrigin-RevId: 529799515
2023-05-05 13:30:36 -07:00
MediaPipe Team
ecc8dca8ba Internal change
PiperOrigin-RevId: 529752098
2023-05-05 10:28:38 -07:00
MediaPipe Team
c24e7a250c Internal change
PiperOrigin-RevId: 529617578
2023-05-04 23:01:32 -07:00
Sebastian Schmidt
18d893c697 Add scribble support to InteractiveSegmenter Web API
PiperOrigin-RevId: 529594131
2023-05-04 20:44:26 -07:00
MediaPipe Team
61cfe2ca9b Object Detector remove nms operation from exported tflite
PiperOrigin-RevId: 529559380
2023-05-04 17:36:11 -07:00
MediaPipe Team
12b0b6fad1 Internal change
PiperOrigin-RevId: 529495239
2023-05-04 14:51:19 -07:00
Prianka Liz Kariat
1db1c29f50 Added code comments 2023-05-05 01:04:04 +05:30
Prianka Liz Kariat
330976ce9e Added utils of containers and core to MPPTaskCommon to avoid warnings in xcode 2023-05-04 23:51:41 +05:30
Prianka Liz Kariat
47013d289e Added flow limiter calculator in MediaPipeTasksCommon 2023-05-04 23:19:12 +05:30
MediaPipe Team
64cad80543 Internal change.
PiperOrigin-RevId: 529449175
2023-05-04 10:33:40 -07:00
Prianka Liz Kariat
253662149e Updated pixel format types in object detector 2023-05-04 23:03:03 +05:30
Sebastian Schmidt
767db32d69 Support multiple poses for PoseLandmarker
PiperOrigin-RevId: 529430797
2023-05-04 09:29:12 -07:00
Prianka Liz Kariat
3df4f7db64 Updated time out for object detector 2023-05-04 20:00:29 +05:30
Prianka Liz Kariat
08282d9fd7 Updated time out for image classifier async tests 2023-05-04 19:59:39 +05:30
Prianka Liz Kariat
a4e11eac78 Added constants for time out 2023-05-04 19:55:19 +05:30
Prianka Liz Kariat
00712d727e Updated wait time for object detector tests 2023-05-04 19:53:06 +05:30
Prianka Liz Kariat
33ae23c53a Increased wait time for image classifier asynchronous tests 2023-05-04 19:51:54 +05:30
Prianka Liz Kariat
8ec0724b65 Updated documentation to include note about rgba images 2023-05-04 19:44:11 +05:30
Prianka Liz Kariat
ddd1515f88 Updated documentation 2023-05-04 19:40:15 +05:30
Prianka Liz Kariat
d401439daa Updated formatting 2023-05-04 19:22:11 +05:30
Prianka Liz Kariat
1136d4d515 Updated CVPixelBuffer to support pixel format type of 32RGBA 2023-05-04 18:58:49 +05:30
Prianka Liz Kariat
7a7f27c34b Merge branch 'ios-normalized-keypoint-hash' into ios-object-detector-async-fixes 2023-05-04 17:21:36 +05:30
Prianka Liz Kariat
381ffcb474 Added hash implementation for iOS normalized keypoint 2023-05-04 17:10:07 +05:30
Prianka Liz Kariat
87593a2ade Updated docuemntation of MPPObjectDetector 2023-05-04 17:05:17 +05:30
Prianka Liz Kariat
ab135190e5 Updated iOS object detector to use delegates instead of callbacks for async calls 2023-05-04 17:03:40 +05:30
Prianka Liz Kariat
a21c08bf4d Added method for creating unique dispatch queue names in MPPVisionTaskRunner 2023-05-04 17:00:12 +05:30
Prianka Liz Kariat
e47bb16544 Added validation of C++ image classification result packet in MPPImageClassifierResult+Helpers.mm 2023-05-04 16:52:58 +05:30
Prianka Liz Kariat
ab4b07646c Updated MPPImageClassifier to use delegates instead of completion blocks for callback. 2023-05-04 16:43:18 +05:30
Prianka Liz Kariat
1323a5271c Added method to create unique dispatch queue names in MPPVisionTaskRunner 2023-05-04 16:39:43 +05:30
Jiuqiang Tang
c6e3f08282 Expose FaceAligner and LanguageDetector to be public MediaPipe Tasks Python API.
PiperOrigin-RevId: 529227382
2023-05-03 16:38:49 -07:00
MediaPipe Team
b350f72394 Support MultiHW AVG Architecture for object detector
PiperOrigin-RevId: 529221127
2023-05-03 16:12:59 -07:00
Copybara-Service
8c324fbd77 Merge pull request from kinaryml:language-detector-python
PiperOrigin-RevId: 529213966
2023-05-03 15:50:42 -07:00
MediaPipe Team
a09e39d431 Add TransformerParameters proto
PiperOrigin-RevId: 529213840
2023-05-03 15:46:50 -07:00
Yuqi Li
e428bdb7e8 internal change.
PiperOrigin-RevId: 529181374
2023-05-03 13:37:16 -07:00
MediaPipe Team
606b83ac65 Internal change
PiperOrigin-RevId: 529180655
2023-05-03 13:32:44 -07:00
MediaPipe Team
7c955246aa Support scribble input for Interactive Segmenter Java API
PiperOrigin-RevId: 529177660
2023-05-03 13:22:09 -07:00
Copybara-Service
e84e90e5b2 Merge pull request from kinaryml:face-aligner-python
PiperOrigin-RevId: 529165597
2023-05-03 12:39:23 -07:00
MediaPipe Team
c780559214 Internal change
PiperOrigin-RevId: 529161249
2023-05-03 12:20:44 -07:00
MediaPipe Team
09662749ea Support scribble input for Interactive Segmenter
PiperOrigin-RevId: 529156049
2023-05-03 12:01:10 -07:00
MediaPipe Team
baa8fc68a1 Make uploading to GPU optional in Image.GetGpuBuffer().
PiperOrigin-RevId: 529066617
2023-05-03 05:57:58 -07:00
MediaPipe Team
3789156a41 Internal change
PiperOrigin-RevId: 529011480
2023-05-03 00:29:13 -07:00
MediaPipe Team
1dea01aecc Internal change
PiperOrigin-RevId: 528996603
2023-05-02 22:57:38 -07:00
MediaPipe Team
c698381e48 Internal change
PiperOrigin-RevId: 528939095
2023-05-02 18:05:31 -07:00
Jiuqiang Tang
bf11fb313e Expose PoseLandmarker as a public MediaPipe Tasks Python API.
PiperOrigin-RevId: 528882303
2023-05-02 14:04:01 -07:00
Jiuqiang Tang
4d9812af43 Pose detector uses advanced_gpu_api for gpu inference to resolve unsupported gpu op issue.
PiperOrigin-RevId: 528879218
2023-05-02 13:52:26 -07:00
Yuqi Li
9ce16fddeb nit: format the documentation of LandmarksDetectionResult.
PiperOrigin-RevId: 528848566
2023-05-02 11:56:47 -07:00
MediaPipe Team
421c9e8e97 Fix typo
PiperOrigin-RevId: 528829423
2023-05-02 10:51:47 -07:00
MediaPipe Team
4d112c132f Fix msan errors.
PiperOrigin-RevId: 528825081
2023-05-02 10:37:50 -07:00
Jiuqiang Tang
60055f6fee Add more comments and usage example of the face stylizer graph.
PiperOrigin-RevId: 528823127
2023-05-02 10:32:43 -07:00
MediaPipe Team
7fdbbee5be Internal change
PiperOrigin-RevId: 528799585
2023-05-02 09:07:29 -07:00
MediaPipe Team
5b93477589 internal change
PiperOrigin-RevId: 528719459
2023-05-02 02:17:18 -07:00
Chuo-Ling Chang
3719aaef7e Fix typo.
PiperOrigin-RevId: 528693117
2023-05-01 23:52:45 -07:00
MediaPipe Team
0a8be0d09d Internal change
PiperOrigin-RevId: 528632873
2023-05-01 18:40:33 -07:00
Jiuqiang Tang
fca728d226 Set face alignment image width and hight to 256.
PiperOrigin-RevId: 528583074
2023-05-01 15:01:39 -07:00
Jiuqiang Tang
162a999887 Check the output stream tag rather than the input stream tag in face stylizer graph.
PiperOrigin-RevId: 528555024
2023-05-01 13:14:32 -07:00
MediaPipe Team
5526e96b21 Internal change for proto library outputs.
PiperOrigin-RevId: 528539840
2023-05-01 12:17:29 -07:00
Yuqi Li
085f8265fb Internal change
PiperOrigin-RevId: 528517562
2023-05-01 11:01:23 -07:00
Kinar R
544e4b66f7
Merge branch 'google:master' into face-aligner-python 2023-05-01 22:56:00 +05:30
MediaPipe Team
cab619f8da Fix typo in README
PiperOrigin-RevId: 528506206
2023-05-01 10:25:05 -07:00
Jiuqiang Tang
b9a9da5de5 Ignore fetching face stylizer model when the graph doesn't output stylized face images.
PiperOrigin-RevId: 528504312
2023-05-01 10:18:41 -07:00
kinaryml
bd039f8b65 Updated necessary BUILD files 2023-05-01 05:56:52 -07:00
kinaryml
209d78f36c Added the Face Aligner Python API 2023-05-01 05:55:46 -07:00
MediaPipe Team
ad4ae6559b Add an extra op to rescale face stylizer generation output from [-1, 1] to [0, 1].
This conversion is to support running the model on both GPU and CPU.

PiperOrigin-RevId: 528400297
2023-04-30 23:14:29 -07:00
MediaPipe Team
80b19fff4b Internal Change
PiperOrigin-RevId: 528399911
2023-04-30 23:10:21 -07:00
Jiuqiang Tang
c29e43dda0 Add the "FACE_ALIGNMENT" output stream to the face stylizer graph.
PiperOrigin-RevId: 528345204
2023-04-30 16:59:36 -07:00
MediaPipe Team
c450283715 Add a filegroup for referencing model.
PiperOrigin-RevId: 528251316
2023-04-30 01:19:19 -07:00
Sebastian Schmidt
8e510a3255 Invoke PoseListener callback while C++ Packet is still active
PiperOrigin-RevId: 528061429
2023-04-28 21:22:02 -07:00
Sebastian Schmidt
253f13ad62 Invoke callback for InteractiveSegmenter while C++ Packets are active
PiperOrigin-RevId: 528053621
2023-04-28 20:34:17 -07:00
Sebastian Schmidt
d5c5457d25 Only log warnings once if color conversion is not specified
PiperOrigin-RevId: 528052009
2023-04-28 20:24:17 -07:00
Sebastian Schmidt
a9721ae2fb Invoke callback for ImageSegmenter while C++ Packets are active
PiperOrigin-RevId: 528047220
2023-04-28 20:01:10 -07:00
Sebastian Schmidt
e15add2475 Shorten MPImage API
PiperOrigin-RevId: 528039371
2023-04-28 19:00:17 -07:00
Esha Uboweja
b1f93b3b27 Fixes HAND_ROIS_FROM_LANDMARKS output to be hand_rects_from_landmarks output stream.
PiperOrigin-RevId: 528024796
2023-04-28 17:25:05 -07:00
Sebastian Schmidt
874cc9dea3 Update PoseLandmarker to return MPImage
PiperOrigin-RevId: 528022223
2023-04-28 17:13:07 -07:00
Sebastian Schmidt
dcef6df1cb Update InteractiveSegmenter to return MPImage
PiperOrigin-RevId: 528010944
2023-04-28 16:13:51 -07:00
Copybara-Service
bbbc0f98c5 Merge pull request from priankakariatyml:object-detector-objc-tests
PiperOrigin-RevId: 527991967
2023-04-28 14:52:20 -07:00
Sebastian Schmidt
2c1d9c6582 Update ImageSegmenter to return MPImage
PiperOrigin-RevId: 527990991
2023-04-28 14:48:30 -07:00
Sebastian Schmidt
a544098100 Update FaceStylizer to return MPImage
PiperOrigin-RevId: 527980696
2023-04-28 14:05:11 -07:00
Copybara-Service
5cffb3973f Merge pull request from kinaryml:pose-landmarker-python
PiperOrigin-RevId: 527948047
2023-04-28 11:59:28 -07:00
Copybara-Service
2bb1b454ea Merge pull request from priankakariatyml:ios-text-cocoapods-force-load
PiperOrigin-RevId: 527932547
2023-04-28 11:06:44 -07:00
MediaPipe Team
3dce259bf6 Internal change
PiperOrigin-RevId: 527931585
2023-04-28 11:02:26 -07:00
MediaPipe Team
b2fbb2ddab Internal change
PiperOrigin-RevId: 527909361
2023-04-28 09:43:56 -07:00
MediaPipe Team
cf22c97143 Add the TFLite conversion API to BlazeFaceStylizer in model maker.
PiperOrigin-RevId: 527806005
2023-04-28 00:30:51 -07:00
kinaryml
3b06772d9a Fixed BUILD 2023-04-27 21:13:31 -07:00
kinaryml
305866ccae Updated BUILD files to use the open sourced Language Detector model 2023-04-27 21:11:53 -07:00
Kinar R
76c8251faf
Merge branch 'google:master' into language-detector-python 2023-04-28 09:28:54 +05:30
Sebastian Schmidt
5d9761cbfd Update tests and demos to call "close".
PiperOrigin-RevId: 527746909
2023-04-27 18:58:57 -07:00
Sebastian Schmidt
28b9b8d8a3 Open-sources LanguageDetector model.
PiperOrigin-RevId: 527745108
2023-04-27 18:47:07 -07:00
Sebastian Schmidt
5e41d47f3a Add "close()" method to MP Web Tasks
PiperOrigin-RevId: 527726737
2023-04-27 17:16:40 -07:00
Sebastian Schmidt
b7e46ec528 Update WASM files for Alpha 13
PiperOrigin-RevId: 527707613
2023-04-27 15:58:03 -07:00
Prianka Liz Kariat
82840b8e28 Removed comments 2023-04-28 03:30:47 +05:30
Prianka Liz Kariat
fec11735a3 Updated formatting 2023-04-28 03:30:21 +05:30
Prianka Liz Kariat
bdede4f94e Updated select conditions 2023-04-28 03:26:29 +05:30
Prianka Liz Kariat
aafb0162f4 Added config settings to select building iOS xcframework from source for certain configs 2023-04-28 03:17:22 +05:30
Prianka Liz Kariat
ad4513784c Added build file for ios opencv from sources 2023-04-28 03:16:08 +05:30
Prianka Liz Kariat
2a0aa86ca9 Added http_archive to download opencv sources 2023-04-28 03:14:41 +05:30
Prianka Liz Kariat
8e82e91095 Added config for fat simulator builds 2023-04-28 03:13:14 +05:30
Sebastian Schmidt
4e1270c18f Internal
PiperOrigin-RevId: 527680530
2023-04-27 14:14:54 -07:00
MediaPipe Team
212f110c65 Add nose in facemesh drawing
PiperOrigin-RevId: 527644154
2023-04-27 12:00:37 -07:00
MediaPipe Team
3ca2427cc8 Blendshapes graph take smoothed face landmarks as input.
PiperOrigin-RevId: 527640341
2023-04-27 11:46:40 -07:00
MediaPipe Team
82b8e4d7bf Update the face stylizer config to match the latest encoder and detector config.
PiperOrigin-RevId: 527637477
2023-04-27 11:37:16 -07:00
Copybara-Service
4fd77e38fb Merge pull request from shmishra99:master
PiperOrigin-RevId: 527634460
2023-04-27 11:27:15 -07:00
Sebastian Schmidt
1b82821f15 Add support for single-channel images to MPImage
PiperOrigin-RevId: 527629970
2023-04-27 11:12:34 -07:00
Sebastian Schmidt
a5852b0513 Internal change
PiperOrigin-RevId: 527623223
2023-04-27 10:50:36 -07:00
Copybara-Service
cd47080057 Merge pull request from kuaashish:master
PiperOrigin-RevId: 527619288
2023-04-27 10:37:23 -07:00
Sebastian Schmidt
d5157a039e Add .github workspace import
PiperOrigin-RevId: 527617546
2023-04-27 10:31:44 -07:00
Sebastian Schmidt
b457060c3a Generify tests for MPImage
PiperOrigin-RevId: 527611864
2023-04-27 10:12:30 -07:00
Sebastian Schmidt
bc3434108e Update MPImage to use containers
PiperOrigin-RevId: 527596164
2023-04-27 09:18:05 -07:00
Jiuqiang Tang
7c70c62465 Fix typo and improve comments.
PiperOrigin-RevId: 527580369
2023-04-27 08:10:29 -07:00
MediaPipe Team
7b055df211 Internal change
PiperOrigin-RevId: 527473249
2023-04-26 22:14:32 -07:00
MediaPipe Team
2122b5d7be Internal change
PiperOrigin-RevId: 527430483
2023-04-26 18:17:56 -07:00
MediaPipe Team
b05fd21709 Refactor the loss functions to initialize the VGG loss function in the init function to avoid duplicated initialization.
PiperOrigin-RevId: 527424556
2023-04-26 17:49:19 -07:00
MediaPipe Team
baed44ab10 Internal change
PiperOrigin-RevId: 527416263
2023-04-26 17:12:34 -07:00
MediaPipe Team
a45d1f5e90 Internal change.
PiperOrigin-RevId: 527374728
2023-04-26 14:27:58 -07:00
Prianka Liz Kariat
261e02e491 Fixed case name 2023-04-27 02:55:58 +05:30
Prianka Liz Kariat
ee2665ad13 Added missing input files in vision library 2023-04-27 02:54:50 +05:30
Prianka Liz Kariat
1d8e24b9aa Updated documentation 2023-04-27 02:47:52 +05:30
Prianka Liz Kariat
a8cb1f1dad Updated default values 2023-04-27 02:47:19 +05:30
Prianka Liz Kariat
1e776e8e01 Fixed indendation issues 2023-04-27 02:31:30 +05:30
Prianka Liz Kariat
9c98435027 Updated iOS framework names 2023-04-27 02:15:16 +05:30
MediaPipe Team
c44cc30ece DetectionPostProcessingGraph for post processing raw tensors from detection models.
PiperOrigin-RevId: 527363291
2023-04-26 13:44:54 -07:00
MediaPipe Team
48aa88f39d Change object detector learning rate decay to cosine decay.
PiperOrigin-RevId: 527337105
2023-04-26 12:13:17 -07:00
kuaashish
6f97203562
Rename 18-other-issues.md to 19-other-issues.md 2023-04-26 16:38:23 +05:30
kuaashish
5f505b09e3
Rename 17-solution-legacy-issue-template.yaml to 18-solution-legacy-issue-template.yaml 2023-04-26 16:38:05 +05:30
kuaashish
275eb31a8f
Rename 16-documentation-issue-template.yaml to 17-documentation-issue-template.yaml 2023-04-26 16:37:44 +05:30
kuaashish
f9d14157ff
Rename 15-bug-issue-template.yaml to 16-bug-issue-template.yaml 2023-04-26 16:37:28 +05:30
kuaashish
9c8fe490d4
Rename 14-build-install-issue-template.yaml to 15-build-install-issue-template.yaml 2023-04-26 16:36:58 +05:30
kuaashish
f36f2c64b5
Rename 16-feature-request-issue-template.yaml to 14-feature-request-issue-template.yaml 2023-04-26 16:36:33 +05:30
kuaashish
d6b4067319
Rename 15-feature-request-issue-template.yaml to 16-feature-request-issue-template.yaml 2023-04-26 16:35:44 +05:30
kuaashish
7d6ccb2dd1
Rename 14-feature-request-issue-template.yaml to 15-feature-request-issue-template.yaml 2023-04-26 16:35:16 +05:30
kuaashish
728cb26644
Rename 13-feature-request-issue-template.yaml to 14-feature-request-issue-template.yaml 2023-04-26 16:34:48 +05:30
kuaashish
4046b97416
Rename 50-other-issues.md to 18-other-issues.md 2023-04-26 16:32:41 +05:30
kuaashish
00f355e301
Rename Solution(Legacy_issue_template).yaml to 17-solution-legacy-issue-template.yaml 2023-04-26 16:32:06 +05:30
kuaashish
a002e24080
Rename Documentation_issue_template.yaml to 16-documentation-issue-template.yaml 2023-04-26 16:31:16 +05:30
kuaashish
d15701a5e0
Rename bug_issue_template.yaml to 15-bug-issue-template.yaml 2023-04-26 16:30:46 +05:30
kuaashish
a99b0d6b9c
Rename build.install_issue_template.yaml to 14-build-install-issue-template.yaml 2023-04-26 16:30:23 +05:30
kuaashish
badccdd87b
Rename feature_request_issue_template.yaml to 13-feature-request-issue-template.yaml 2023-04-26 16:29:49 +05:30
kuaashish
2d69c48e39
Rename studio_issue_template.yaml to 12-studio-issue-template.yaml 2023-04-26 16:27:12 +05:30
kuaashish
17bee87b27
Rename model_maker_issue_template.yaml to 11-model-maker-issue-template.yaml 2023-04-26 16:26:39 +05:30
kuaashish
db2592a04d
Rename task_issue_template.yaml to 00-task-issue-template.yaml 2023-04-26 16:24:20 +05:30
MediaPipe Team
507ed0d91d Add custom metadata for object detection model with out-of-graph nms.
PiperOrigin-RevId: 527083453
2023-04-25 14:58:51 -07:00
MediaPipe Team
17f5b95387 Internal change.
PiperOrigin-RevId: 527010360
2023-04-25 10:41:52 -07:00
Sebastian Schmidt
9e30b00685 Invoke the FaceStylizer callback even if no faces are detected
PiperOrigin-RevId: 527008261
2023-04-25 10:35:12 -07:00
Jiuqiang Tang
3bc8276678 Remove "All Rights Reserved." in copyright headers.
PiperOrigin-RevId: 526982992
2023-04-25 09:06:29 -07:00
MediaPipe Team
0fc6118680 Internal change.
PiperOrigin-RevId: 526892368
2023-04-25 01:30:43 -07:00
MediaPipe Team
56df724c36 Add customizable face stylizer module in MediaPipe model maker
PiperOrigin-RevId: 526883862
2023-04-25 00:47:45 -07:00
Prianka Liz Kariat
3390325250 Updated documentation 2023-04-25 11:23:38 +05:30
Prianka Liz Kariat
6ac39c9b93 Updated name of common objects pod 2023-04-25 04:26:13 +05:30
Prianka Liz Kariat
d63d3f61d7 Added podspec for CommonObjects and Vision tasks 2023-04-25 04:22:40 +05:30
Prianka Liz Kariat
8b44a7f181 Updated text podspec 2023-04-25 04:22:18 +05:30
Prianka Liz Kariat
472947818e Updated ios cocoapods build script 2023-04-25 04:22:03 +05:30
Prianka Liz Kariat
6eee726025 Updated build rules for iOS frameworks to duplicate symbols 2023-04-25 04:21:41 +05:30
Jiuqiang Tang
a0eb1b696c Internal changes.
PiperOrigin-RevId: 526759809
2023-04-24 14:45:35 -07:00
MediaPipe Team
33c8c68bba Add a default_applicable_licenses to model_maker/python/vision/core.
PiperOrigin-RevId: 526716940
2023-04-24 12:08:34 -07:00
kinaryml
ca5fca1db7 Mark index as unused 2023-04-24 11:26:36 -07:00
kinaryml
b511822815 Removed an unnecessary check and updated tests to check if the masks are generated or not 2023-04-24 11:23:27 -07:00
MediaPipe Team
ceb911ae06 Add nullable annotation to AudioDataProducer#setAudioConsumer
PiperOrigin-RevId: 526697945
2023-04-24 11:10:07 -07:00
Sebastian Schmidt
61854dc6a3 Create Pose Detector Web API
PiperOrigin-RevId: 526672533
2023-04-24 09:53:05 -07:00
Jiuqiang Tang
6773188e26 Make FaceLandmarksConnections to be a public class.
PiperOrigin-RevId: 526667505
2023-04-24 09:34:14 -07:00
Sebastian Schmidt
35cf8c35f2 Internal change
PiperOrigin-RevId: 526658482
2023-04-24 09:01:55 -07:00
MediaPipe Team
abded49e5b Internal change
PiperOrigin-RevId: 526300079
2023-04-22 10:52:14 -07:00
MediaPipe Team
a6c1bb6324 Internal change
PiperOrigin-RevId: 526235882
2023-04-22 00:28:52 -07:00
MediaPipe Team
58dcbc9833 Internal change
PiperOrigin-RevId: 526117263
2023-04-21 13:12:47 -07:00
kinaryml
0b1eb39870 Updated copyright 2023-04-21 11:48:06 -07:00
kinaryml
2a2a55d1b8 Added Language Detector Python API and fixed a typo in Interactive Segmenter Options' docstring 2023-04-21 11:46:21 -07:00
MediaPipe Team
a6c35e9ba5 Fixes the typos in tasks internal files.
PiperOrigin-RevId: 526063515
2023-04-21 09:46:39 -07:00
Sebastian Schmidt
9be748db00 Create MPImage type for Web
PiperOrigin-RevId: 525873209
2023-04-20 16:01:04 -07:00
Sebastian Schmidt
e9bb849503 Fix Typo
PiperOrigin-RevId: 525861968
2023-04-20 15:15:13 -07:00
MediaPipe Team
bd73617e5c Internal change
PiperOrigin-RevId: 525854969
2023-04-20 14:47:17 -07:00
MediaPipe Team
02bdb9aba0 Internal change
PiperOrigin-RevId: 525845988
2023-04-20 14:14:58 -07:00
MediaPipe Team
983932b6dd This will fix the multiple typos in the new tasks internal files
PiperOrigin-RevId: 525788850
2023-04-20 10:43:35 -07:00
MediaPipe Team
d4c7ad0411 Internal change
PiperOrigin-RevId: 525775875
2023-04-20 10:00:01 -07:00
MediaPipe Team
a89ec882b0 Internal change
PiperOrigin-RevId: 525774601
2023-04-20 09:55:35 -07:00
Kinar R
9032bce577
Update copyright 2023-04-20 13:21:56 +05:30
Kinar R
21ddba0d60
Update copyright 2023-04-20 13:21:31 +05:30
MediaPipe Team
331692577e Internal change
PiperOrigin-RevId: 525660743
2023-04-19 23:47:59 -07:00
Copybara-Service
44aa607e06 Merge pull request from kinaryml:segmenter-python-add-labels
PiperOrigin-RevId: 525571089
2023-04-19 15:46:20 -07:00
Sebastian Schmidt
ffbd799b8d Extract shared types to create and test landmarks
PiperOrigin-RevId: 525568412
2023-04-19 15:37:42 -07:00
MediaPipe Team
476c7efc18 Remove uses of ATOMIC_VAR_INIT
ATOMIC_VAR_INIT has a trivial definition
`#define ATOMIC_VAR_INIT(value) (value)`,
is deprecated in C17/C++20, and will be removed in newer standards in
newer GCC/Clang (e.g. https://reviews.llvm.org/D144196).

PiperOrigin-RevId: 525534393
2023-04-19 13:26:47 -07:00
MediaPipe Team
5bd3282515 Internal change
PiperOrigin-RevId: 525513792
2023-04-19 12:05:44 -07:00
MediaPipe Team
3231591f7f draw right eye with blue color
PiperOrigin-RevId: 525508840
2023-04-19 11:47:38 -07:00
MediaPipe Team
b2586e7e3b Internal change
PiperOrigin-RevId: 525495248
2023-04-19 11:01:13 -07:00
MediaPipe Team
eb62479190 Internal change
PiperOrigin-RevId: 525487344
2023-04-19 10:35:49 -07:00
Bekzhan Bekbolatuly
9818ebb630 Internal change
PiperOrigin-RevId: 525476655
2023-04-19 09:58:22 -07:00
MediaPipe Team
0aea6d90a8 Internal change
PiperOrigin-RevId: 525407296
2023-04-19 04:10:02 -07:00
MediaPipe Team
01f4439d83 Internal change
PiperOrigin-RevId: 525399975
2023-04-19 03:33:01 -07:00
MediaPipe Team
de84696be6 Internal change
PiperOrigin-RevId: 525390694
2023-04-19 02:39:54 -07:00
MediaPipe Team
b83fa5b67d Internal change
PiperOrigin-RevId: 525365673
2023-04-19 00:17:50 -07:00
MediaPipe Team
8c8ba9511a Internal change
PiperOrigin-RevId: 525358261
2023-04-18 23:33:46 -07:00
kinaryml
f87ffd92a0 Removed optional for defaults in some tasks and updated various tests to be consistent with that of Pose Landmarker's 2023-04-18 23:28:10 -07:00
kinaryml
00f966655b Fixed a typo in a docstring 2023-04-18 22:48:37 -07:00
kinaryml
1688d0fa79 Added more pose landmarker tests and updated face landmarker tests to cover all the results 2023-04-18 22:45:46 -07:00
Kinar R
39742b6641
Merge branch 'google:master' into pose-landmarker-python 2023-04-19 10:21:23 +05:30
kinaryml
a1aab66c8d Fixed a typo in docstring 2023-04-18 21:50:27 -07:00
kinaryml
67b72e4fe9 Code cleanup 2023-04-18 21:43:38 -07:00
kinaryml
1cb404bea1 Changed labels to be a property 2023-04-18 21:31:14 -07:00
Kinar R
d621df8046
Merge branch 'google:master' into segmenter-python-add-labels 2023-04-19 09:51:42 +05:30
Sebastian Schmidt
d7039c90dc Update WASM for Alpha 11
PiperOrigin-RevId: 525245471
2023-04-18 14:07:07 -07:00
Prianka Liz Kariat
99420d35f3 Update build_ios_framework.sh 2023-04-19 00:25:10 +05:30
Copybara-Service
e15d98298f Merge pull request from kinaryml:image-segmenter-python-api-updates
PiperOrigin-RevId: 525204893
2023-04-18 11:36:09 -07:00
Prianka Liz Kariat
f75eb57956 Update build_ios_framework.sh 2023-04-18 23:46:05 +05:30
Prianka Liz Kariat
0c4d405479 Updated bazelrc with required config 2023-04-18 23:21:14 +05:30
Prianka Liz Kariat
eb0aa5056a Updated documentation 2023-04-18 23:20:11 +05:30
Prianka Liz Kariat
d7c96dea6a Updated formatting of files 2023-04-18 23:10:47 +05:30
Prianka Liz Kariat
24bd7a6b9f Merge branch 'master' into ios-text-cocoapods-force-load 2023-04-18 23:03:56 +05:30
Prianka Liz Kariat
49b2c7c2cc Added iOS task text cocoapods podspec 2023-04-18 23:02:58 +05:30
Prianka Liz Kariat
7ad2b7b32f Added shell script for building cocoapods archive 2023-04-18 23:02:35 +05:30
Prianka Liz Kariat
a774399630 Added targets for iOS text frameworks 2023-04-18 23:02:16 +05:30
MediaPipe Team
64d1e74c20 Internal MediaPipe Tasks change
PiperOrigin-RevId: 525182282
2023-04-18 10:20:03 -07:00
MediaPipe Team
3e0ed2ced0 Internal Changes
PiperOrigin-RevId: 525180095
2023-04-18 10:14:08 -07:00
kinaryml
1919b0e341 Updated docstrings for get_labels 2023-04-18 02:54:03 -07:00
kinaryml
723cb2a919 Populate labels using model metadata for the ImageSegmenter Python API 2023-04-18 02:49:13 -07:00
MediaPipe Team
88a10de345 Internal change
PiperOrigin-RevId: 525084368
2023-04-18 02:15:02 -07:00
MediaPipe Team
b4e27c137e Internal change
PiperOrigin-RevId: 525069421
2023-04-18 00:54:16 -07:00
MediaPipe Team
63cd09951d Internal change
PiperOrigin-RevId: 525030969
2023-04-17 21:17:08 -07:00
MediaPipe Team
43fd744296 Internal Changes
PiperOrigin-RevId: 524997017
2023-04-17 17:43:40 -07:00
Sebastian Schmidt
47e55fcf2f Add HAND_CONNECTIONS to HandLandmarker and GestureRecognizer
PiperOrigin-RevId: 524951052
2023-04-17 14:31:40 -07:00
MediaPipe Team
2564fec44c Internal MediaPipe Tasks change.
PiperOrigin-RevId: 524942203
2023-04-17 14:09:14 -07:00
Sebastian Schmidt
b147002b7e Support new output format for InteractiveSegmenter
PiperOrigin-RevId: 524940992
2023-04-17 14:04:56 -07:00
kinaryml
5f5ce22020 Added the PoseLandmarker Python API and a simple test 2023-04-14 14:09:15 -07:00
kinaryml
a745b71f97 Removed unused import 2023-04-13 21:11:20 -07:00
kinaryml
a036bf70cc Removed Activation from ImageSegmenterOptions 2023-04-13 21:09:01 -07:00
kinaryml
a03fa448dc Explicitly state the modes in the tests for ImageSegmenterOptions and InteractiveSegmenterOptions 2023-04-13 11:55:37 -07:00
kinaryml
3f68f90238 Deprecated output_type for the ImageSegmenter and InteractiveSegmenter APIs 2023-04-12 14:37:16 -07:00
Prianka Liz Kariat
0fcf92d7d5 Updated iOS Image Classifier to reflect new calculation for normalized rect 2023-04-11 18:18:35 +05:30
Prianka Liz Kariat
114a11dc4e Updated iOS tests to reflect the new orientation calculation. 2023-04-11 18:11:58 +05:30
Prianka Liz Kariat
27353310c3 Updated normalized rect calculation for some angles in MPPVisionTaskRunner 2023-04-11 18:11:33 +05:30
Prianka Liz Kariat
089361cd89 Split macros into helpers in Objective C Tests 2023-04-11 17:37:54 +05:30
Shivam Mishra
89491df8c1 Migrate stale management probot to Github action 2023-04-10 22:38:14 +05:30
Prianka Liz Kariat
d06cf68c70 Removed detect in image with region of interest api from iOS Object Detector 2023-04-10 19:28:46 +05:30
Prianka Liz Kariat
a2bab54640 Added iOS Object Detector Objective D tests 2023-04-10 19:25:37 +05:30
Prianka Liz Kariat
adfe47d456 Removed roi apis from iOS object detector 2023-04-10 19:24:58 +05:30
Prianka Liz Kariat
0fd60285b5 Updated roi not allowed check in ios vision task runner 2023-04-10 19:23:32 +05:30
2213 changed files with 123333 additions and 16831 deletions
.bazelrc
.github
README.mdWORKSPACE
docs
mediapipe
BUILD
calculators
audio
core
image

View File

@ -87,6 +87,9 @@ build:ios_fat --config=ios
build:ios_fat --ios_multi_cpus=armv7,arm64
build:ios_fat --watchos_cpus=armv7k
build:ios_sim_fat --config=ios
build:ios_sim_fat --ios_multi_cpus=x86_64,sim_arm64
build:darwin_x86_64 --apple_platform_type=macos
build:darwin_x86_64 --macos_minimum_os=10.12
build:darwin_x86_64 --cpu=darwin_x86_64
@ -95,6 +98,9 @@ build:darwin_arm64 --apple_platform_type=macos
build:darwin_arm64 --macos_minimum_os=10.16
build:darwin_arm64 --cpu=darwin_arm64
# Turn off maximum stdout size
build --experimental_ui_max_stdouterr_bytes=-1
# This bazelrc file is meant to be written by a setup script.
try-import %workspace%/.configure.bazelrc

View File

@ -40,18 +40,16 @@ body:
label: Programming Language and version (e.g. C++, Python, Java)
validations:
required: true
- type: textarea
- type: input
id: current_model
attributes:
label: Describe the actual behavior
render: shell
validations:
required: true
- type: textarea
- type: input
id: expected_model
attributes:
label: Describe the expected behaviour
render: shell
validations:
required: true
- type: textarea

View File

@ -41,18 +41,16 @@ body:
label: Task name (e.g. Image classification, Gesture recognition etc.)
validations:
required: true
- type: textarea
- type: input
id: current_model
attributes:
label: Describe the actual behavior
render: shell
validations:
required: true
- type: textarea
- type: input
id: expected_model
attributes:
label: Describe the expected behaviour
render: shell
validations:
required: true
- type: textarea

View File

@ -31,18 +31,16 @@ body:
label: URL that shows the problem
validations:
required: false
- type: textarea
- type: input
id: current_model
attributes:
label: Describe the actual behavior
render: shell
validations:
required: false
- type: textarea
- type: input
id: expected_model
attributes:
label: Describe the expected behaviour
render: shell
validations:
required: false
- type: textarea

View File

@ -28,37 +28,33 @@ body:
- 'No'
validations:
required: false
- type: textarea
- type: input
id: behaviour
attributes:
label: Describe the feature and the current behaviour/state
render: shell
validations:
required: true
- type: textarea
- type: input
id: api_change
attributes:
label: Will this change the current API? How?
render: shell
validations:
required: false
- type: textarea
- type: input
id: benifit
attributes:
label: Who will benefit with this feature?
validations:
required: false
- type: textarea
- type: input
id: use_case
attributes:
label: Please specify the use cases for this feature
render: shell
validations:
required: true
- type: textarea
- type: input
id: info_other
attributes:
label: Any Other info
render: shell
validations:
required: false

View File

@ -87,14 +87,13 @@ body:
placeholder:
validations:
required: false
- type: textarea
- type: input
id: what-happened
attributes:
label: Describe the problem
description: Provide the exact sequence of commands / steps that you executed before running into the [problem](https://google.github.io/mediapipe/getting_started/getting_started.html)
placeholder: Tell us what you see!
value: "A bug happened!"
render: shell
validations:
required: true
- type: textarea

View File

@ -80,18 +80,16 @@ body:
label: Xcode & Tulsi version (if issue is related to building for iOS)
validations:
required: false
- type: textarea
- type: input
id: current_model
attributes:
label: Describe the actual behavior
render: shell
validations:
required: true
- type: textarea
- type: input
id: expected_model
attributes:
label: Describe the expected behaviour
render: shell
validations:
required: true
- type: textarea

View File

@ -48,18 +48,16 @@ body:
placeholder: e.g. C++, Python, Java
validations:
required: false
- type: textarea
- type: input
id: current_model
attributes:
label: Describe the actual behavior
render: shell
validations:
required: false
- type: textarea
- type: input
id: expected_model
attributes:
label: Describe the expected behaviour
render: shell
validations:
required: false
- type: textarea

34
.github/stale.yml vendored
View File

@ -1,34 +0,0 @@
# Copyright 2021 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.
# ============================================================================
#
# This file was assembled from multiple pieces, whose use is documented
# throughout. Please refer to the TensorFlow dockerfiles documentation
# for more information.
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 7
# Number of days of inactivity before a stale Issue or Pull Request is closed
daysUntilClose: 7
# Only issues or pull requests with all of these labels are checked if stale. Defaults to `[]` (disabled)
onlyLabels:
- stat:awaiting response
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you.
# Comment to post when removing the stale label. Set to `false` to disable
unmarkComment: false
closeComment: >
Closing as stale. Please reopen if you'd like to work on this further.

68
.github/workflows/stale.yaml vendored Normal file
View File

@ -0,0 +1,68 @@
# Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# 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.
# ==============================================================================
# This workflow alerts and then closes the stale issues/PRs after specific time
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: 'Close stale issues and PRs'
"on":
schedule:
- cron: "30 1 * * *"
permissions:
contents: read
issues: write
pull-requests: write
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: 'actions/stale@v7'
with:
# Comma separated list of labels that can be assigned to issues to exclude them from being marked as stale.
exempt-issue-labels: 'override-stale'
# Comma separated list of labels that can be assigned to PRs to exclude them from being marked as stale.
exempt-pr-labels: "override-stale"
# Limit the No. of API calls in one run default value is 30.
operations-per-run: 500
# Prevent to remove stale label when PRs or issues are updated.
remove-stale-when-updated: true
# List of labels to remove when issues/PRs unstale.
labels-to-remove-when-unstale: 'stat:awaiting response'
# comment on issue if not active for more then 7 days.
stale-issue-message: 'This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.'
# comment on PR if not active for more then 14 days.
stale-pr-message: 'This PR has been marked stale because it has no recent activity since 14 days. It will be closed if no further activity occurs. Thank you.'
# comment on issue if stale for more then 7 days.
close-issue-message: This issue was closed due to lack of activity after being marked stale for past 7 days.
# comment on PR if stale for more then 14 days.
close-pr-message: This PR was closed due to lack of activity after being marked stale for past 14 days.
# Number of days of inactivity before an Issue Request becomes stale
days-before-issue-stale: 7
# Number of days of inactivity before a stale Issue is closed
days-before-issue-close: 7
# reason for closed the issue default value is not_planned
close-issue-reason: completed
# Number of days of inactivity before a stale PR is closed
days-before-pr-close: 14
# Number of days of inactivity before an PR Request becomes stale
days-before-pr-stale: 14
# Check for label to stale or close the issue/PR
any-of-labels: 'stat:awaiting response'
# override stale to stalled for PR
stale-pr-label: 'stale'
# override stale to stalled for Issue
stale-issue-label: "stale"

200
README.md
View File

@ -1,99 +1,121 @@
---
layout: default
layout: forward
target: https://developers.google.com/mediapipe
title: Home
nav_order: 1
---
![MediaPipe](https://mediapipe.dev/images/mediapipe_small.png)
----
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
**Attention:** *We have moved to
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
*This notice and web page will be removed on June 1, 2023.*
![MediaPipe](https://developers.google.com/static/mediapipe/images/home/hero_01_1920.png)
----
**Attention**: MediaPipe Solutions Preview is an early release. [Learn
more](https://developers.google.com/mediapipe/solutions/about#notice).
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
**On-device machine learning for everyone**
--------------------------------------------------------------------------------
Delight your customers with innovative machine learning features. MediaPipe
contains everything that you need to customize and deploy to mobile (Android,
iOS), web, desktop, edge devices, and IoT, effortlessly.
## Live ML anywhere
* [See demos](https://goo.gle/mediapipe-studio)
* [Learn more](https://developers.google.com/mediapipe/solutions)
[MediaPipe](https://google.github.io/mediapipe/) offers cross-platform, customizable
ML solutions for live and streaming media.
## Get started
![accelerated.png](https://mediapipe.dev/images/accelerated_small.png) | ![cross_platform.png](https://mediapipe.dev/images/cross_platform_small.png)
:------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------:
***End-to-End acceleration***: *Built-in fast ML inference and processing accelerated even on common hardware* | ***Build once, deploy anywhere***: *Unified solution works across Android, iOS, desktop/cloud, web and IoT*
![ready_to_use.png](https://mediapipe.dev/images/ready_to_use_small.png) | ![open_source.png](https://mediapipe.dev/images/open_source_small.png)
***Ready-to-use solutions***: *Cutting-edge ML solutions demonstrating full power of the framework* | ***Free and open source***: *Framework and solutions both under Apache 2.0, fully extensible and customizable*
You can get started with MediaPipe Solutions by by checking out any of the
developer guides for
[vision](https://developers.google.com/mediapipe/solutions/vision/object_detector),
[text](https://developers.google.com/mediapipe/solutions/text/text_classifier),
and
[audio](https://developers.google.com/mediapipe/solutions/audio/audio_classifier)
tasks. If you need help setting up a development environment for use with
MediaPipe Tasks, check out the setup guides for
[Android](https://developers.google.com/mediapipe/solutions/setup_android), [web
apps](https://developers.google.com/mediapipe/solutions/setup_web), and
[Python](https://developers.google.com/mediapipe/solutions/setup_python).
----
## Solutions
## ML solutions in MediaPipe
MediaPipe Solutions provides a suite of libraries and tools for you to quickly
apply artificial intelligence (AI) and machine learning (ML) techniques in your
applications. You can plug these solutions into your applications immediately,
customize them to your needs, and use them across multiple development
platforms. MediaPipe Solutions is part of the MediaPipe [open source
project](https://github.com/google/mediapipe), so you can further customize the
solutions code to meet your application needs.
Face Detection | Face Mesh | Iris | Hands | Pose | Holistic
:----------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | :------:
[![face_detection](https://mediapipe.dev/images/mobile/face_detection_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/face_detection) | [![face_mesh](https://mediapipe.dev/images/mobile/face_mesh_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/face_mesh) | [![iris](https://mediapipe.dev/images/mobile/iris_tracking_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/iris) | [![hand](https://mediapipe.dev/images/mobile/hand_tracking_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/hands) | [![pose](https://mediapipe.dev/images/mobile/pose_tracking_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/pose) | [![hair_segmentation](https://mediapipe.dev/images/mobile/holistic_tracking_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/holistic)
These libraries and resources provide the core functionality for each MediaPipe
Solution:
Hair Segmentation | Object Detection | Box Tracking | Instant Motion Tracking | Objectron | KNIFT
:-------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: | :---:
[![hair_segmentation](https://mediapipe.dev/images/mobile/hair_segmentation_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/hair_segmentation) | [![object_detection](https://mediapipe.dev/images/mobile/object_detection_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/object_detection) | [![box_tracking](https://mediapipe.dev/images/mobile/object_tracking_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/box_tracking) | [![instant_motion_tracking](https://mediapipe.dev/images/mobile/instant_motion_tracking_android_small.gif)](https://google.github.io/mediapipe/solutions/instant_motion_tracking) | [![objectron](https://mediapipe.dev/images/mobile/objectron_chair_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/objectron) | [![knift](https://mediapipe.dev/images/mobile/template_matching_android_cpu_small.gif)](https://google.github.io/mediapipe/solutions/knift)
* **MediaPipe Tasks**: Cross-platform APIs and libraries for deploying
solutions. [Learn
more](https://developers.google.com/mediapipe/solutions/tasks).
* **MediaPipe models**: Pre-trained, ready-to-run models for use with each
solution.
<!-- []() in the first cell is needed to preserve table formatting in GitHub Pages. -->
<!-- Whenever this table is updated, paste a copy to solutions/solutions.md. -->
These tools let you customize and evaluate solutions:
[]() | [Android](https://google.github.io/mediapipe/getting_started/android) | [iOS](https://google.github.io/mediapipe/getting_started/ios) | [C++](https://google.github.io/mediapipe/getting_started/cpp) | [Python](https://google.github.io/mediapipe/getting_started/python) | [JS](https://google.github.io/mediapipe/getting_started/javascript) | [Coral](https://github.com/google/mediapipe/tree/master/mediapipe/examples/coral/README.md)
:---------------------------------------------------------------------------------------- | :-------------------------------------------------------------: | :-----------------------------------------------------: | :-----------------------------------------------------: | :-----------------------------------------------------------: | :-----------------------------------------------------------: | :--------------------------------------------------------------------:
[Face Detection](https://google.github.io/mediapipe/solutions/face_detection) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅
[Face Mesh](https://google.github.io/mediapipe/solutions/face_mesh) | ✅ | ✅ | ✅ | ✅ | ✅ |
[Iris](https://google.github.io/mediapipe/solutions/iris) | ✅ | ✅ | ✅ | | |
[Hands](https://google.github.io/mediapipe/solutions/hands) | ✅ | ✅ | ✅ | ✅ | ✅ |
[Pose](https://google.github.io/mediapipe/solutions/pose) | ✅ | ✅ | ✅ | ✅ | ✅ |
[Holistic](https://google.github.io/mediapipe/solutions/holistic) | ✅ | ✅ | ✅ | ✅ | ✅ |
[Selfie Segmentation](https://google.github.io/mediapipe/solutions/selfie_segmentation) | ✅ | ✅ | ✅ | ✅ | ✅ |
[Hair Segmentation](https://google.github.io/mediapipe/solutions/hair_segmentation) | ✅ | | ✅ | | |
[Object Detection](https://google.github.io/mediapipe/solutions/object_detection) | ✅ | ✅ | ✅ | | | ✅
[Box Tracking](https://google.github.io/mediapipe/solutions/box_tracking) | ✅ | ✅ | ✅ | | |
[Instant Motion Tracking](https://google.github.io/mediapipe/solutions/instant_motion_tracking) | ✅ | | | | |
[Objectron](https://google.github.io/mediapipe/solutions/objectron) | ✅ | | ✅ | ✅ | ✅ |
[KNIFT](https://google.github.io/mediapipe/solutions/knift) | ✅ | | | | |
[AutoFlip](https://google.github.io/mediapipe/solutions/autoflip) | | | ✅ | | |
[MediaSequence](https://google.github.io/mediapipe/solutions/media_sequence) | | | ✅ | | |
[YouTube 8M](https://google.github.io/mediapipe/solutions/youtube_8m) | | | ✅ | | |
* **MediaPipe Model Maker**: Customize models for solutions with your data.
[Learn more](https://developers.google.com/mediapipe/solutions/model_maker).
* **MediaPipe Studio**: Visualize, evaluate, and benchmark solutions in your
browser. [Learn
more](https://developers.google.com/mediapipe/solutions/studio).
See also
[MediaPipe Models and Model Cards](https://google.github.io/mediapipe/solutions/models)
for ML models released in MediaPipe.
### Legacy solutions
## Getting started
We have ended support for [these MediaPipe Legacy Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
as of March 1, 2023. All other MediaPipe Legacy Solutions will be upgraded to
a new MediaPipe Solution. See the [Solutions guide](https://developers.google.com/mediapipe/solutions/guide#legacy)
for details. The [code repository](https://github.com/google/mediapipe/tree/master/mediapipe)
and prebuilt binaries for all MediaPipe Legacy Solutions will continue to be
provided on an as-is basis.
To start using MediaPipe
[solutions](https://google.github.io/mediapipe/solutions/solutions) with only a few
lines code, see example code and demos in
[MediaPipe in Python](https://google.github.io/mediapipe/getting_started/python) and
[MediaPipe in JavaScript](https://google.github.io/mediapipe/getting_started/javascript).
For more on the legacy solutions, see the [documentation](https://github.com/google/mediapipe/tree/master/docs/solutions).
To use MediaPipe in C++, Android and iOS, which allow further customization of
the [solutions](https://google.github.io/mediapipe/solutions/solutions) as well as
building your own, learn how to
[install](https://google.github.io/mediapipe/getting_started/install) MediaPipe and
start building example applications in
[C++](https://google.github.io/mediapipe/getting_started/cpp),
[Android](https://google.github.io/mediapipe/getting_started/android) and
[iOS](https://google.github.io/mediapipe/getting_started/ios).
## Framework
The source code is hosted in the
[MediaPipe Github repository](https://github.com/google/mediapipe), and you can
run code search using
[Google Open Source Code Search](https://cs.opensource.google/mediapipe/mediapipe).
To start using MediaPipe Framework, [install MediaPipe
Framework](https://developers.google.com/mediapipe/framework/getting_started/install)
and start building example applications in C++, Android, and iOS.
## Publications
[MediaPipe Framework](https://developers.google.com/mediapipe/framework) is the
low-level component used to build efficient on-device machine learning
pipelines, similar to the premade MediaPipe Solutions.
Before using MediaPipe Framework, familiarize yourself with the following key
[Framework
concepts](https://developers.google.com/mediapipe/framework/framework_concepts/overview.md):
* [Packets](https://developers.google.com/mediapipe/framework/framework_concepts/packets.md)
* [Graphs](https://developers.google.com/mediapipe/framework/framework_concepts/graphs.md)
* [Calculators](https://developers.google.com/mediapipe/framework/framework_concepts/calculators.md)
## Community
* [Slack community](https://mediapipe.page.link/joinslack) for MediaPipe
users.
* [Discuss](https://groups.google.com/forum/#!forum/mediapipe) - General
community discussion around MediaPipe.
* [Awesome MediaPipe](https://mediapipe.page.link/awesome-mediapipe) - A
curated list of awesome MediaPipe related frameworks, libraries and
software.
## Contributing
We welcome contributions. Please follow these
[guidelines](https://github.com/google/mediapipe/blob/master/CONTRIBUTING.md).
We use GitHub issues for tracking requests and bugs. Please post questions to
the MediaPipe Stack Overflow with a `mediapipe` tag.
## Resources
### Publications
* [Bringing artworks to life with AR](https://developers.googleblog.com/2021/07/bringing-artworks-to-life-with-ar.html)
in Google Developers Blog
@ -102,7 +124,8 @@ run code search using
* [SignAll SDK: Sign language interface using MediaPipe is now available for
developers](https://developers.googleblog.com/2021/04/signall-sdk-sign-language-interface-using-mediapipe-now-available.html)
in Google Developers Blog
* [MediaPipe Holistic - Simultaneous Face, Hand and Pose Prediction, on Device](https://ai.googleblog.com/2020/12/mediapipe-holistic-simultaneous-face.html)
* [MediaPipe Holistic - Simultaneous Face, Hand and Pose Prediction, on
Device](https://ai.googleblog.com/2020/12/mediapipe-holistic-simultaneous-face.html)
in Google AI Blog
* [Background Features in Google Meet, Powered by Web ML](https://ai.googleblog.com/2020/10/background-features-in-google-meet.html)
in Google AI Blog
@ -130,43 +153,6 @@ run code search using
in Google AI Blog
* [MediaPipe: A Framework for Building Perception Pipelines](https://arxiv.org/abs/1906.08172)
## Videos
### Videos
* [YouTube Channel](https://www.youtube.com/c/MediaPipe)
## Events
* [MediaPipe Seattle Meetup, Google Building Waterside, 13 Feb 2020](https://mediapipe.page.link/seattle2020)
* [AI Nextcon 2020, 12-16 Feb 2020, Seattle](http://aisea20.xnextcon.com/)
* [MediaPipe Madrid Meetup, 16 Dec 2019](https://www.meetup.com/Madrid-AI-Developers-Group/events/266329088/)
* [MediaPipe London Meetup, Google 123 Building, 12 Dec 2019](https://www.meetup.com/London-AI-Tech-Talk/events/266329038)
* [ML Conference, Berlin, 11 Dec 2019](https://mlconference.ai/machine-learning-advanced-development/mediapipe-building-real-time-cross-platform-mobile-web-edge-desktop-video-audio-ml-pipelines/)
* [MediaPipe Berlin Meetup, Google Berlin, 11 Dec 2019](https://www.meetup.com/Berlin-AI-Tech-Talk/events/266328794/)
* [The 3rd Workshop on YouTube-8M Large Scale Video Understanding Workshop,
Seoul, Korea ICCV
2019](https://research.google.com/youtube8m/workshop2019/index.html)
* [AI DevWorld 2019, 10 Oct 2019, San Jose, CA](https://aidevworld.com)
* [Google Industry Workshop at ICIP 2019, 24 Sept 2019, Taipei, Taiwan](http://2019.ieeeicip.org/?action=page4&id=14#Google)
([presentation](https://docs.google.com/presentation/d/e/2PACX-1vRIBBbO_LO9v2YmvbHHEt1cwyqH6EjDxiILjuT0foXy1E7g6uyh4CesB2DkkEwlRDO9_lWfuKMZx98T/pub?start=false&loop=false&delayms=3000&slide=id.g556cc1a659_0_5))
* [Open sourced at CVPR 2019, 17~20 June, Long Beach, CA](https://sites.google.com/corp/view/perception-cv4arvr/mediapipe)
## Community
* [Awesome MediaPipe](https://mediapipe.page.link/awesome-mediapipe) - A
curated list of awesome MediaPipe related frameworks, libraries and software
* [Slack community](https://mediapipe.page.link/joinslack) for MediaPipe users
* [Discuss](https://groups.google.com/forum/#!forum/mediapipe) - General
community discussion around MediaPipe
## Alpha disclaimer
MediaPipe is currently in alpha at v0.7. We may be still making breaking API
changes and expect to get to stable APIs by v1.0.
## Contributing
We welcome contributions. Please follow these
[guidelines](https://github.com/google/mediapipe/blob/master/CONTRIBUTING.md).
We use GitHub issues for tracking requests and bugs. Please post questions to
the MediaPipe Stack Overflow with a `mediapipe` tag.

View File

@ -45,12 +45,13 @@ http_archive(
)
http_archive(
name = "rules_foreign_cc",
strip_prefix = "rules_foreign_cc-0.1.0",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.1.0.zip",
name = "rules_foreign_cc",
sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
strip_prefix = "rules_foreign_cc-0.9.0",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/0.9.0.tar.gz",
)
load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies")
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
rules_foreign_cc_dependencies()
@ -72,12 +73,9 @@ http_archive(
http_archive(
name = "zlib",
build_file = "@//third_party:zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
urls = [
"http://mirror.bazel.build/zlib.net/fossils/zlib-1.2.11.tar.gz",
"http://zlib.net/fossils/zlib-1.2.11.tar.gz", # 2017-01-15
],
sha256 = "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30",
strip_prefix = "zlib-1.2.13",
url = "http://zlib.net/fossils/zlib-1.2.13.tar.gz",
patches = [
"@//third_party:zlib.diff",
],
@ -156,22 +154,41 @@ http_archive(
# 2020-08-21
http_archive(
name = "com_github_glog_glog",
strip_prefix = "glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6",
sha256 = "58c9b3b6aaa4dd8b836c0fd8f65d0f941441fb95e27212c5eeb9979cfd3592ab",
strip_prefix = "glog-0.6.0",
sha256 = "8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6",
urls = [
"https://github.com/google/glog/archive/0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6.zip",
"https://github.com/google/glog/archive/v0.6.0.tar.gz",
],
)
http_archive(
name = "com_github_glog_glog_no_gflags",
strip_prefix = "glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6",
sha256 = "58c9b3b6aaa4dd8b836c0fd8f65d0f941441fb95e27212c5eeb9979cfd3592ab",
strip_prefix = "glog-0.6.0",
sha256 = "8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6",
build_file = "@//third_party:glog_no_gflags.BUILD",
urls = [
"https://github.com/google/glog/archive/0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6.zip",
"https://github.com/google/glog/archive/v0.6.0.tar.gz",
],
patches = [
"@//third_party:com_github_glog_glog_9779e5ea6ef59562b030248947f787d1256132ae.diff",
"@//third_party:com_github_glog_glog.diff",
],
patch_args = [
"-p1",
],
)
# 2023-06-05
# This version of Glog is required for Windows support, but currently causes
# crashes on some Android devices.
http_archive(
name = "com_github_glog_glog_windows",
strip_prefix = "glog-3a0d4d22c5ae0b9a2216988411cfa6bf860cc372",
sha256 = "170d08f80210b82d95563f4723a15095eff1aad1863000e8eeb569c96a98fefb",
urls = [
"https://github.com/google/glog/archive/3a0d4d22c5ae0b9a2216988411cfa6bf860cc372.zip",
],
patches = [
"@//third_party:com_github_glog_glog.diff",
"@//third_party:com_github_glog_glog_windows_patch.diff",
],
patch_args = [
"-p1",
@ -227,16 +244,14 @@ http_archive(
# sentencepiece
http_archive(
name = "com_google_sentencepiece",
strip_prefix = "sentencepiece-1.0.0",
sha256 = "c05901f30a1d0ed64cbcf40eba08e48894e1b0e985777217b7c9036cac631346",
strip_prefix = "sentencepiece-0.1.96",
sha256 = "8409b0126ebd62b256c685d5757150cf7fcb2b92a2f2b98efb3f38fc36719754",
urls = [
"https://github.com/google/sentencepiece/archive/1.0.0.zip",
],
patches = [
"@//third_party:com_google_sentencepiece_no_gflag_no_gtest.diff",
"https://github.com/google/sentencepiece/archive/refs/tags/v0.1.96.zip"
],
build_file = "@//third_party:sentencepiece.BUILD",
patches = ["@//third_party:com_google_sentencepiece.diff"],
patch_args = ["-p1"],
repo_mapping = {"@com_google_glog" : "@com_github_glog_glog_no_gflags"},
)
http_archive(
@ -266,10 +281,10 @@ http_archive(
http_archive(
name = "com_googlesource_code_re2",
sha256 = "e06b718c129f4019d6e7aa8b7631bee38d3d450dd980246bfaf493eb7db67868",
strip_prefix = "re2-fe4a310131c37f9a7e7f7816fa6ce2a8b27d65a8",
sha256 = "ef516fb84824a597c4d5d0d6d330daedb18363b5a99eda87d027e6bdd9cba299",
strip_prefix = "re2-03da4fc0857c285e3a26782f6bc8931c4c950df4",
urls = [
"https://github.com/google/re2/archive/fe4a310131c37f9a7e7f7816fa6ce2a8b27d65a8.tar.gz",
"https://github.com/google/re2/archive/03da4fc0857c285e3a26782f6bc8931c4c950df4.tar.gz",
],
)
@ -375,6 +390,22 @@ http_archive(
url = "https://github.com/opencv/opencv/releases/download/3.2.0/opencv-3.2.0-ios-framework.zip",
)
# Building an opencv.xcframework from the OpenCV 4.5.3 sources is necessary for
# MediaPipe iOS Task Libraries to be supported on arm64(M1) Macs. An
# `opencv.xcframework` archive has not been released and it is recommended to
# build the same from source using a script provided in OpenCV 4.5.0 upwards.
# OpenCV is fixed to version to 4.5.3 since swift support can only be disabled
# from 4.5.3 upwards. This is needed to avoid errors when the library is linked
# in Xcode. Swift support will be added in when the final binary MediaPipe iOS
# Task libraries are built.
http_archive(
name = "ios_opencv_source",
sha256 = "a61e7a4618d353140c857f25843f39b2abe5f451b018aab1604ef0bc34cd23d5",
build_file = "@//third_party:opencv_ios_source.BUILD",
type = "zip",
url = "https://github.com/opencv/opencv/archive/refs/tags/4.5.3.zip",
)
http_archive(
name = "stblib",
strip_prefix = "stb-b42009b3b9d4ca35bc703f5310eedc74f584be58",
@ -468,9 +499,10 @@ http_archive(
)
# TensorFlow repo should always go after the other external dependencies.
# TF on 2023-04-12.
_TENSORFLOW_GIT_COMMIT = "d712c0c9e24519cc8cd3720279666720d1000eee"
_TENSORFLOW_SHA256 = "ba98de6ea5f720071246691a1536ecd5e1b1763033e8c82a1e721a06d3dfd4c1"
# TF on 2023-07-26.
_TENSORFLOW_GIT_COMMIT = "e92261fd4cec0b726692081c4d2966b75abf31dd"
# curl -L https://github.com/tensorflow/tensorflow/archive/<TENSORFLOW_GIT_COMMIT>.tar.gz | shasum -a 256
_TENSORFLOW_SHA256 = "478a229bd4ec70a5b568ac23b5ea013d9fca46a47d6c43e30365a0412b9febf4"
http_archive(
name = "org_tensorflow",
urls = [
@ -478,8 +510,12 @@ http_archive(
],
patches = [
"@//third_party:org_tensorflow_compatibility_fixes.diff",
"@//third_party:org_tensorflow_system_python.diff",
# Diff is generated with a script, don't update it manually.
"@//third_party:org_tensorflow_custom_ops.diff",
# Works around Bazel issue with objc_library.
# See https://github.com/bazelbuild/bazel/issues/19912
"@//third_party:org_tensorflow_objc_build_fixes.diff",
],
patch_args = [
"-p1",

View File

@ -0,0 +1,342 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
8566B55D2ABABF9A00AAB22A /* MediaPipeTasksDocGen.h in Headers */ = {isa = PBXBuildFile; fileRef = 8566B55C2ABABF9A00AAB22A /* MediaPipeTasksDocGen.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
8566B5592ABABF9A00AAB22A /* MediaPipeTasksDocGen.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MediaPipeTasksDocGen.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8566B55C2ABABF9A00AAB22A /* MediaPipeTasksDocGen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaPipeTasksDocGen.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8566B5562ABABF9A00AAB22A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
8566B54F2ABABF9A00AAB22A = {
isa = PBXGroup;
children = (
8566B55B2ABABF9A00AAB22A /* MediaPipeTasksDocGen */,
8566B55A2ABABF9A00AAB22A /* Products */,
);
sourceTree = "<group>";
};
8566B55A2ABABF9A00AAB22A /* Products */ = {
isa = PBXGroup;
children = (
8566B5592ABABF9A00AAB22A /* MediaPipeTasksDocGen.framework */,
);
name = Products;
sourceTree = "<group>";
};
8566B55B2ABABF9A00AAB22A /* MediaPipeTasksDocGen */ = {
isa = PBXGroup;
children = (
8566B55C2ABABF9A00AAB22A /* MediaPipeTasksDocGen.h */,
);
path = MediaPipeTasksDocGen;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
8566B5542ABABF9A00AAB22A /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
8566B55D2ABABF9A00AAB22A /* MediaPipeTasksDocGen.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
8566B5582ABABF9A00AAB22A /* MediaPipeTasksDocGen */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8566B5602ABABF9A00AAB22A /* Build configuration list for PBXNativeTarget "MediaPipeTasksDocGen" */;
buildPhases = (
8566B5542ABABF9A00AAB22A /* Headers */,
8566B5552ABABF9A00AAB22A /* Sources */,
8566B5562ABABF9A00AAB22A /* Frameworks */,
8566B5572ABABF9A00AAB22A /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = MediaPipeTasksDocGen;
productName = MediaPipeTasksDocGen;
productReference = 8566B5592ABABF9A00AAB22A /* MediaPipeTasksDocGen.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
8566B5502ABABF9A00AAB22A /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastUpgradeCheck = 1430;
TargetAttributes = {
8566B5582ABABF9A00AAB22A = {
CreatedOnToolsVersion = 14.3.1;
};
};
};
buildConfigurationList = 8566B5532ABABF9A00AAB22A /* Build configuration list for PBXProject "MediaPipeTasksDocGen" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 8566B54F2ABABF9A00AAB22A;
productRefGroup = 8566B55A2ABABF9A00AAB22A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
8566B5582ABABF9A00AAB22A /* MediaPipeTasksDocGen */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8566B5572ABABF9A00AAB22A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8566B5552ABABF9A00AAB22A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
8566B55E2ABABF9A00AAB22A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
8566B55F2ABABF9A00AAB22A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
8566B5612ABABF9A00AAB22A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20";
PRODUCT_BUNDLE_IDENTIFIER = com.google.mediapipe.MediaPipeTasksDocGen;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
8566B5622ABABF9A00AAB22A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20";
PRODUCT_BUNDLE_IDENTIFIER = com.google.mediapipe.MediaPipeTasksDocGen;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
8566B5532ABABF9A00AAB22A /* Build configuration list for PBXProject "MediaPipeTasksDocGen" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8566B55E2ABABF9A00AAB22A /* Debug */,
8566B55F2ABABF9A00AAB22A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8566B5602ABABF9A00AAB22A /* Build configuration list for PBXNativeTarget "MediaPipeTasksDocGen" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8566B5612ABABF9A00AAB22A /* Debug */,
8566B5622ABABF9A00AAB22A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 8566B5502ABABF9A00AAB22A /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>MediaPipeTasksDocGen.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,17 @@
//
// MediaPipeTasksDocGen.h
// MediaPipeTasksDocGen
//
// Created by Mark McDonald on 20/9/2023.
//
#import <Foundation/Foundation.h>
//! Project version number for MediaPipeTasksDocGen.
FOUNDATION_EXPORT double MediaPipeTasksDocGenVersionNumber;
//! Project version string for MediaPipeTasksDocGen.
FOUNDATION_EXPORT const unsigned char MediaPipeTasksDocGenVersionString[];
// In this header, you should import all the public headers of your framework using statements like
// #import <MediaPipeTasksDocGen/PublicHeader.h>

View File

@ -0,0 +1,11 @@
# Uncomment the next line to define a global platform for your project
platform :ios, '15.0'
target 'MediaPipeTasksDocGen' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for MediaPipeTasksDocGen
pod 'MediaPipeTasksText'
pod 'MediaPipeTasksVision'
end

View File

@ -0,0 +1,9 @@
# MediaPipeTasksDocGen
This empty project is used to generate reference documentation for the
ObjectiveC and Swift libraries.
Docs are generated using [Jazzy](https://github.com/realm/jazzy) and published
to [the developer site](https://developers.google.com/mediapipe/solutions/).
To bump the API version used, edit [`Podfile`](./Podfile).

View File

@ -1,4 +1,4 @@
# Copyright 2022 The MediaPipe Authors. All Rights Reserved.
# Copyright 2022 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.
@ -14,6 +14,7 @@
# ==============================================================================
"""Generate Java reference docs for MediaPipe."""
import pathlib
import shutil
from absl import app
from absl import flags
@ -41,7 +42,9 @@ def main(_) -> None:
mp_root = pathlib.Path(__file__)
while (mp_root := mp_root.parent).name != 'mediapipe':
# Find the nearest `mediapipe` dir.
pass
if not mp_root.name:
# We've hit the filesystem root - abort.
raise FileNotFoundError('"mediapipe" root not found')
# Find the root from which all packages are relative.
root = mp_root.parent
@ -51,6 +54,14 @@ def main(_) -> None:
if (mp_root / 'mediapipe').exists():
mp_root = mp_root / 'mediapipe'
# We need to copy this into the tasks dir to ensure we don't leave broken
# links in the generated docs.
old_api_dir = 'java/com/google/mediapipe/framework/image'
shutil.copytree(
mp_root / old_api_dir,
mp_root / 'tasks' / old_api_dir,
dirs_exist_ok=True)
gen_java.gen_java_docs(
package='com.google.mediapipe',
source_path=mp_root / 'tasks/java',

View File

@ -1,4 +1,4 @@
# Copyright 2022 The MediaPipe Authors. All Rights Reserved.
# Copyright 2022 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.

View File

@ -1,4 +1,4 @@
# Copyright 2022 The MediaPipe Authors. All Rights Reserved.
# Copyright 2022 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.

View File

@ -50,7 +50,7 @@ as the primary developer documentation site for MediaPipe as of April 3, 2023.*
3. The [`hello world`] example uses a simple MediaPipe graph in the
`PrintHelloWorld()` function, defined in a [`CalculatorGraphConfig`] proto.
```C++
```c++
absl::Status PrintHelloWorld() {
// Configures a simple graph, which concatenates 2 PassThroughCalculators.
CalculatorGraphConfig config = ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
@ -126,7 +126,7 @@ as the primary developer documentation site for MediaPipe as of April 3, 2023.*
```c++
mediapipe::Packet packet;
while (poller.Next(&packet)) {
LOG(INFO) << packet.Get<string>();
ABSL_LOG(INFO) << packet.Get<string>();
}
```

View File

@ -138,7 +138,7 @@ Create a `BUILD` file in the `$APPLICATION_PATH` and add the following build
rules:
```
MIN_IOS_VERSION = "11.0"
MIN_IOS_VERSION = "12.0"
load(
"@build_bazel_rules_apple//apple:ios.bzl",

View File

@ -1,99 +1,121 @@
---
layout: default
layout: forward
target: https://developers.google.com/mediapipe
title: Home
nav_order: 1
---
![MediaPipe](https://mediapipe.dev/images/mediapipe_small.png)
----
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
**Attention:** *We have moved to
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
*This notice and web page will be removed on June 1, 2023.*
![MediaPipe](https://developers.google.com/static/mediapipe/images/home/hero_01_1920.png)
----
**Attention**: MediaPipe Solutions Preview is an early release. [Learn
more](https://developers.google.com/mediapipe/solutions/about#notice).
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
**On-device machine learning for everyone**
--------------------------------------------------------------------------------
Delight your customers with innovative machine learning features. MediaPipe
contains everything that you need to customize and deploy to mobile (Android,
iOS), web, desktop, edge devices, and IoT, effortlessly.
## Live ML anywhere
* [See demos](https://goo.gle/mediapipe-studio)
* [Learn more](https://developers.google.com/mediapipe/solutions)
[MediaPipe](https://google.github.io/mediapipe/) offers cross-platform, customizable
ML solutions for live and streaming media.
## Get started
![accelerated.png](https://mediapipe.dev/images/accelerated_small.png) | ![cross_platform.png](https://mediapipe.dev/images/cross_platform_small.png)
:------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------:
***End-to-End acceleration***: *Built-in fast ML inference and processing accelerated even on common hardware* | ***Build once, deploy anywhere***: *Unified solution works across Android, iOS, desktop/cloud, web and IoT*
![ready_to_use.png](https://mediapipe.dev/images/ready_to_use_small.png) | ![open_source.png](https://mediapipe.dev/images/open_source_small.png)
***Ready-to-use solutions***: *Cutting-edge ML solutions demonstrating full power of the framework* | ***Free and open source***: *Framework and solutions both under Apache 2.0, fully extensible and customizable*
You can get started with MediaPipe Solutions by by checking out any of the
developer guides for
[vision](https://developers.google.com/mediapipe/solutions/vision/object_detector),
[text](https://developers.google.com/mediapipe/solutions/text/text_classifier),
and
[audio](https://developers.google.com/mediapipe/solutions/audio/audio_classifier)
tasks. If you need help setting up a development environment for use with
MediaPipe Tasks, check out the setup guides for
[Android](https://developers.google.com/mediapipe/solutions/setup_android), [web
apps](https://developers.google.com/mediapipe/solutions/setup_web), and
[Python](https://developers.google.com/mediapipe/solutions/setup_python).
----
## Solutions
## ML solutions in MediaPipe
MediaPipe Solutions provides a suite of libraries and tools for you to quickly
apply artificial intelligence (AI) and machine learning (ML) techniques in your
applications. You can plug these solutions into your applications immediately,
customize them to your needs, and use them across multiple development
platforms. MediaPipe Solutions is part of the MediaPipe [open source
project](https://github.com/google/mediapipe), so you can further customize the
solutions code to meet your application needs.
Face Detection | Face Mesh | Iris | Hands | Pose | Holistic
:----------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | :------:
[![face_detection](https://mediapipe.dev/images/mobile/face_detection_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/face_detection) | [![face_mesh](https://mediapipe.dev/images/mobile/face_mesh_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/face_mesh) | [![iris](https://mediapipe.dev/images/mobile/iris_tracking_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/iris) | [![hand](https://mediapipe.dev/images/mobile/hand_tracking_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/hands) | [![pose](https://mediapipe.dev/images/mobile/pose_tracking_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/pose) | [![hair_segmentation](https://mediapipe.dev/images/mobile/holistic_tracking_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/holistic)
These libraries and resources provide the core functionality for each MediaPipe
Solution:
Hair Segmentation | Object Detection | Box Tracking | Instant Motion Tracking | Objectron | KNIFT
:-------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: | :---:
[![hair_segmentation](https://mediapipe.dev/images/mobile/hair_segmentation_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/hair_segmentation) | [![object_detection](https://mediapipe.dev/images/mobile/object_detection_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/object_detection) | [![box_tracking](https://mediapipe.dev/images/mobile/object_tracking_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/box_tracking) | [![instant_motion_tracking](https://mediapipe.dev/images/mobile/instant_motion_tracking_android_small.gif)](https://google.github.io/mediapipe/solutions/instant_motion_tracking) | [![objectron](https://mediapipe.dev/images/mobile/objectron_chair_android_gpu_small.gif)](https://google.github.io/mediapipe/solutions/objectron) | [![knift](https://mediapipe.dev/images/mobile/template_matching_android_cpu_small.gif)](https://google.github.io/mediapipe/solutions/knift)
* **MediaPipe Tasks**: Cross-platform APIs and libraries for deploying
solutions. [Learn
more](https://developers.google.com/mediapipe/solutions/tasks).
* **MediaPipe models**: Pre-trained, ready-to-run models for use with each
solution.
<!-- []() in the first cell is needed to preserve table formatting in GitHub Pages. -->
<!-- Whenever this table is updated, paste a copy to solutions/solutions.md. -->
These tools let you customize and evaluate solutions:
[]() | [Android](https://google.github.io/mediapipe/getting_started/android) | [iOS](https://google.github.io/mediapipe/getting_started/ios) | [C++](https://google.github.io/mediapipe/getting_started/cpp) | [Python](https://google.github.io/mediapipe/getting_started/python) | [JS](https://google.github.io/mediapipe/getting_started/javascript) | [Coral](https://github.com/google/mediapipe/tree/master/mediapipe/examples/coral/README.md)
:---------------------------------------------------------------------------------------- | :-------------------------------------------------------------: | :-----------------------------------------------------: | :-----------------------------------------------------: | :-----------------------------------------------------------: | :-----------------------------------------------------------: | :--------------------------------------------------------------------:
[Face Detection](https://google.github.io/mediapipe/solutions/face_detection) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅
[Face Mesh](https://google.github.io/mediapipe/solutions/face_mesh) | ✅ | ✅ | ✅ | ✅ | ✅ |
[Iris](https://google.github.io/mediapipe/solutions/iris) | ✅ | ✅ | ✅ | | |
[Hands](https://google.github.io/mediapipe/solutions/hands) | ✅ | ✅ | ✅ | ✅ | ✅ |
[Pose](https://google.github.io/mediapipe/solutions/pose) | ✅ | ✅ | ✅ | ✅ | ✅ |
[Holistic](https://google.github.io/mediapipe/solutions/holistic) | ✅ | ✅ | ✅ | ✅ | ✅ |
[Selfie Segmentation](https://google.github.io/mediapipe/solutions/selfie_segmentation) | ✅ | ✅ | ✅ | ✅ | ✅ |
[Hair Segmentation](https://google.github.io/mediapipe/solutions/hair_segmentation) | ✅ | | ✅ | | |
[Object Detection](https://google.github.io/mediapipe/solutions/object_detection) | ✅ | ✅ | ✅ | | | ✅
[Box Tracking](https://google.github.io/mediapipe/solutions/box_tracking) | ✅ | ✅ | ✅ | | |
[Instant Motion Tracking](https://google.github.io/mediapipe/solutions/instant_motion_tracking) | ✅ | | | | |
[Objectron](https://google.github.io/mediapipe/solutions/objectron) | ✅ | | ✅ | ✅ | ✅ |
[KNIFT](https://google.github.io/mediapipe/solutions/knift) | ✅ | | | | |
[AutoFlip](https://google.github.io/mediapipe/solutions/autoflip) | | | ✅ | | |
[MediaSequence](https://google.github.io/mediapipe/solutions/media_sequence) | | | ✅ | | |
[YouTube 8M](https://google.github.io/mediapipe/solutions/youtube_8m) | | | ✅ | | |
* **MediaPipe Model Maker**: Customize models for solutions with your data.
[Learn more](https://developers.google.com/mediapipe/solutions/model_maker).
* **MediaPipe Studio**: Visualize, evaluate, and benchmark solutions in your
browser. [Learn
more](https://developers.google.com/mediapipe/solutions/studio).
See also
[MediaPipe Models and Model Cards](https://google.github.io/mediapipe/solutions/models)
for ML models released in MediaPipe.
### Legacy solutions
## Getting started
We have ended support for [these MediaPipe Legacy Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
as of March 1, 2023. All other MediaPipe Legacy Solutions will be upgraded to
a new MediaPipe Solution. See the [Solutions guide](https://developers.google.com/mediapipe/solutions/guide#legacy)
for details. The [code repository](https://github.com/google/mediapipe/tree/master/mediapipe)
and prebuilt binaries for all MediaPipe Legacy Solutions will continue to be
provided on an as-is basis.
To start using MediaPipe
[solutions](https://google.github.io/mediapipe/solutions/solutions) with only a few
lines code, see example code and demos in
[MediaPipe in Python](https://google.github.io/mediapipe/getting_started/python) and
[MediaPipe in JavaScript](https://google.github.io/mediapipe/getting_started/javascript).
For more on the legacy solutions, see the [documentation](https://github.com/google/mediapipe/tree/master/docs/solutions).
To use MediaPipe in C++, Android and iOS, which allow further customization of
the [solutions](https://google.github.io/mediapipe/solutions/solutions) as well as
building your own, learn how to
[install](https://google.github.io/mediapipe/getting_started/install) MediaPipe and
start building example applications in
[C++](https://google.github.io/mediapipe/getting_started/cpp),
[Android](https://google.github.io/mediapipe/getting_started/android) and
[iOS](https://google.github.io/mediapipe/getting_started/ios).
## Framework
The source code is hosted in the
[MediaPipe Github repository](https://github.com/google/mediapipe), and you can
run code search using
[Google Open Source Code Search](https://cs.opensource.google/mediapipe/mediapipe).
To start using MediaPipe Framework, [install MediaPipe
Framework](https://developers.google.com/mediapipe/framework/getting_started/install)
and start building example applications in C++, Android, and iOS.
## Publications
[MediaPipe Framework](https://developers.google.com/mediapipe/framework) is the
low-level component used to build efficient on-device machine learning
pipelines, similar to the premade MediaPipe Solutions.
Before using MediaPipe Framework, familiarize yourself with the following key
[Framework
concepts](https://developers.google.com/mediapipe/framework/framework_concepts/overview.md):
* [Packets](https://developers.google.com/mediapipe/framework/framework_concepts/packets.md)
* [Graphs](https://developers.google.com/mediapipe/framework/framework_concepts/graphs.md)
* [Calculators](https://developers.google.com/mediapipe/framework/framework_concepts/calculators.md)
## Community
* [Slack community](https://mediapipe.page.link/joinslack) for MediaPipe
users.
* [Discuss](https://groups.google.com/forum/#!forum/mediapipe) - General
community discussion around MediaPipe.
* [Awesome MediaPipe](https://mediapipe.page.link/awesome-mediapipe) - A
curated list of awesome MediaPipe related frameworks, libraries and
software.
## Contributing
We welcome contributions. Please follow these
[guidelines](https://github.com/google/mediapipe/blob/master/CONTRIBUTING.md).
We use GitHub issues for tracking requests and bugs. Please post questions to
the MediaPipe Stack Overflow with a `mediapipe` tag.
## Resources
### Publications
* [Bringing artworks to life with AR](https://developers.googleblog.com/2021/07/bringing-artworks-to-life-with-ar.html)
in Google Developers Blog
@ -102,7 +124,8 @@ run code search using
* [SignAll SDK: Sign language interface using MediaPipe is now available for
developers](https://developers.googleblog.com/2021/04/signall-sdk-sign-language-interface-using-mediapipe-now-available.html)
in Google Developers Blog
* [MediaPipe Holistic - Simultaneous Face, Hand and Pose Prediction, on Device](https://ai.googleblog.com/2020/12/mediapipe-holistic-simultaneous-face.html)
* [MediaPipe Holistic - Simultaneous Face, Hand and Pose Prediction, on
Device](https://ai.googleblog.com/2020/12/mediapipe-holistic-simultaneous-face.html)
in Google AI Blog
* [Background Features in Google Meet, Powered by Web ML](https://ai.googleblog.com/2020/10/background-features-in-google-meet.html)
in Google AI Blog
@ -130,43 +153,6 @@ run code search using
in Google AI Blog
* [MediaPipe: A Framework for Building Perception Pipelines](https://arxiv.org/abs/1906.08172)
## Videos
### Videos
* [YouTube Channel](https://www.youtube.com/c/MediaPipe)
## Events
* [MediaPipe Seattle Meetup, Google Building Waterside, 13 Feb 2020](https://mediapipe.page.link/seattle2020)
* [AI Nextcon 2020, 12-16 Feb 2020, Seattle](http://aisea20.xnextcon.com/)
* [MediaPipe Madrid Meetup, 16 Dec 2019](https://www.meetup.com/Madrid-AI-Developers-Group/events/266329088/)
* [MediaPipe London Meetup, Google 123 Building, 12 Dec 2019](https://www.meetup.com/London-AI-Tech-Talk/events/266329038)
* [ML Conference, Berlin, 11 Dec 2019](https://mlconference.ai/machine-learning-advanced-development/mediapipe-building-real-time-cross-platform-mobile-web-edge-desktop-video-audio-ml-pipelines/)
* [MediaPipe Berlin Meetup, Google Berlin, 11 Dec 2019](https://www.meetup.com/Berlin-AI-Tech-Talk/events/266328794/)
* [The 3rd Workshop on YouTube-8M Large Scale Video Understanding Workshop,
Seoul, Korea ICCV
2019](https://research.google.com/youtube8m/workshop2019/index.html)
* [AI DevWorld 2019, 10 Oct 2019, San Jose, CA](https://aidevworld.com)
* [Google Industry Workshop at ICIP 2019, 24 Sept 2019, Taipei, Taiwan](http://2019.ieeeicip.org/?action=page4&id=14#Google)
([presentation](https://docs.google.com/presentation/d/e/2PACX-1vRIBBbO_LO9v2YmvbHHEt1cwyqH6EjDxiILjuT0foXy1E7g6uyh4CesB2DkkEwlRDO9_lWfuKMZx98T/pub?start=false&loop=false&delayms=3000&slide=id.g556cc1a659_0_5))
* [Open sourced at CVPR 2019, 17~20 June, Long Beach, CA](https://sites.google.com/corp/view/perception-cv4arvr/mediapipe)
## Community
* [Awesome MediaPipe](https://mediapipe.page.link/awesome-mediapipe) - A
curated list of awesome MediaPipe related frameworks, libraries and software
* [Slack community](https://mediapipe.page.link/joinslack) for MediaPipe users
* [Discuss](https://groups.google.com/forum/#!forum/mediapipe) - General
community discussion around MediaPipe
## Alpha disclaimer
MediaPipe is currently in alpha at v0.7. We may be still making breaking API
changes and expect to get to stable APIs by v1.0.
## Contributing
We welcome contributions. Please follow these
[guidelines](https://github.com/google/mediapipe/blob/master/CONTRIBUTING.md).
We use GitHub issues for tracking requests and bugs. Please post questions to
the MediaPipe Stack Overflow with a `mediapipe` tag.

View File

@ -20,9 +20,9 @@ nav_order: 1
---
**Attention:** *Thank you for your interest in MediaPipe Solutions.
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
As of May 10, 2023, this solution was upgraded to a new MediaPipe
Solution. For more information, see the
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/face_detector)
site.*
----

View File

@ -20,9 +20,9 @@ nav_order: 2
---
**Attention:** *Thank you for your interest in MediaPipe Solutions.
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
As of May 10, 2023, this solution was upgraded to a new MediaPipe
Solution. For more information, see the
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/face_landmarker)
site.*
----

View File

@ -20,9 +20,9 @@ nav_order: 3
---
**Attention:** *Thank you for your interest in MediaPipe Solutions.
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
As of May 10, 2023, this solution was upgraded to a new MediaPipe
Solution. For more information, see the
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/face_landmarker)
site.*
----

View File

@ -22,9 +22,9 @@ nav_order: 5
---
**Attention:** *Thank you for your interest in MediaPipe Solutions.
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
As of May 10, 2023, this solution was upgraded to a new MediaPipe
Solution. For more information, see the
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/pose_landmarker/)
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/pose_landmarker)
site.*
----

View File

@ -21,7 +21,7 @@ nav_order: 1
---
**Attention:** *Thank you for your interest in MediaPipe Solutions.
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
As of May 10, 2023, this solution was upgraded to a new MediaPipe
Solution. For more information, see the
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/pose_landmarker/)
site.*

View File

@ -1,5 +1,6 @@
---
layout: default
layout: forward
target: https://developers.google.com/mediapipe/solutions/guide#legacy
title: MediaPipe Legacy Solutions
nav_order: 3
has_children: true
@ -13,8 +14,7 @@ has_toc: false
{:toc}
---
**Attention:** *Thank you for your interest in MediaPipe Solutions. We have
ended support for
**Attention:** *We have ended support for
[these MediaPipe Legacy Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
as of March 1, 2023. All other
[MediaPipe Legacy Solutions will be upgraded](https://developers.google.com/mediapipe/solutions/guide#legacy)
@ -25,14 +25,6 @@ be provided on an as-is basis. We encourage you to check out the new MediaPipe
Solutions at:
[https://developers.google.com/mediapipe/solutions](https://developers.google.com/mediapipe/solutions)*
*This notice and web page will be removed on June 1, 2023.*
----
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
----
MediaPipe offers open source cross-platform, customizable ML solutions for live

View File

@ -14,81 +14,155 @@
licenses(["notice"]) # Apache 2.0
# Note: yes, these need to use "//external:android/crosstool", not
# @androidndk//:default_crosstool.
load("@mediapipe//mediapipe:platforms.bzl", "config_setting_and_platform")
# Generic Android
config_setting(
name = "android",
values = {"crosstool_top": "//external:android/crosstool"},
constraint_values = [
"@platforms//os:android",
],
visibility = ["//visibility:public"],
)
config_setting(
# Android x86 32-bit.
config_setting_and_platform(
name = "android_x86",
values = {
"crosstool_top": "//external:android/crosstool",
"cpu": "x86",
},
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:x86_32",
],
visibility = ["//visibility:public"],
)
config_setting(
# Android x86 64-bit.
config_setting_and_platform(
name = "android_x86_64",
values = {
"crosstool_top": "//external:android/crosstool",
"cpu": "x86_64",
},
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:x86_64",
],
visibility = ["//visibility:public"],
)
config_setting(
name = "android_armeabi",
values = {
"crosstool_top": "//external:android/crosstool",
"cpu": "armeabi",
},
visibility = ["//visibility:public"],
)
config_setting(
# Android ARMv7.
config_setting_and_platform(
name = "android_arm",
values = {
"crosstool_top": "//external:android/crosstool",
"cpu": "armeabi-v7a",
},
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:armv7",
],
visibility = ["//visibility:public"],
)
config_setting(
# Android ARM64.
config_setting_and_platform(
name = "android_arm64",
values = {
"crosstool_top": "//external:android/crosstool",
"cpu": "arm64-v8a",
},
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:arm64",
],
visibility = ["//visibility:public"],
)
# Note: this cannot just match "apple_platform_type": "macos" because that option
# defaults to "macos" even when building on Linux!
alias(
# Generic MacOS.
config_setting(
name = "macos",
actual = select({
":macos_i386": ":macos_i386",
":macos_x86_64": ":macos_x86_64",
":macos_arm64": ":macos_arm64",
"//conditions:default": ":macos_i386", # Arbitrarily chosen from above.
}),
constraint_values = [
"@platforms//os:macos",
],
visibility = ["//visibility:public"],
)
# Note: this also matches on crosstool_top so that it does not produce ambiguous
# selectors when used together with "android".
# MacOS x86 64-bit.
config_setting_and_platform(
name = "macos_x86_64",
constraint_values = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
visibility = ["//visibility:public"],
)
# MacOS ARM64.
config_setting_and_platform(
name = "macos_arm64",
constraint_values = [
"@platforms//os:macos",
"@platforms//cpu:arm64",
],
visibility = ["//visibility:public"],
)
# Generic iOS.
config_setting(
name = "ios",
values = {
"crosstool_top": "@bazel_tools//tools/cpp:toolchain",
"apple_platform_type": "ios",
},
constraint_values = [
"@platforms//os:ios",
],
visibility = ["//visibility:public"],
)
# iOS device ARM32.
config_setting_and_platform(
name = "ios_armv7",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:arm",
],
visibility = ["//visibility:public"],
)
# iOS device ARM64.
config_setting_and_platform(
name = "ios_arm64",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:arm64",
],
visibility = ["//visibility:public"],
)
# iOS device ARM64E.
config_setting_and_platform(
name = "ios_arm64e",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:arm64e",
],
visibility = ["//visibility:public"],
)
# iOS simulator x86 32-bit.
config_setting_and_platform(
name = "ios_i386",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:x86_32",
"@build_bazel_apple_support//constraints:simulator",
],
visibility = ["//visibility:public"],
)
# iOS simulator x86 64-bit.
config_setting_and_platform(
name = "ios_x86_64",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:x86_64",
"@build_bazel_apple_support//constraints:simulator",
],
visibility = ["//visibility:public"],
)
# iOS simulator ARM64.
config_setting_and_platform(
name = "ios_sim_arm64",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:arm64",
"@build_bazel_apple_support//constraints:simulator",
],
visibility = ["//visibility:public"],
)
@ -102,51 +176,24 @@ alias(
visibility = ["//visibility:public"],
)
config_setting(
name = "macos_i386",
values = {
"apple_platform_type": "macos",
"cpu": "darwin",
},
visibility = ["//visibility:public"],
)
config_setting(
name = "macos_x86_64",
values = {
"apple_platform_type": "macos",
"cpu": "darwin_x86_64",
},
visibility = ["//visibility:public"],
)
config_setting(
name = "macos_arm64",
values = {
"apple_platform_type": "macos",
"cpu": "darwin_arm64",
},
visibility = ["//visibility:public"],
)
[
config_setting(
name = arch,
values = {"cpu": arch},
visibility = ["//visibility:public"],
)
for arch in [
"ios_i386",
"ios_x86_64",
"ios_armv7",
"ios_arm64",
"ios_arm64e",
]
]
config_setting(
# Windows 64-bit.
config_setting_and_platform(
name = "windows",
values = {"cpu": "x64_windows"},
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
visibility = ["//visibility:public"],
)
# Linux 64-bit.
config_setting_and_platform(
name = "linux",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
visibility = ["//visibility:public"],
)
exports_files(

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Placeholder: load py_proto_library
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_cc_proto_library")
licenses(["notice"])
@ -145,6 +146,7 @@ cc_library(
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:status",
"//mediapipe/util:time_series_util",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/strings",
"@com_google_audio_tools//audio/dsp/mfcc",
"@eigen_archive//:eigen3",
@ -163,8 +165,9 @@ cc_library(
"//mediapipe/framework/formats:matrix",
"//mediapipe/framework/formats:time_series_header_cc_proto",
"//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging",
"//mediapipe/util:time_series_util",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings",
"@com_google_audio_tools//audio/dsp:resampler",
"@com_google_audio_tools//audio/dsp:resampler_q",
@ -185,6 +188,7 @@ cc_library(
"//mediapipe/framework/port:core_proto",
"//mediapipe/framework/port:status",
"//mediapipe/util:time_series_util",
"@com_google_absl//absl/log:absl_check",
],
alwayslink = 1,
)
@ -219,13 +223,12 @@ cc_library(
deps = [
":time_series_framer_calculator_cc_proto",
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework:timestamp",
"//mediapipe/framework/formats:matrix",
"//mediapipe/framework/formats:time_series_header_cc_proto",
"//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"//mediapipe/util:time_series_util",
"@com_google_absl//absl/log:absl_check",
"@com_google_audio_tools//audio/dsp:window_functions",
"@eigen_archive//:eigen3",
],
@ -296,6 +299,7 @@ cc_test(
"//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:status",
"//mediapipe/util:time_series_test_util",
"@com_google_absl//absl/log:absl_log",
"@com_google_audio_tools//audio/dsp:number_util",
"@eigen_archive//:eigen3",
],
@ -319,6 +323,21 @@ cc_test(
],
)
cc_binary(
name = "time_series_framer_calculator_benchmark",
srcs = ["time_series_framer_calculator_benchmark.cc"],
deps = [
":time_series_framer_calculator",
":time_series_framer_calculator_cc_proto",
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework:packet",
"//mediapipe/framework/formats:matrix",
"//mediapipe/framework/formats:time_series_header_cc_proto",
"@com_google_absl//absl/log:absl_check",
"@com_google_benchmark//:benchmark",
],
)
cc_test(
name = "time_series_framer_calculator_test",
srcs = ["time_series_framer_calculator_test.cc"],
@ -333,6 +352,7 @@ cc_test(
"//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:status",
"//mediapipe/util:time_series_test_util",
"@com_google_absl//absl/log:absl_log",
"@com_google_audio_tools//audio/dsp:window_functions",
"@eigen_archive//:eigen3",
],

View File

@ -23,6 +23,7 @@
#include <vector>
#include "Eigen/Core"
#include "absl/log/absl_check.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "absl/strings/substitute.h"
@ -138,7 +139,7 @@ absl::Status FramewiseTransformCalculatorBase::Process(CalculatorContext* cc) {
TransformFrame(input_frame, &output_frame);
// Copy output from vector<float> to Eigen::Vector.
CHECK_EQ(output_frame.size(), num_output_channels_);
ABSL_CHECK_EQ(output_frame.size(), num_output_channels_);
Eigen::Map<const Eigen::MatrixXd> output_frame_map(&output_frame[0],
output_frame.size(), 1);
output->col(frame) = output_frame_map.cast<float>();

View File

@ -16,6 +16,8 @@
#include "mediapipe/calculators/audio/rational_factor_resample_calculator.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "audio/dsp/resampler_q.h"
using audio_dsp::Resampler;
@ -45,9 +47,9 @@ void CopyVectorToChannel(const std::vector<float>& vec, Matrix* matrix,
if (matrix->cols() == 0) {
matrix->resize(matrix->rows(), vec.size());
} else {
CHECK_EQ(vec.size(), matrix->cols());
ABSL_CHECK_EQ(vec.size(), matrix->cols());
}
CHECK_LT(channel, matrix->rows());
ABSL_CHECK_LT(channel, matrix->rows());
matrix->row(channel) =
Eigen::Map<const Eigen::ArrayXf>(vec.data(), vec.size());
}
@ -77,7 +79,7 @@ absl::Status RationalFactorResampleCalculator::Open(CalculatorContext* cc) {
r = ResamplerFromOptions(source_sample_rate_, target_sample_rate_,
resample_options);
if (!r) {
LOG(ERROR) << "Failed to initialize resampler.";
ABSL_LOG(ERROR) << "Failed to initialize resampler.";
return absl::UnknownError("Failed to initialize resampler.");
}
}

View File

@ -27,7 +27,6 @@
#include "mediapipe/framework/formats/matrix.h"
#include "mediapipe/framework/formats/time_series_header.pb.h"
#include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/util/time_series_util.h"
namespace mediapipe {

View File

@ -210,6 +210,23 @@ REGISTER_CALCULATOR(SpectrogramCalculator);
// Factor to convert ln(SQUARED_MAGNITUDE) to deciBels = 10.0/ln(10.0).
const float SpectrogramCalculator::kLnSquaredMagnitudeToDb = 4.342944819032518;
namespace {
std::unique_ptr<audio_dsp::WindowFunction> MakeWindowFun(
const SpectrogramCalculatorOptions::WindowType window_type) {
switch (window_type) {
// The cosine window and square root of Hann are equivalent.
case SpectrogramCalculatorOptions::COSINE:
case SpectrogramCalculatorOptions::SQRT_HANN:
return std::make_unique<audio_dsp::CosineWindow>();
case SpectrogramCalculatorOptions::HANN:
return std::make_unique<audio_dsp::HannWindow>();
case SpectrogramCalculatorOptions::HAMMING:
return std::make_unique<audio_dsp::HammingWindow>();
}
return nullptr;
}
} // namespace
absl::Status SpectrogramCalculator::Open(CalculatorContext* cc) {
SpectrogramCalculatorOptions spectrogram_options =
cc->Options<SpectrogramCalculatorOptions>();
@ -266,28 +283,14 @@ absl::Status SpectrogramCalculator::Open(CalculatorContext* cc) {
output_scale_ = spectrogram_options.output_scale();
std::vector<double> window;
switch (spectrogram_options.window_type()) {
case SpectrogramCalculatorOptions::COSINE:
audio_dsp::CosineWindow().GetPeriodicSamples(frame_duration_samples_,
&window);
break;
case SpectrogramCalculatorOptions::HANN:
audio_dsp::HannWindow().GetPeriodicSamples(frame_duration_samples_,
&window);
break;
case SpectrogramCalculatorOptions::HAMMING:
audio_dsp::HammingWindow().GetPeriodicSamples(frame_duration_samples_,
&window);
break;
case SpectrogramCalculatorOptions::SQRT_HANN: {
audio_dsp::HannWindow().GetPeriodicSamples(frame_duration_samples_,
&window);
absl::c_transform(window, window.begin(),
[](double x) { return std::sqrt(x); });
break;
}
auto window_fun = MakeWindowFun(spectrogram_options.window_type());
if (window_fun == nullptr) {
return absl::Status(absl::StatusCode::kInvalidArgument,
absl::StrCat("Invalid window type ",
spectrogram_options.window_type()));
}
std::vector<double> window;
window_fun->GetPeriodicSamples(frame_duration_samples_, &window);
// Propagate settings down to the actual Spectrogram object.
spectrogram_generators_.clear();
@ -433,9 +436,9 @@ absl::Status SpectrogramCalculator::ProcessVectorToOutput(
absl::Status SpectrogramCalculator::ProcessVector(const Matrix& input_stream,
CalculatorContext* cc) {
switch (output_type_) {
// These blocks deliberately ignore clang-format to preserve the
// "silhouette" of the different cases.
// clang-format off
// These blocks deliberately ignore clang-format to preserve the
// "silhouette" of the different cases.
// clang-format off
case SpectrogramCalculatorOptions::COMPLEX: {
return ProcessVectorToOutput(
input_stream,

View File

@ -68,7 +68,7 @@ message SpectrogramCalculatorOptions {
HANN = 0;
HAMMING = 1;
COSINE = 2;
SQRT_HANN = 4;
SQRT_HANN = 4; // Alias of COSINE.
}
optional WindowType window_type = 6 [default = HANN];
@ -80,7 +80,7 @@ message SpectrogramCalculatorOptions {
// If use_local_timestamp is true, the output packet's timestamp is based on
// the last sample of the packet and it's inferred from the latest input
// packet's timestamp. If false, the output packet's timestamp is based on
// the cumulative timestamping, which is inferred from the intial input
// the cumulative timestamping, which is inferred from the initial input
// timestamp and the cumulative number of samples.
optional bool use_local_timestamp = 8 [default = false];
}

View File

@ -22,6 +22,7 @@
#include <vector>
#include "Eigen/Core"
#include "absl/log/absl_log.h"
#include "audio/dsp/number_util.h"
#include "mediapipe/calculators/audio/spectrogram_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
@ -882,11 +883,11 @@ void BM_ProcessDC(benchmark::State& state) {
const CalculatorRunner::StreamContents& output = runner.Outputs().Index(0);
const Matrix& output_matrix = output.packets[0].Get<Matrix>();
LOG(INFO) << "Output matrix=" << output_matrix.rows() << "x"
<< output_matrix.cols();
LOG(INFO) << "First values=" << output_matrix(0, 0) << ", "
<< output_matrix(1, 0) << ", " << output_matrix(2, 0) << ", "
<< output_matrix(3, 0);
ABSL_LOG(INFO) << "Output matrix=" << output_matrix.rows() << "x"
<< output_matrix.cols();
ABSL_LOG(INFO) << "First values=" << output_matrix(0, 0) << ", "
<< output_matrix(1, 0) << ", " << output_matrix(2, 0) << ", "
<< output_matrix(3, 0);
}
BENCHMARK(BM_ProcessDC);

View File

@ -18,6 +18,7 @@
#include <memory>
#include <string>
#include "absl/log/absl_check.h"
#include "mediapipe/calculators/audio/stabilized_log_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/matrix.h"
@ -59,7 +60,7 @@ class StabilizedLogCalculator : public CalculatorBase {
output_scale_ = stabilized_log_calculator_options.output_scale();
check_nonnegativity_ =
stabilized_log_calculator_options.check_nonnegativity();
CHECK_GE(stabilizer_, 0.0)
ABSL_CHECK_GE(stabilizer_, 0.0)
<< "stabilizer must be >= 0.0, received a value of " << stabilizer_;
// If the input packets have a header, propagate the header to the output.

View File

@ -15,19 +15,17 @@
// Defines TimeSeriesFramerCalculator.
#include <math.h>
#include <deque>
#include <memory>
#include <string>
#include <vector>
#include "Eigen/Core"
#include "absl/log/absl_check.h"
#include "audio/dsp/window_functions.h"
#include "mediapipe/calculators/audio/time_series_framer_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/matrix.h"
#include "mediapipe/framework/formats/time_series_header.pb.h"
#include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/timestamp.h"
#include "mediapipe/util/time_series_util.h"
namespace mediapipe {
@ -88,11 +86,6 @@ class TimeSeriesFramerCalculator : public CalculatorBase {
absl::Status Close(CalculatorContext* cc) override;
private:
// Adds input data to the internal buffer.
void EnqueueInput(CalculatorContext* cc);
// Constructs and emits framed output packets.
void FrameOutput(CalculatorContext* cc);
Timestamp CurrentOutputTimestamp() {
if (use_local_timestamp_) {
return current_timestamp_;
@ -106,21 +99,13 @@ class TimeSeriesFramerCalculator : public CalculatorBase {
Timestamp::kTimestampUnitsPerSecond);
}
// Returns the timestamp of a sample on a base, which is usually the time
// stamp of a packet.
Timestamp CurrentSampleTimestamp(const Timestamp& timestamp_base,
int64_t number_of_samples) {
return timestamp_base + round(number_of_samples / sample_rate_ *
Timestamp::kTimestampUnitsPerSecond);
}
// The number of input samples to advance after the current output frame is
// emitted.
int next_frame_step_samples() const {
// All numbers are in input samples.
const int64_t current_output_frame_start = static_cast<int64_t>(
round(cumulative_output_frames_ * average_frame_step_samples_));
CHECK_EQ(current_output_frame_start, cumulative_completed_samples_);
ABSL_CHECK_EQ(current_output_frame_start, cumulative_completed_samples_);
const int64_t next_output_frame_start = static_cast<int64_t>(
round((cumulative_output_frames_ + 1) * average_frame_step_samples_));
return next_output_frame_start - current_output_frame_start;
@ -142,61 +127,174 @@ class TimeSeriesFramerCalculator : public CalculatorBase {
Timestamp initial_input_timestamp_;
// The current timestamp is updated along with the incoming packets.
Timestamp current_timestamp_;
int num_channels_;
// Each entry in this deque consists of a single sample, i.e. a
// single column vector, and its timestamp.
std::deque<std::pair<Matrix, Timestamp>> sample_buffer_;
// Samples are buffered in a vector of sample blocks.
class SampleBlockBuffer {
public:
// Initializes the buffer.
void Init(double sample_rate, int num_channels) {
ts_units_per_sample_ = Timestamp::kTimestampUnitsPerSecond / sample_rate;
num_channels_ = num_channels;
num_samples_ = 0;
first_block_offset_ = 0;
}
// Number of channels, equal to the number of rows in each Matrix.
int num_channels() const { return num_channels_; }
// Total number of available samples over all blocks.
int num_samples() const { return num_samples_; }
// Pushes a new block of samples on the back of the buffer with `timestamp`
// being the input timestamp of the packet containing the Matrix.
void Push(const Matrix& samples, Timestamp timestamp);
// Copies `count` samples from the front of the buffer. If there are fewer
// samples than this, the result is zero padded to have `count` samples.
// The timestamp of the last copied sample is written to *last_timestamp.
// This output is used below to update `current_timestamp_`, which is only
// used when `use_local_timestamp` is true.
Matrix CopySamples(int count, Timestamp* last_timestamp) const;
// Drops `count` samples from the front of the buffer. If `count` exceeds
// `num_samples()`, the buffer is emptied. Returns how many samples were
// dropped.
int DropSamples(int count);
private:
struct Block {
// Matrix of num_channels rows by num_samples columns, a block of possibly
// multiple samples.
Matrix samples;
// Timestamp of the first sample in the Block. This comes from the input
// packet's timestamp that contains this Matrix.
Timestamp timestamp;
Block() : timestamp(Timestamp::Unstarted()) {}
Block(const Matrix& samples, Timestamp timestamp)
: samples(samples), timestamp(timestamp) {}
int num_samples() const { return samples.cols(); }
};
std::vector<Block> blocks_;
// Number of timestamp units per sample. Used to compute timestamps as
// nth sample timestamp = base_timestamp + round(ts_units_per_sample_ * n).
double ts_units_per_sample_;
// Number of rows in each Matrix.
int num_channels_;
// The total number of samples over all blocks, equal to
// (sum_i blocks_[i].num_samples()) - first_block_offset_.
int num_samples_;
// The number of samples in the first block that have been discarded. This
// way we can cheaply represent "partially discarding" a block.
int first_block_offset_;
} sample_buffer_;
bool use_window_;
Matrix window_;
Eigen::RowVectorXf window_;
bool use_local_timestamp_;
};
REGISTER_CALCULATOR(TimeSeriesFramerCalculator);
void TimeSeriesFramerCalculator::EnqueueInput(CalculatorContext* cc) {
const Matrix& input_frame = cc->Inputs().Index(0).Get<Matrix>();
for (int i = 0; i < input_frame.cols(); ++i) {
sample_buffer_.emplace_back(std::make_pair(
input_frame.col(i), CurrentSampleTimestamp(cc->InputTimestamp(), i)));
}
void TimeSeriesFramerCalculator::SampleBlockBuffer::Push(const Matrix& samples,
Timestamp timestamp) {
num_samples_ += samples.cols();
blocks_.emplace_back(samples, timestamp);
}
void TimeSeriesFramerCalculator::FrameOutput(CalculatorContext* cc) {
while (sample_buffer_.size() >=
Matrix TimeSeriesFramerCalculator::SampleBlockBuffer::CopySamples(
int count, Timestamp* last_timestamp) const {
Matrix copied(num_channels_, count);
if (!blocks_.empty()) {
int num_copied = 0;
// First block has an offset for samples that have been discarded.
int offset = first_block_offset_;
int n;
Timestamp last_block_ts;
int last_sample_index;
for (auto it = blocks_.begin(); it != blocks_.end() && count > 0; ++it) {
n = std::min(it->num_samples() - offset, count);
// Copy `n` samples from the next block.
copied.middleCols(num_copied, n) = it->samples.middleCols(offset, n);
count -= n;
num_copied += n;
last_block_ts = it->timestamp;
last_sample_index = offset + n - 1;
offset = 0; // No samples have been discarded in subsequent blocks.
}
// Compute the timestamp of the last copied sample.
*last_timestamp =
last_block_ts + std::round(ts_units_per_sample_ * last_sample_index);
}
if (count > 0) {
copied.rightCols(count).setZero(); // Zero pad if needed.
}
return copied;
}
int TimeSeriesFramerCalculator::SampleBlockBuffer::DropSamples(int count) {
if (blocks_.empty()) {
return 0;
}
auto block_it = blocks_.begin();
if (first_block_offset_ + count < block_it->num_samples()) {
// `count` is less than the remaining samples in the first block.
first_block_offset_ += count;
num_samples_ -= count;
return count;
}
int num_samples_dropped = block_it->num_samples() - first_block_offset_;
count -= num_samples_dropped;
first_block_offset_ = 0;
for (++block_it; block_it != blocks_.end(); ++block_it) {
if (block_it->num_samples() > count) {
break;
}
num_samples_dropped += block_it->num_samples();
count -= block_it->num_samples();
}
blocks_.erase(blocks_.begin(), block_it); // Drop whole blocks.
if (!blocks_.empty()) {
first_block_offset_ = count; // Drop part of the next block.
num_samples_dropped += count;
}
num_samples_ -= num_samples_dropped;
return num_samples_dropped;
}
absl::Status TimeSeriesFramerCalculator::Process(CalculatorContext* cc) {
if (initial_input_timestamp_ == Timestamp::Unstarted()) {
initial_input_timestamp_ = cc->InputTimestamp();
current_timestamp_ = initial_input_timestamp_;
}
// Add input data to the internal buffer.
sample_buffer_.Push(cc->Inputs().Index(0).Get<Matrix>(),
cc->InputTimestamp());
// Construct and emit framed output packets.
while (sample_buffer_.num_samples() >=
frame_duration_samples_ + samples_still_to_drop_) {
while (samples_still_to_drop_ > 0) {
sample_buffer_.pop_front();
--samples_still_to_drop_;
}
sample_buffer_.DropSamples(samples_still_to_drop_);
Matrix output_frame = sample_buffer_.CopySamples(frame_duration_samples_,
&current_timestamp_);
const int frame_step_samples = next_frame_step_samples();
std::unique_ptr<Matrix> output_frame(
new Matrix(num_channels_, frame_duration_samples_));
for (int i = 0; i < std::min(frame_step_samples, frame_duration_samples_);
++i) {
output_frame->col(i) = sample_buffer_.front().first;
current_timestamp_ = sample_buffer_.front().second;
sample_buffer_.pop_front();
}
const int frame_overlap_samples =
frame_duration_samples_ - frame_step_samples;
if (frame_overlap_samples > 0) {
for (int i = 0; i < frame_overlap_samples; ++i) {
output_frame->col(i + frame_step_samples) = sample_buffer_[i].first;
current_timestamp_ = sample_buffer_[i].second;
}
} else {
samples_still_to_drop_ = -frame_overlap_samples;
}
samples_still_to_drop_ = frame_step_samples;
if (use_window_) {
*output_frame = (output_frame->array() * window_.array()).matrix();
// Apply the window to each row of output_frame.
output_frame.array().rowwise() *= window_.array();
}
cc->Outputs().Index(0).Add(output_frame.release(),
CurrentOutputTimestamp());
cc->Outputs().Index(0).AddPacket(MakePacket<Matrix>(std::move(output_frame))
.At(CurrentOutputTimestamp()));
++cumulative_output_frames_;
cumulative_completed_samples_ += frame_step_samples;
}
@ -206,35 +304,18 @@ void TimeSeriesFramerCalculator::FrameOutput(CalculatorContext* cc) {
// fact to enable packet queueing optimizations.
cc->Outputs().Index(0).SetNextTimestampBound(CumulativeOutputTimestamp());
}
}
absl::Status TimeSeriesFramerCalculator::Process(CalculatorContext* cc) {
if (initial_input_timestamp_ == Timestamp::Unstarted()) {
initial_input_timestamp_ = cc->InputTimestamp();
current_timestamp_ = initial_input_timestamp_;
}
EnqueueInput(cc);
FrameOutput(cc);
return absl::OkStatus();
}
absl::Status TimeSeriesFramerCalculator::Close(CalculatorContext* cc) {
while (samples_still_to_drop_ > 0 && !sample_buffer_.empty()) {
sample_buffer_.pop_front();
--samples_still_to_drop_;
}
if (!sample_buffer_.empty() && pad_final_packet_) {
std::unique_ptr<Matrix> output_frame(new Matrix);
output_frame->setZero(num_channels_, frame_duration_samples_);
for (int i = 0; i < sample_buffer_.size(); ++i) {
output_frame->col(i) = sample_buffer_[i].first;
current_timestamp_ = sample_buffer_[i].second;
}
sample_buffer_.DropSamples(samples_still_to_drop_);
cc->Outputs().Index(0).Add(output_frame.release(),
CurrentOutputTimestamp());
if (sample_buffer_.num_samples() > 0 && pad_final_packet_) {
Matrix output_frame = sample_buffer_.CopySamples(frame_duration_samples_,
&current_timestamp_);
cc->Outputs().Index(0).AddPacket(MakePacket<Matrix>(std::move(output_frame))
.At(CurrentOutputTimestamp()));
}
return absl::OkStatus();
@ -258,7 +339,7 @@ absl::Status TimeSeriesFramerCalculator::Open(CalculatorContext* cc) {
cc->Inputs().Index(0).Header(), &input_header));
sample_rate_ = input_header.sample_rate();
num_channels_ = input_header.num_channels();
sample_buffer_.Init(sample_rate_, input_header.num_channels());
frame_duration_samples_ = time_series_util::SecondsToSamples(
framer_options.frame_duration_seconds(), sample_rate_);
RET_CHECK_GT(frame_duration_samples_, 0)
@ -312,9 +393,8 @@ absl::Status TimeSeriesFramerCalculator::Open(CalculatorContext* cc) {
}
if (use_window_) {
window_ = Matrix::Ones(num_channels_, 1) *
Eigen::Map<Eigen::MatrixXd>(window_vector.data(), 1,
frame_duration_samples_)
window_ = Eigen::Map<Eigen::RowVectorXd>(window_vector.data(),
frame_duration_samples_)
.cast<float>();
}
use_local_timestamp_ = framer_options.use_local_timestamp();

View File

@ -66,7 +66,7 @@ message TimeSeriesFramerCalculatorOptions {
// If use_local_timestamp is true, the output packet's timestamp is based on
// the last sample of the packet and it's inferred from the latest input
// packet's timestamp. If false, the output packet's timestamp is based on
// the cumulative timestamping, which is inferred from the intial input
// the cumulative timestamping, which is inferred from the initial input
// timestamp and the cumulative number of samples.
optional bool use_local_timestamp = 6 [default = false];
}

View File

@ -0,0 +1,93 @@
// Copyright 2023 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.
//
// Benchmark for TimeSeriesFramerCalculator.
#include <memory>
#include <random>
#include <vector>
#include "absl/log/absl_check.h"
#include "benchmark/benchmark.h"
#include "mediapipe/calculators/audio/time_series_framer_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/matrix.h"
#include "mediapipe/framework/formats/time_series_header.pb.h"
#include "mediapipe/framework/packet.h"
using ::mediapipe::Matrix;
void BM_TimeSeriesFramerCalculator(benchmark::State& state) {
constexpr float kSampleRate = 32000.0;
constexpr int kNumChannels = 2;
constexpr int kFrameDurationSeconds = 5.0;
std::mt19937 rng(0 /*seed*/);
// Input around a half second's worth of samples at a time.
std::uniform_int_distribution<int> input_size_dist(15000, 17000);
// Generate a pool of random blocks of samples up front.
std::vector<Matrix> sample_pool;
sample_pool.reserve(20);
for (int i = 0; i < 20; ++i) {
sample_pool.push_back(Matrix::Random(kNumChannels, input_size_dist(rng)));
}
std::uniform_int_distribution<int> pool_index_dist(0, sample_pool.size() - 1);
mediapipe::CalculatorGraphConfig config;
config.add_input_stream("input");
config.add_output_stream("output");
auto* node = config.add_node();
node->set_calculator("TimeSeriesFramerCalculator");
node->add_input_stream("input");
node->add_output_stream("output");
mediapipe::TimeSeriesFramerCalculatorOptions* options =
node->mutable_options()->MutableExtension(
mediapipe::TimeSeriesFramerCalculatorOptions::ext);
options->set_frame_duration_seconds(kFrameDurationSeconds);
for (auto _ : state) {
state.PauseTiming(); // Pause benchmark timing.
// Prepare input packets of random blocks of samples.
std::vector<mediapipe::Packet> input_packets;
input_packets.reserve(32);
float t = 0;
for (int i = 0; i < 32; ++i) {
auto samples =
std::make_unique<Matrix>(sample_pool[pool_index_dist(rng)]);
const int num_samples = samples->cols();
input_packets.push_back(mediapipe::Adopt(samples.release())
.At(mediapipe::Timestamp::FromSeconds(t)));
t += num_samples / kSampleRate;
}
// Initialize graph.
mediapipe::CalculatorGraph graph;
ABSL_CHECK_OK(graph.Initialize(config));
// Prepare input header.
auto header = std::make_unique<mediapipe::TimeSeriesHeader>();
header->set_sample_rate(kSampleRate);
header->set_num_channels(kNumChannels);
state.ResumeTiming(); // Resume benchmark timing.
ABSL_CHECK_OK(graph.StartRun({}, {{"input", Adopt(header.release())}}));
for (auto& packet : input_packets) {
ABSL_CHECK_OK(graph.AddPacketToInputStream("input", packet));
}
ABSL_CHECK(!graph.HasError());
ABSL_CHECK_OK(graph.CloseAllInputStreams());
ABSL_CHECK_OK(graph.WaitUntilIdle());
}
}
BENCHMARK(BM_TimeSeriesFramerCalculator);
BENCHMARK_MAIN();

View File

@ -19,6 +19,7 @@
#include <vector>
#include "Eigen/Core"
#include "absl/log/absl_log.h"
#include "audio/dsp/window_functions.h"
#include "mediapipe/calculators/audio/time_series_framer_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
@ -186,11 +187,12 @@ class TimeSeriesFramerCalculatorTest
const int num_unique_output_samples =
round((output().packets.size() - 1) * frame_step_samples) +
frame_duration_samples;
LOG(INFO) << "packets.size()=" << output().packets.size()
<< " frame_duration_samples=" << frame_duration_samples
<< " frame_step_samples=" << frame_step_samples
<< " num_input_samples_=" << num_input_samples_
<< " num_unique_output_samples=" << num_unique_output_samples;
ABSL_LOG(INFO) << "packets.size()=" << output().packets.size()
<< " frame_duration_samples=" << frame_duration_samples
<< " frame_step_samples=" << frame_step_samples
<< " num_input_samples_=" << num_input_samples_
<< " num_unique_output_samples="
<< num_unique_output_samples;
const int num_padding_samples =
num_unique_output_samples - num_input_samples_;
if (options_.pad_final_packet()) {

View File

@ -21,10 +21,10 @@ licenses(["notice"])
package(default_visibility = ["//visibility:public"])
selects.config_setting_group(
name = "ios_or_disable_gpu",
name = "apple_or_disable_gpu",
match_any = [
"//mediapipe/gpu:disable_gpu",
"//mediapipe:ios",
"//mediapipe:apple",
],
)
@ -117,6 +117,7 @@ mediapipe_proto_library(
"//mediapipe/framework:calculator_proto",
"//mediapipe/framework/formats:classification_proto",
"//mediapipe/framework/formats:landmark_proto",
"//mediapipe/framework/formats:matrix_data_proto",
"//mediapipe/framework/formats:time_series_header_proto",
],
)
@ -192,17 +193,19 @@ cc_library(
"//mediapipe/framework:calculator_context",
"//mediapipe/framework:calculator_contract",
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework:collection_item_id",
"//mediapipe/framework:packet",
"//mediapipe/framework/formats:detection_cc_proto",
"//mediapipe/framework/formats:image",
"//mediapipe/framework/formats:image_frame",
"//mediapipe/framework/formats:landmark_cc_proto",
"//mediapipe/framework/formats:matrix",
"//mediapipe/framework/formats:rect_cc_proto",
"//mediapipe/framework/formats:tensor",
"//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"//mediapipe/gpu:gpu_buffer",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
],
alwayslink = 1,
)
@ -215,18 +218,18 @@ cc_library(
"//mediapipe/framework:calculator_context",
"//mediapipe/framework:calculator_contract",
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework:collection_item_id",
"//mediapipe/framework/formats:classification_cc_proto",
"//mediapipe/framework/formats:detection_cc_proto",
"//mediapipe/framework/formats:image",
"//mediapipe/framework/formats:image_frame",
"//mediapipe/framework/formats:landmark_cc_proto",
"//mediapipe/framework/formats:matrix",
"//mediapipe/framework/formats:rect_cc_proto",
"//mediapipe/framework/formats:tensor",
"//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"//mediapipe/gpu:gpu_buffer",
"//mediapipe/util:render_data_cc_proto",
"@com_google_absl//absl/status",
"@org_tensorflow//tensorflow/lite:framework",
],
alwayslink = 1,
@ -287,6 +290,7 @@ cc_library(
"//mediapipe/framework/api2:node",
"//mediapipe/framework/api2:port",
"//mediapipe/framework/formats:classification_cc_proto",
"//mediapipe/framework/formats:image",
"//mediapipe/framework/formats:landmark_cc_proto",
"//mediapipe/framework/formats:tensor",
"//mediapipe/framework/port:integral_types",
@ -295,8 +299,7 @@ cc_library(
"//mediapipe/util:render_data_cc_proto",
"@org_tensorflow//tensorflow/lite:framework",
] + select({
"//mediapipe/gpu:disable_gpu": [],
"//mediapipe:ios": [],
":apple_or_disable_gpu": [],
"//conditions:default": [
"@org_tensorflow//tensorflow/lite/delegates/gpu/gl:gl_buffer",
],
@ -322,6 +325,7 @@ cc_library(
":concatenate_vector_calculator_cc_proto",
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/api2:node",
"//mediapipe/framework/formats:body_rig_cc_proto",
"//mediapipe/framework/formats:classification_cc_proto",
"//mediapipe/framework/formats:landmark_cc_proto",
"//mediapipe/framework/port:ret_check",
@ -378,17 +382,6 @@ cc_library(
alwayslink = 1,
)
cc_library(
name = "clip_detection_vector_size_calculator",
srcs = ["clip_detection_vector_size_calculator.cc"],
deps = [
":clip_vector_size_calculator",
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/formats:detection_cc_proto",
],
alwayslink = 1,
)
cc_test(
name = "clip_vector_size_calculator_test",
srcs = ["clip_vector_size_calculator_test.cc"],
@ -590,6 +583,7 @@ cc_library(
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:status",
"//mediapipe/framework/tool:options_util",
"@com_google_absl//absl/log:absl_check",
],
alwayslink = 1,
)
@ -605,6 +599,7 @@ cc_test(
"//mediapipe/framework/formats:video_stream_header",
"//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:integral_types",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/strings",
],
)
@ -637,6 +632,7 @@ cc_library(
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
],
alwayslink = 1,
)
@ -731,6 +727,7 @@ cc_library(
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"@com_google_absl//absl/status",
],
alwayslink = 1,
)
@ -746,6 +743,7 @@ cc_test(
"//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:status",
"//mediapipe/framework/tool:options_util",
"//mediapipe/util:packet_test_util",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/strings",
],
@ -784,10 +782,11 @@ cc_library(
"//mediapipe/framework/deps:random",
"//mediapipe/framework/formats:video_stream_header",
"//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"//mediapipe/framework/tool:options_util",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings",
],
alwayslink = 1,
@ -843,6 +842,7 @@ cc_test(
"//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/tool:validate_type",
"@com_google_absl//absl/log:absl_check",
"@eigen_archive//:eigen3",
],
)
@ -904,6 +904,7 @@ cc_library(
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/formats:classification_cc_proto",
"//mediapipe/framework/formats:detection_cc_proto",
"//mediapipe/framework/formats:image",
"//mediapipe/framework/formats:landmark_cc_proto",
"//mediapipe/framework/formats:matrix",
"//mediapipe/framework/formats:rect_cc_proto",
@ -914,7 +915,7 @@ cc_library(
"@org_tensorflow//tensorflow/lite:framework",
"@org_tensorflow//tensorflow/lite/kernels:builtin_ops",
] + select({
":ios_or_disable_gpu": [],
":apple_or_disable_gpu": [],
"//conditions:default": [
"@org_tensorflow//tensorflow/lite/delegates/gpu/gl:gl_buffer",
],
@ -946,6 +947,7 @@ cc_library(
deps = [
":split_vector_calculator_cc_proto",
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/formats:body_rig_cc_proto",
"//mediapipe/framework/formats:landmark_cc_proto",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
@ -1029,6 +1031,7 @@ cc_library(
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/api2:node",
"//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
],
alwayslink = 1,
)
@ -1067,6 +1070,7 @@ cc_test(
"//mediapipe/framework:calculator_runner",
"//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:parse_text_proto",
"@com_google_absl//absl/log:absl_log",
],
)
@ -1113,6 +1117,7 @@ cc_library(
"//mediapipe/framework/api2:node",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
],
alwayslink = 1,
)
@ -1136,6 +1141,7 @@ cc_library(
deps = [
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework:timestamp",
"//mediapipe/framework/api2:node",
"//mediapipe/framework/port:status",
],
alwayslink = 1,
@ -1164,6 +1170,7 @@ cc_library(
"//mediapipe/framework:collection_item_id",
"//mediapipe/framework/formats:classification_cc_proto",
"//mediapipe/framework/formats:landmark_cc_proto",
"//mediapipe/framework/formats:matrix_data_cc_proto",
"//mediapipe/framework/formats:time_series_header_cc_proto",
"//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:ret_check",
@ -1238,6 +1245,7 @@ cc_library(
"//mediapipe/framework/formats:classification_cc_proto",
"//mediapipe/framework/formats:detection_cc_proto",
"//mediapipe/framework/formats:landmark_cc_proto",
"//mediapipe/framework/formats:rect_cc_proto",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
],
@ -1385,3 +1393,26 @@ cc_test(
"@com_google_absl//absl/types:optional",
],
)
cc_library(
name = "value_or_default_calculator",
srcs = ["value_or_default_calculator.cc"],
visibility = ["//visibility:public"],
deps = [
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/port:status",
],
alwayslink = True,
)
cc_test(
name = "value_or_default_calculator_test",
srcs = ["value_or_default_calculator_test.cc"],
deps = [
":value_or_default_calculator",
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework:calculator_runner",
"//mediapipe/framework:packet",
"//mediapipe/framework/port:gtest_main",
],
)

View File

@ -13,6 +13,7 @@
// limitations under the License.
#include <string>
#include <utility>
#include <vector>
#include "absl/memory/memory.h"
@ -163,6 +164,75 @@ TEST_F(BeginEndLoopCalculatorGraphTest, MultipleVectors) {
PacketOfIntsEq(input_timestamp2, std::vector<int>{3, 4})));
}
TEST(BeginEndLoopCalculatorPossibleDataRaceTest,
EndLoopForIntegersDoesNotRace) {
auto graph_config = ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(
num_threads: 4
input_stream: "ints"
node {
calculator: "BeginLoopIntegerCalculator"
input_stream: "ITERABLE:ints"
output_stream: "ITEM:int"
output_stream: "BATCH_END:timestamp"
}
node {
calculator: "IncrementCalculator"
input_stream: "int"
output_stream: "int_plus_one"
}
# BEGIN: Data race possibility
# EndLoop###Calculator and another calculator using the same input
# may introduce race due to EndLoop###Calculator possibly consuming
# packet.
node {
calculator: "EndLoopIntegersCalculator"
input_stream: "ITEM:int_plus_one"
input_stream: "BATCH_END:timestamp"
output_stream: "ITERABLE:ints_plus_one"
}
node {
calculator: "IncrementCalculator"
input_stream: "int_plus_one"
output_stream: "int_plus_two"
}
# END: Data race possibility
node {
calculator: "EndLoopIntegersCalculator"
input_stream: "ITEM:int_plus_two"
input_stream: "BATCH_END:timestamp"
output_stream: "ITERABLE:ints_plus_two"
}
)pb");
std::vector<Packet> int_plus_one_packets;
tool::AddVectorSink("ints_plus_one", &graph_config, &int_plus_one_packets);
std::vector<Packet> int_original_packets;
tool::AddVectorSink("ints_plus_two", &graph_config, &int_original_packets);
CalculatorGraph graph;
MP_ASSERT_OK(graph.Initialize(graph_config));
MP_ASSERT_OK(graph.StartRun({}));
for (int i = 0; i < 100; ++i) {
std::vector<int> ints = {i, i + 1, i + 2};
Timestamp ts = Timestamp(i);
MP_ASSERT_OK(graph.AddPacketToInputStream(
"ints", MakePacket<std::vector<int>>(std::move(ints)).At(ts)));
MP_ASSERT_OK(graph.WaitUntilIdle());
EXPECT_THAT(int_plus_one_packets,
testing::ElementsAre(
PacketOfIntsEq(ts, std::vector<int>{i + 1, i + 2, i + 3})));
EXPECT_THAT(int_original_packets,
testing::ElementsAre(
PacketOfIntsEq(ts, std::vector<int>{i + 2, i + 3, i + 4})));
int_plus_one_packets.clear();
int_original_packets.clear();
}
MP_ASSERT_OK(graph.CloseAllPacketSources());
MP_ASSERT_OK(graph.WaitUntilDone());
}
// Passes non empty vector through or outputs empty vector in case of timestamp
// bound update.
class PassThroughOrEmptyVectorCalculator : public CalculatorBase {

View File

@ -17,10 +17,13 @@
#include <vector>
#include "mediapipe/framework/formats/detection.pb.h"
#include "mediapipe/framework/formats/image.h"
#include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/landmark.pb.h"
#include "mediapipe/framework/formats/matrix.h"
#include "mediapipe/framework/formats/rect.pb.h"
#include "mediapipe/framework/formats/tensor.h"
#include "mediapipe/gpu/gpu_buffer.h"
namespace mediapipe {
@ -60,4 +63,22 @@ REGISTER_CALCULATOR(BeginLoopUint64tCalculator);
typedef BeginLoopCalculator<std::vector<Tensor>> BeginLoopTensorCalculator;
REGISTER_CALCULATOR(BeginLoopTensorCalculator);
// A calculator to process std::vector<mediapipe::ImageFrame>.
typedef BeginLoopCalculator<std::vector<ImageFrame>>
BeginLoopImageFrameCalculator;
REGISTER_CALCULATOR(BeginLoopImageFrameCalculator);
// A calculator to process std::vector<mediapipe::GpuBuffer>.
typedef BeginLoopCalculator<std::vector<GpuBuffer>>
BeginLoopGpuBufferCalculator;
REGISTER_CALCULATOR(BeginLoopGpuBufferCalculator);
// A calculator to process std::vector<mediapipe::Image>.
typedef BeginLoopCalculator<std::vector<Image>> BeginLoopImageCalculator;
REGISTER_CALCULATOR(BeginLoopImageCalculator);
// A calculator to process std::vector<float>.
typedef BeginLoopCalculator<std::vector<float>> BeginLoopFloatCalculator;
REGISTER_CALCULATOR(BeginLoopFloatCalculator);
} // namespace mediapipe

View File

@ -15,47 +15,57 @@
#ifndef MEDIAPIPE_CALCULATORS_CORE_BEGIN_LOOP_CALCULATOR_H_
#define MEDIAPIPE_CALCULATORS_CORE_BEGIN_LOOP_CALCULATOR_H_
#include "absl/status/status.h"
#include "mediapipe/framework/calculator_context.h"
#include "mediapipe/framework/calculator_contract.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/collection_item_id.h"
#include "mediapipe/framework/packet.h"
#include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/port/status_macros.h"
namespace mediapipe {
// Calculator for implementing loops on iterable collections inside a MediaPipe
// graph.
// graph. Assume InputIterT is an iterable for type InputT, and OutputIterT is
// an iterable for type OutputT, e.g. vector<InputT> and vector<OutputT>.
// First, instantiate specializations in the loop calculators' implementations
// if missing:
// BeginLoopInputTCalculator = BeginLoopCalculator<InputIterT>
// EndLoopOutputTCalculator = EndLoopCalculator<OutputIterT>
// Then, the following graph transforms an item of type InputIterT to an
// OutputIterT by applying InputToOutputConverter to every element:
//
// It is designed to be used like:
//
// node {
// calculator: "BeginLoopWithIterableCalculator"
// input_stream: "ITERABLE:input_iterable" # IterableT @ext_ts
// output_stream: "ITEM:input_element" # ItemT @loop_internal_ts
// output_stream: "BATCH_END:ext_ts" # Timestamp @loop_internal_ts
// node { # Type @timestamp
// calculator: "BeginLoopInputTCalculator"
// input_stream: "ITERABLE:input_iterable" # InputIterT @iterable_ts
// input_stream: "CLONE:extra_input" # ExtraT @extra_ts
// output_stream: "ITEM:input_iterator" # InputT @loop_internal_ts
// output_stream: "CLONE:cloned_extra_input" # ExtraT @loop_internal_ts
// output_stream: "BATCH_END:iterable_ts" # Timestamp @loop_internal_ts
// }
//
// node {
// calculator: "ElementToBlaConverterSubgraph"
// input_stream: "ITEM:input_to_loop_body" # ItemT @loop_internal_ts
// output_stream: "BLA:output_of_loop_body" # ItemU @loop_internal_ts
// calculator: "InputToOutputConverter"
// input_stream: "INPUT:input_iterator" # InputT @loop_internal_ts
// input_stream: "EXTRA:cloned_extra_input" # ExtraT @loop_internal_ts
// output_stream: "OUTPUT:output_iterator" # OutputT @loop_internal_ts
// }
//
// node {
// calculator: "EndLoopWithOutputCalculator"
// input_stream: "ITEM:output_of_loop_body" # ItemU @loop_internal_ts
// input_stream: "BATCH_END:ext_ts" # Timestamp @loop_internal_ts
// output_stream: "ITERABLE:aggregated_result" # IterableU @ext_ts
// calculator: "EndLoopOutputTCalculator"
// input_stream: "ITEM:output_iterator" # OutputT @loop_internal_ts
// input_stream: "BATCH_END:iterable_ts" # Timestamp @loop_internal_ts
// output_stream: "ITERABLE:output_iterable" # OutputIterT @iterable_ts
// }
//
// The resulting 'output_iterable' has the same timestamp as 'input_iterable'.
// The output packets of this calculator are part of the loop body and have
// loop-internal timestamps that are unrelated to the input iterator timestamp.
//
// Input streams tagged with "CLONE" are cloned to the corresponding output
// streams at loop timestamps. This ensures that a MediaPipe graph or sub-graph
// can run multiple times, once per element in the "ITERABLE" for each pakcet
// clone of the packets in the "CLONE" input streams.
// streams at loop-internal timestamps. This ensures that a MediaPipe graph or
// sub-graph can run multiple times, once per element in the "ITERABLE" for each
// packet clone of the packets in the "CLONE" input streams. Think of CLONEd
// inputs as loop-wide constants.
template <typename IterableT>
class BeginLoopCalculator : public CalculatorBase {
using ItemT = typename IterableT::value_type;

View File

@ -92,7 +92,7 @@ class BypassCalculator : public Node {
auto options = cc->Options<BypassCalculatorOptions>();
RET_CHECK_EQ(options.pass_input_stream().size(),
options.pass_output_stream().size());
ASSIGN_OR_RETURN(
MP_ASSIGN_OR_RETURN(
auto pass_streams,
GetPassMap(options, *cc->Inputs().TagMap(), *cc->Outputs().TagMap()));
std::set<CollectionItemId> pass_out;
@ -121,8 +121,9 @@ class BypassCalculator : public Node {
// Saves the map of passthrough input and output stream ids.
absl::Status Open(CalculatorContext* cc) override {
auto options = cc->Options<BypassCalculatorOptions>();
ASSIGN_OR_RETURN(pass_streams_, GetPassMap(options, *cc->Inputs().TagMap(),
*cc->Outputs().TagMap()));
MP_ASSIGN_OR_RETURN(
pass_streams_,
GetPassMap(options, *cc->Inputs().TagMap(), *cc->Outputs().TagMap()));
return absl::OkStatus();
}

View File

@ -18,6 +18,7 @@
#include "mediapipe/calculators/core/concatenate_vector_calculator.pb.h"
#include "mediapipe/framework/api2/node.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/body_rig.pb.h"
#include "mediapipe/framework/formats/classification.pb.h"
#include "mediapipe/framework/formats/landmark.pb.h"
#include "mediapipe/framework/port/canonical_errors.h"
@ -128,6 +129,19 @@ class ConcatenateClassificationListCalculator
};
MEDIAPIPE_REGISTER_NODE(ConcatenateClassificationListCalculator);
class ConcatenateJointListCalculator
: public ConcatenateListsCalculator<Joint, JointList> {
protected:
int ListSize(const JointList& list) const override {
return list.joint_size();
}
const Joint GetItem(const JointList& list, int idx) const override {
return list.joint(idx);
}
Joint* AddItem(JointList& list) const override { return list.add_joint(); }
};
MEDIAPIPE_REGISTER_NODE(ConcatenateJointListCalculator);
} // namespace api2
} // namespace mediapipe

View File

@ -17,6 +17,7 @@
#include <vector>
#include "mediapipe/framework/formats/classification.pb.h"
#include "mediapipe/framework/formats/image.h"
#include "mediapipe/framework/formats/landmark.pb.h"
#include "mediapipe/framework/formats/tensor.h"
#include "mediapipe/framework/port/integral_types.h"
@ -55,6 +56,10 @@ MEDIAPIPE_REGISTER_NODE(ConcatenateUInt64VectorCalculator);
typedef ConcatenateVectorCalculator<bool> ConcatenateBoolVectorCalculator;
MEDIAPIPE_REGISTER_NODE(ConcatenateBoolVectorCalculator);
typedef ConcatenateVectorCalculator<std::string>
ConcatenateStringVectorCalculator;
MEDIAPIPE_REGISTER_NODE(ConcatenateStringVectorCalculator);
// Example config:
// node {
// calculator: "ConcatenateTfLiteTensorVectorCalculator"
@ -100,4 +105,7 @@ typedef ConcatenateVectorCalculator<mediapipe::RenderData>
ConcatenateRenderDataVectorCalculator;
MEDIAPIPE_REGISTER_NODE(ConcatenateRenderDataVectorCalculator);
typedef ConcatenateVectorCalculator<mediapipe::Image>
ConcatenateImageVectorCalculator;
MEDIAPIPE_REGISTER_NODE(ConcatenateImageVectorCalculator);
} // namespace mediapipe

View File

@ -30,13 +30,15 @@ namespace mediapipe {
typedef ConcatenateVectorCalculator<int> TestConcatenateIntVectorCalculator;
MEDIAPIPE_REGISTER_NODE(TestConcatenateIntVectorCalculator);
void AddInputVector(int index, const std::vector<int>& input, int64_t timestamp,
template <typename T>
void AddInputVector(int index, const std::vector<T>& input, int64_t timestamp,
CalculatorRunner* runner) {
runner->MutableInputs()->Index(index).packets.push_back(
MakePacket<std::vector<int>>(input).At(Timestamp(timestamp)));
MakePacket<std::vector<T>>(input).At(Timestamp(timestamp)));
}
void AddInputVectors(const std::vector<std::vector<int>>& inputs,
template <typename T>
void AddInputVectors(const std::vector<std::vector<T>>& inputs,
int64_t timestamp, CalculatorRunner* runner) {
for (int i = 0; i < inputs.size(); ++i) {
AddInputVector(i, inputs[i], timestamp, runner);
@ -382,6 +384,23 @@ TEST(ConcatenateFloatVectorCalculatorTest, OneEmptyStreamNoOutput) {
EXPECT_EQ(0, outputs.size());
}
TEST(ConcatenateStringVectorCalculatorTest, OneTimestamp) {
CalculatorRunner runner("ConcatenateStringVectorCalculator",
/*options_string=*/"", /*num_inputs=*/3,
/*num_outputs=*/1, /*num_side_packets=*/0);
std::vector<std::vector<std::string>> inputs = {
{"a", "b"}, {"c"}, {"d", "e", "f"}};
AddInputVectors(inputs, /*timestamp=*/1, &runner);
MP_ASSERT_OK(runner.Run());
const std::vector<Packet>& outputs = runner.Outputs().Index(0).packets;
EXPECT_EQ(1, outputs.size());
EXPECT_EQ(Timestamp(1), outputs[0].Timestamp());
std::vector<std::string> expected_vector = {"a", "b", "c", "d", "e", "f"};
EXPECT_EQ(expected_vector, outputs[0].Get<std::vector<std::string>>());
}
typedef ConcatenateVectorCalculator<std::unique_ptr<int>>
TestConcatenateUniqueIntPtrCalculator;
MEDIAPIPE_REGISTER_NODE(TestConcatenateUniqueIntPtrCalculator);

View File

@ -19,6 +19,7 @@
#include "mediapipe/framework/collection_item_id.h"
#include "mediapipe/framework/formats/classification.pb.h"
#include "mediapipe/framework/formats/landmark.pb.h"
#include "mediapipe/framework/formats/matrix_data.pb.h"
#include "mediapipe/framework/formats/time_series_header.pb.h"
#include "mediapipe/framework/port/canonical_errors.h"
#include "mediapipe/framework/port/integral_types.h"
@ -85,8 +86,12 @@ class ConstantSidePacketCalculator : public CalculatorBase {
packet.Set<LandmarkList>();
} else if (packet_options.has_double_value()) {
packet.Set<double>();
} else if (packet_options.has_matrix_data_value()) {
packet.Set<MatrixData>();
} else if (packet_options.has_time_series_header_value()) {
packet.Set<TimeSeriesHeader>();
} else if (packet_options.has_int64_value()) {
packet.Set<int64_t>();
} else {
return absl::InvalidArgumentError(
"None of supported values were specified in options.");
@ -121,9 +126,13 @@ class ConstantSidePacketCalculator : public CalculatorBase {
MakePacket<LandmarkList>(packet_options.landmark_list_value()));
} else if (packet_options.has_double_value()) {
packet.Set(MakePacket<double>(packet_options.double_value()));
} else if (packet_options.has_matrix_data_value()) {
packet.Set(MakePacket<MatrixData>(packet_options.matrix_data_value()));
} else if (packet_options.has_time_series_header_value()) {
packet.Set(MakePacket<TimeSeriesHeader>(
packet_options.time_series_header_value()));
} else if (packet_options.has_int64_value()) {
packet.Set(MakePacket<int64_t>(packet_options.int64_value()));
} else {
return absl::InvalidArgumentError(
"None of supported values were specified in options.");

View File

@ -19,6 +19,7 @@ package mediapipe;
import "mediapipe/framework/calculator.proto";
import "mediapipe/framework/formats/classification.proto";
import "mediapipe/framework/formats/landmark.proto";
import "mediapipe/framework/formats/matrix_data.proto";
import "mediapipe/framework/formats/time_series_header.proto";
message ConstantSidePacketCalculatorOptions {
@ -29,14 +30,16 @@ message ConstantSidePacketCalculatorOptions {
message ConstantSidePacket {
oneof value {
int32 int_value = 1;
uint64 uint64_value = 5;
int64 int64_value = 11;
float float_value = 2;
double double_value = 9;
bool bool_value = 3;
string string_value = 4;
uint64 uint64_value = 5;
ClassificationList classification_list_value = 6;
LandmarkList landmark_list_value = 7;
double double_value = 9;
TimeSeriesHeader time_series_header_value = 10;
MatrixData matrix_data_value = 12;
}
}

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <cstdint>
#include <string>
#include "absl/strings/string_view.h"
@ -58,6 +59,7 @@ TEST(ConstantSidePacketCalculatorTest, EveryPossibleType) {
DoTestSingleSidePacket("{ float_value: 6.5f }", 6.5f);
DoTestSingleSidePacket("{ bool_value: true }", true);
DoTestSingleSidePacket<std::string>(R"({ string_value: "str" })", "str");
DoTestSingleSidePacket<int64_t>("{ int64_value: 63 }", 63);
}
TEST(ConstantSidePacketCalculatorTest, MultiplePackets) {

View File

@ -14,15 +14,19 @@
#include "mediapipe/calculators/core/end_loop_calculator.h"
#include <array>
#include <utility>
#include <vector>
#include "mediapipe/framework/formats/classification.pb.h"
#include "mediapipe/framework/formats/detection.pb.h"
#include "mediapipe/framework/formats/image.h"
#include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/landmark.pb.h"
#include "mediapipe/framework/formats/matrix.h"
#include "mediapipe/framework/formats/rect.pb.h"
#include "mediapipe/framework/formats/tensor.h"
#include "mediapipe/gpu/gpu_buffer.h"
#include "mediapipe/util/render_data.pb.h"
#include "tensorflow/lite/interpreter.h"
@ -68,8 +72,22 @@ REGISTER_CALCULATOR(EndLoopMatrixCalculator);
typedef EndLoopCalculator<std::vector<Tensor>> EndLoopTensorCalculator;
REGISTER_CALCULATOR(EndLoopTensorCalculator);
typedef EndLoopCalculator<std::vector<ImageFrame>> EndLoopImageFrameCalculator;
REGISTER_CALCULATOR(EndLoopImageFrameCalculator);
typedef EndLoopCalculator<std::vector<GpuBuffer>> EndLoopGpuBufferCalculator;
REGISTER_CALCULATOR(EndLoopGpuBufferCalculator);
typedef EndLoopCalculator<std::vector<::mediapipe::Image>>
EndLoopImageCalculator;
REGISTER_CALCULATOR(EndLoopImageCalculator);
typedef EndLoopCalculator<std::vector<std::array<float, 16>>>
EndLoopAffineMatrixCalculator;
REGISTER_CALCULATOR(EndLoopAffineMatrixCalculator);
typedef EndLoopCalculator<std::vector<std::pair<int, int>>>
EndLoopImageSizeCalculator;
REGISTER_CALCULATOR(EndLoopImageSizeCalculator);
} // namespace mediapipe

View File

@ -17,13 +17,11 @@
#include <type_traits>
#include "absl/status/status.h"
#include "mediapipe/framework/calculator_context.h"
#include "mediapipe/framework/calculator_contract.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/collection_item_id.h"
#include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h"
namespace mediapipe {
@ -33,27 +31,7 @@ namespace mediapipe {
// from the "BATCH_END" tagged input stream, it emits the aggregated results
// at the original timestamp contained in the "BATCH_END" input stream.
//
// It is designed to be used like:
//
// node {
// calculator: "BeginLoopWithIterableCalculator"
// input_stream: "ITERABLE:input_iterable" # IterableT @ext_ts
// output_stream: "ITEM:input_element" # ItemT @loop_internal_ts
// output_stream: "BATCH_END:ext_ts" # Timestamp @loop_internal_ts
// }
//
// node {
// calculator: "ElementToBlaConverterSubgraph"
// input_stream: "ITEM:input_to_loop_body" # ItemT @loop_internal_ts
// output_stream: "BLA:output_of_loop_body" # ItemU @loop_internal_ts
// }
//
// node {
// calculator: "EndLoopWithOutputCalculator"
// input_stream: "ITEM:output_of_loop_body" # ItemU @loop_internal_ts
// input_stream: "BATCH_END:ext_ts" # Timestamp @loop_internal_ts
// output_stream: "ITERABLE:aggregated_result" # IterableU @ext_ts
// }
// See BeginLoopCalculator for a usage example.
template <typename IterableT>
class EndLoopCalculator : public CalculatorBase {
using ItemT = typename IterableT::value_type;
@ -77,16 +55,16 @@ class EndLoopCalculator : public CalculatorBase {
if (!input_stream_collection_) {
input_stream_collection_.reset(new IterableT);
}
// Try to consume the item and move it into the collection. If the items
// are not consumable, then try to copy them instead. If the items are
// not copiable, then an error will be returned.
auto item_ptr_or = cc->Inputs().Tag("ITEM").Value().Consume<ItemT>();
if (item_ptr_or.ok()) {
input_stream_collection_->push_back(std::move(*item_ptr_or.value()));
if constexpr (std::is_copy_constructible_v<ItemT>) {
input_stream_collection_->push_back(
cc->Inputs().Tag("ITEM").Get<ItemT>());
} else {
if constexpr (std::is_copy_constructible_v<ItemT>) {
input_stream_collection_->push_back(
cc->Inputs().Tag("ITEM").template Get<ItemT>());
// Try to consume the item and move it into the collection. Return an
// error if the items are not consumable.
auto item_ptr_or = cc->Inputs().Tag("ITEM").Value().Consume<ItemT>();
if (item_ptr_or.ok()) {
input_stream_collection_->push_back(std::move(*item_ptr_or.value()));
} else {
return absl::InternalError(
"The item type is not copiable. Consider making the "

View File

@ -42,7 +42,7 @@ constexpr char kOptionsTag[] = "OPTIONS";
//
// Increasing `max_in_flight` to 2 or more can yield the better throughput
// when the graph exhibits a high degree of pipeline parallelism. Decreasing
// `max_in_flight` to 0 can yield a better average latency, but at the cost of
// `max_in_queue` to 0 can yield a better average latency, but at the cost of
// lower throughput (lower framerate) due to the time during which the graph
// is idle awaiting the next input frame.
//

View File

@ -26,19 +26,15 @@ constexpr char kStateChangeTag[] = "STATE_CHANGE";
constexpr char kDisallowTag[] = "DISALLOW";
constexpr char kAllowTag[] = "ALLOW";
enum GateState {
GATE_UNINITIALIZED,
GATE_ALLOW,
GATE_DISALLOW,
};
std::string ToString(GateState state) {
std::string ToString(GateCalculatorOptions::GateState state) {
switch (state) {
case GATE_UNINITIALIZED:
case GateCalculatorOptions::UNSPECIFIED:
return "UNSPECIFIED";
case GateCalculatorOptions::GATE_UNINITIALIZED:
return "UNINITIALIZED";
case GATE_ALLOW:
case GateCalculatorOptions::GATE_ALLOW:
return "ALLOW";
case GATE_DISALLOW:
case GateCalculatorOptions::GATE_DISALLOW:
return "DISALLOW";
}
DLOG(FATAL) << "Unknown GateState";
@ -153,10 +149,12 @@ class GateCalculator : public CalculatorBase {
cc->SetOffset(TimestampDiff(0));
num_data_streams_ = cc->Inputs().NumEntries("");
last_gate_state_ = GATE_UNINITIALIZED;
RET_CHECK_OK(CopyInputHeadersToOutputs(cc->Inputs(), &cc->Outputs()));
const auto& options = cc->Options<::mediapipe::GateCalculatorOptions>();
last_gate_state_ = options.initial_gate_state();
RET_CHECK_OK(CopyInputHeadersToOutputs(cc->Inputs(), &cc->Outputs()));
empty_packets_as_allow_ = options.empty_packets_as_allow();
if (!use_side_packet_for_allow_disallow_ &&
@ -184,10 +182,12 @@ class GateCalculator : public CalculatorBase {
allow = !cc->Inputs().Tag(kDisallowTag).Get<bool>();
}
}
const GateState new_gate_state = allow ? GATE_ALLOW : GATE_DISALLOW;
const GateCalculatorOptions::GateState new_gate_state =
allow ? GateCalculatorOptions::GATE_ALLOW
: GateCalculatorOptions::GATE_DISALLOW;
if (cc->Outputs().HasTag(kStateChangeTag)) {
if (last_gate_state_ != GATE_UNINITIALIZED &&
if (last_gate_state_ != GateCalculatorOptions::GATE_UNINITIALIZED &&
last_gate_state_ != new_gate_state) {
VLOG(2) << "State transition in " << cc->NodeName() << " @ "
<< cc->InputTimestamp().Value() << " from "
@ -223,7 +223,8 @@ class GateCalculator : public CalculatorBase {
}
private:
GateState last_gate_state_ = GATE_UNINITIALIZED;
GateCalculatorOptions::GateState last_gate_state_ =
GateCalculatorOptions::GATE_UNINITIALIZED;
int num_data_streams_;
bool empty_packets_as_allow_;
bool use_side_packet_for_allow_disallow_ = false;

View File

@ -31,4 +31,13 @@ message GateCalculatorOptions {
// Whether to allow or disallow the input streams to pass when no
// ALLOW/DISALLOW input or side input is specified.
optional bool allow = 2 [default = false];
enum GateState {
UNSPECIFIED = 0;
GATE_UNINITIALIZED = 1;
GATE_ALLOW = 2;
GATE_DISALLOW = 3;
}
optional GateState initial_gate_state = 3 [default = GATE_UNINITIALIZED];
}

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/log/absl_log.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/calculator_runner.h"
#include "mediapipe/framework/port/gtest.h"
@ -356,18 +357,18 @@ TEST_F(GateCalculatorTest, AllowWithStateChangeNoDataStreams) {
RunTimeStepWithoutDataStream(kTimestampValue2, "ALLOW", true);
constexpr int64_t kTimestampValue3 = 45;
RunTimeStepWithoutDataStream(kTimestampValue3, "ALLOW", false);
LOG(INFO) << "a";
ABSL_LOG(INFO) << "a";
const std::vector<Packet>& output =
runner()->Outputs().Get("STATE_CHANGE", 0).packets;
LOG(INFO) << "s";
ABSL_LOG(INFO) << "s";
ASSERT_EQ(2, output.size());
LOG(INFO) << "d";
ABSL_LOG(INFO) << "d";
EXPECT_EQ(kTimestampValue1, output[0].Timestamp().Value());
EXPECT_EQ(kTimestampValue3, output[1].Timestamp().Value());
LOG(INFO) << "f";
ABSL_LOG(INFO) << "f";
EXPECT_EQ(true, output[0].Get<bool>()); // Allow.
EXPECT_EQ(false, output[1].Get<bool>()); // Disallow.
LOG(INFO) << "g";
ABSL_LOG(INFO) << "g";
}
TEST_F(GateCalculatorTest, DisallowWithStateChange) {
@ -458,5 +459,29 @@ TEST_F(GateCalculatorTest, AllowInitialNoStateTransition) {
ASSERT_EQ(0, output.size());
}
// Must detect allow value for first timestamp as a state change when the
// initial state is set to GATE_DISALLOW.
TEST_F(GateCalculatorTest, StateChangeTriggeredWithInitialGateStateOption) {
SetRunner(R"(
calculator: "GateCalculator"
input_stream: "test_input"
input_stream: "ALLOW:allow"
output_stream: "test_output"
output_stream: "STATE_CHANGE:state_change"
options: {
[mediapipe.GateCalculatorOptions.ext] {
initial_gate_state: GATE_DISALLOW
}
}
)");
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, "ALLOW", true);
const std::vector<Packet>& output =
runner()->Outputs().Get("STATE_CHANGE", 0).packets;
ASSERT_EQ(1, output.size());
}
} // namespace
} // namespace mediapipe

View File

@ -17,6 +17,7 @@
#include "mediapipe/framework/formats/classification.pb.h"
#include "mediapipe/framework/formats/detection.pb.h"
#include "mediapipe/framework/formats/landmark.pb.h"
#include "mediapipe/framework/formats/rect.pb.h"
namespace mediapipe {
namespace api2 {
@ -37,5 +38,12 @@ using GetDetectionVectorItemCalculator =
GetVectorItemCalculator<mediapipe::Detection>;
REGISTER_CALCULATOR(GetDetectionVectorItemCalculator);
using GetNormalizedRectVectorItemCalculator =
GetVectorItemCalculator<NormalizedRect>;
REGISTER_CALCULATOR(GetNormalizedRectVectorItemCalculator);
using GetRectVectorItemCalculator = GetVectorItemCalculator<Rect>;
REGISTER_CALCULATOR(GetRectVectorItemCalculator);
} // namespace api2
} // namespace mediapipe

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/log/absl_log.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h"
@ -78,7 +79,7 @@ absl::Status ImmediateMuxCalculator::Process(CalculatorContext* cc) {
if (packet.Timestamp() >= cc->Outputs().Index(0).NextTimestampBound()) {
cc->Outputs().Index(0).AddPacket(packet);
} else {
LOG_FIRST_N(WARNING, 5)
ABSL_LOG_FIRST_N(WARNING, 5)
<< "Dropping a packet with timestamp " << packet.Timestamp();
}
if (cc->Outputs().NumEntries() >= 2) {

View File

@ -16,6 +16,7 @@
#include <vector>
#include "Eigen/Core"
#include "absl/log/absl_check.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/calculator_runner.h"
#include "mediapipe/framework/formats/matrix.h"
@ -209,7 +210,7 @@ TEST(MatrixMultiplyCalculatorTest, Multiply) {
MatrixFromTextProto(kSamplesText, &samples);
Matrix expected;
MatrixFromTextProto(kExpectedText, &expected);
CHECK_EQ(samples.cols(), expected.cols());
ABSL_CHECK_EQ(samples.cols(), expected.cols());
for (int i = 0; i < samples.cols(); ++i) {
// Take a column from samples and produce a packet with just that

View File

@ -35,7 +35,7 @@ class MatrixToVectorCalculatorTest
void SetUp() override { calculator_name_ = "MatrixToVectorCalculator"; }
void AppendInput(const std::vector<float>& column_major_data,
int64 timestamp) {
int64_t timestamp) {
ASSERT_EQ(num_input_samples_ * num_input_channels_,
column_major_data.size());
Eigen::Map<const Matrix> data_map(&column_major_data[0],

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/log/absl_log.h"
#include "mediapipe/framework/api2/node.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/ret_check.h"
@ -53,7 +54,7 @@ class MergeCalculator : public Node {
static absl::Status UpdateContract(CalculatorContract* cc) {
RET_CHECK_GT(kIn(cc).Count(), 0) << "Needs at least one input stream";
if (kIn(cc).Count() == 1) {
LOG(WARNING)
ABSL_LOG(WARNING)
<< "MergeCalculator expects multiple input streams to merge but is "
"receiving only one. Make sure the calculator is configured "
"correctly or consider removing this calculator to reduce "
@ -72,8 +73,8 @@ class MergeCalculator : public Node {
}
}
LOG(WARNING) << "Empty input packets at timestamp "
<< cc->InputTimestamp().Value();
ABSL_LOG(WARNING) << "Empty input packets at timestamp "
<< cc->InputTimestamp().Value();
return absl::OkStatus();
}

View File

@ -1,4 +1,4 @@
/* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
/* Copyright 2022 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.

View File

@ -1,4 +1,4 @@
/* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
/* Copyright 2022 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.

View File

@ -16,6 +16,9 @@
#include <memory>
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
namespace {
// Reflect an integer against the lower and upper bound of an interval.
int64_t ReflectBetween(int64_t ts, int64_t ts_min, int64_t ts_max) {
@ -177,7 +180,7 @@ PacketResamplerCalculator::GetSamplingStrategy(
const PacketResamplerCalculatorOptions& options) {
if (options.reproducible_sampling()) {
if (!options.jitter_with_reflection()) {
LOG(WARNING)
ABSL_LOG(WARNING)
<< "reproducible_sampling enabled w/ jitter_with_reflection "
"disabled. "
<< "reproducible_sampling always uses jitter with reflection, "
@ -200,15 +203,15 @@ PacketResamplerCalculator::GetSamplingStrategy(
Timestamp PacketResamplerCalculator::PeriodIndexToTimestamp(
int64_t index) const {
CHECK_EQ(jitter_, 0.0);
CHECK_NE(first_timestamp_, Timestamp::Unset());
ABSL_CHECK_EQ(jitter_, 0.0);
ABSL_CHECK_NE(first_timestamp_, Timestamp::Unset());
return first_timestamp_ + TimestampDiffFromSeconds(index / frame_rate_);
}
int64_t PacketResamplerCalculator::TimestampToPeriodIndex(
Timestamp timestamp) const {
CHECK_EQ(jitter_, 0.0);
CHECK_NE(first_timestamp_, Timestamp::Unset());
ABSL_CHECK_EQ(jitter_, 0.0);
ABSL_CHECK_NE(first_timestamp_, Timestamp::Unset());
return MathUtil::SafeRound<int64_t, double>(
(timestamp - first_timestamp_).Seconds() * frame_rate_);
}
@ -229,13 +232,15 @@ absl::Status LegacyJitterWithReflectionStrategy::Open(CalculatorContext* cc) {
if (resampler_options.output_header() !=
PacketResamplerCalculatorOptions::NONE) {
LOG(WARNING) << "VideoHeader::frame_rate holds the target value and not "
"the actual value.";
ABSL_LOG(WARNING)
<< "VideoHeader::frame_rate holds the target value and not "
"the actual value.";
}
if (calculator_->flush_last_packet_) {
LOG(WARNING) << "PacketResamplerCalculatorOptions.flush_last_packet is "
"ignored, because we are adding jitter.";
ABSL_LOG(WARNING)
<< "PacketResamplerCalculatorOptions.flush_last_packet is "
"ignored, because we are adding jitter.";
}
const auto& seed = cc->InputSidePackets().Tag(kSeedTag).Get<std::string>();
@ -254,7 +259,7 @@ absl::Status LegacyJitterWithReflectionStrategy::Open(CalculatorContext* cc) {
}
absl::Status LegacyJitterWithReflectionStrategy::Close(CalculatorContext* cc) {
if (!packet_reservoir_->IsEmpty()) {
LOG(INFO) << "Emitting pack from reservoir.";
ABSL_LOG(INFO) << "Emitting pack from reservoir.";
calculator_->OutputWithinLimits(cc, packet_reservoir_->GetSample());
}
return absl::OkStatus();
@ -285,7 +290,7 @@ absl::Status LegacyJitterWithReflectionStrategy::Process(
if (calculator_->frame_time_usec_ <
(cc->InputTimestamp() - calculator_->last_packet_.Timestamp()).Value()) {
LOG_FIRST_N(WARNING, 2)
ABSL_LOG_FIRST_N(WARNING, 2)
<< "Adding jitter is not very useful when upsampling.";
}
@ -340,8 +345,8 @@ void LegacyJitterWithReflectionStrategy::UpdateNextOutputTimestampWithJitter() {
next_output_timestamp_ = Timestamp(ReflectBetween(
next_output_timestamp_.Value(), next_output_timestamp_min_.Value(),
next_output_timestamp_max_.Value()));
CHECK_GE(next_output_timestamp_, next_output_timestamp_min_);
CHECK_LT(next_output_timestamp_, next_output_timestamp_max_);
ABSL_CHECK_GE(next_output_timestamp_, next_output_timestamp_min_);
ABSL_CHECK_LT(next_output_timestamp_, next_output_timestamp_max_);
}
absl::Status ReproducibleJitterWithReflectionStrategy::Open(
@ -352,13 +357,15 @@ absl::Status ReproducibleJitterWithReflectionStrategy::Open(
if (resampler_options.output_header() !=
PacketResamplerCalculatorOptions::NONE) {
LOG(WARNING) << "VideoHeader::frame_rate holds the target value and not "
"the actual value.";
ABSL_LOG(WARNING)
<< "VideoHeader::frame_rate holds the target value and not "
"the actual value.";
}
if (calculator_->flush_last_packet_) {
LOG(WARNING) << "PacketResamplerCalculatorOptions.flush_last_packet is "
"ignored, because we are adding jitter.";
ABSL_LOG(WARNING)
<< "PacketResamplerCalculatorOptions.flush_last_packet is "
"ignored, because we are adding jitter.";
}
const auto& seed = cc->InputSidePackets().Tag(kSeedTag).Get<std::string>();
@ -411,7 +418,7 @@ absl::Status ReproducibleJitterWithReflectionStrategy::Process(
// Note, if the stream is upsampling, this could lead to the same packet
// being emitted twice. Upsampling and jitter doesn't make much sense
// but does technically work.
LOG_FIRST_N(WARNING, 2)
ABSL_LOG_FIRST_N(WARNING, 2)
<< "Adding jitter is not very useful when upsampling.";
}
@ -499,13 +506,15 @@ absl::Status JitterWithoutReflectionStrategy::Open(CalculatorContext* cc) {
if (resampler_options.output_header() !=
PacketResamplerCalculatorOptions::NONE) {
LOG(WARNING) << "VideoHeader::frame_rate holds the target value and not "
"the actual value.";
ABSL_LOG(WARNING)
<< "VideoHeader::frame_rate holds the target value and not "
"the actual value.";
}
if (calculator_->flush_last_packet_) {
LOG(WARNING) << "PacketResamplerCalculatorOptions.flush_last_packet is "
"ignored, because we are adding jitter.";
ABSL_LOG(WARNING)
<< "PacketResamplerCalculatorOptions.flush_last_packet is "
"ignored, because we are adding jitter.";
}
const auto& seed = cc->InputSidePackets().Tag(kSeedTag).Get<std::string>();
@ -555,7 +564,7 @@ absl::Status JitterWithoutReflectionStrategy::Process(CalculatorContext* cc) {
if (calculator_->frame_time_usec_ <
(cc->InputTimestamp() - calculator_->last_packet_.Timestamp()).Value()) {
LOG_FIRST_N(WARNING, 2)
ABSL_LOG_FIRST_N(WARNING, 2)
<< "Adding jitter is not very useful when upsampling.";
}

View File

@ -13,7 +13,6 @@
#include "mediapipe/framework/deps/random_base.h"
#include "mediapipe/framework/formats/video_stream_header.h"
#include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/port/status_macros.h"

View File

@ -51,9 +51,9 @@ class SimpleRunner : public CalculatorRunner {
virtual ~SimpleRunner() {}
void SetInput(const std::vector<int64>& timestamp_list) {
void SetInput(const std::vector<int64_t>& timestamp_list) {
MutableInputs()->Index(0).packets.clear();
for (const int64 ts : timestamp_list) {
for (const int64_t ts : timestamp_list) {
MutableInputs()->Index(0).packets.push_back(
Adopt(new std::string(absl::StrCat("Frame #", ts)))
.At(Timestamp(ts)));
@ -72,8 +72,8 @@ class SimpleRunner : public CalculatorRunner {
}
void CheckOutputTimestamps(
const std::vector<int64>& expected_frames,
const std::vector<int64>& expected_timestamps) const {
const std::vector<int64_t>& expected_frames,
const std::vector<int64_t>& expected_timestamps) const {
EXPECT_EQ(expected_frames.size(), Outputs().Index(0).packets.size());
EXPECT_EQ(expected_timestamps.size(), Outputs().Index(0).packets.size());
int count = 0;
@ -112,7 +112,7 @@ MATCHER_P2(PacketAtTimestamp, payload, timestamp,
*result_listener << "at incorrect timestamp = " << arg.Timestamp().Value();
return false;
}
int64 actual_payload = arg.template Get<int64>();
int64_t actual_payload = arg.template Get<int64_t>();
if (actual_payload != payload) {
*result_listener << "with incorrect payload = " << actual_payload;
return false;
@ -137,18 +137,18 @@ class ReproducibleJitterWithReflectionStrategyForTesting
//
// An EXPECT will fail if sequence is less than the number requested during
// processing.
static std::vector<uint64> random_sequence;
static std::vector<uint64_t> random_sequence;
protected:
virtual uint64 GetNextRandom(uint64 n) {
virtual uint64_t GetNextRandom(uint64_t n) {
EXPECT_LT(sequence_index_, random_sequence.size());
return random_sequence[sequence_index_++] % n;
}
private:
int32 sequence_index_ = 0;
int32_t sequence_index_ = 0;
};
std::vector<uint64>
std::vector<uint64_t>
ReproducibleJitterWithReflectionStrategyForTesting::random_sequence;
// PacketResamplerCalculator child class which injects a specified stream
@ -469,7 +469,7 @@ TEST(PacketResamplerCalculatorTest, SetVideoHeader) {
}
)pb"));
for (const int64 ts : {0, 5000, 10010, 15001, 19990}) {
for (const int64_t ts : {0, 5000, 10010, 15001, 19990}) {
runner.MutableInputs()->Tag(kDataTag).packets.push_back(
Adopt(new std::string(absl::StrCat("Frame #", ts))).At(Timestamp(ts)));
}

View File

@ -71,7 +71,7 @@ TEST_F(PacketSequencerCalculatorTest, IsRegistered) {
CalculatorBaseRegistry::IsRegistered("PacketSequencerCalculator"));
}
// Shows how control packets recieve timestamps before and after frame packets
// Shows how control packets receive timestamps before and after frame packets
// have arrived.
TEST_F(PacketSequencerCalculatorTest, ChannelEarly) {
CalculatorGraphConfig::Node node_config = BuildNodeConfig();

View File

@ -17,6 +17,7 @@
#include <cmath> // for ceil
#include <memory>
#include "absl/log/absl_check.h"
#include "mediapipe/calculators/core/packet_thinner_calculator.pb.h"
#include "mediapipe/framework/calculator_context.h"
#include "mediapipe/framework/calculator_framework.h"
@ -160,8 +161,8 @@ absl::Status PacketThinnerCalculator::Open(CalculatorContext* cc) {
thinner_type_ = options.thinner_type();
// This check enables us to assume only two thinner types exist in Process()
CHECK(thinner_type_ == PacketThinnerCalculatorOptions::ASYNC ||
thinner_type_ == PacketThinnerCalculatorOptions::SYNC)
ABSL_CHECK(thinner_type_ == PacketThinnerCalculatorOptions::ASYNC ||
thinner_type_ == PacketThinnerCalculatorOptions::SYNC)
<< "Unsupported thinner type.";
if (thinner_type_ == PacketThinnerCalculatorOptions::ASYNC) {
@ -177,7 +178,8 @@ absl::Status PacketThinnerCalculator::Open(CalculatorContext* cc) {
} else {
period_ = TimestampDiff(options.period());
}
CHECK_LT(TimestampDiff(0), period_) << "Specified period must be positive.";
ABSL_CHECK_LT(TimestampDiff(0), period_)
<< "Specified period must be positive.";
if (options.has_start_time()) {
start_time_ = Timestamp(options.start_time());
@ -189,7 +191,7 @@ absl::Status PacketThinnerCalculator::Open(CalculatorContext* cc) {
end_time_ =
options.has_end_time() ? Timestamp(options.end_time()) : Timestamp::Max();
CHECK_LT(start_time_, end_time_)
ABSL_CHECK_LT(start_time_, end_time_)
<< "Invalid PacketThinner: start_time must be earlier than end_time";
sync_output_timestamps_ = options.sync_output_timestamps();
@ -232,7 +234,7 @@ absl::Status PacketThinnerCalculator::Close(CalculatorContext* cc) {
// Emit any saved packets before quitting.
if (!saved_packet_.IsEmpty()) {
// Only sync thinner should have saved packets.
CHECK_EQ(PacketThinnerCalculatorOptions::SYNC, thinner_type_);
ABSL_CHECK_EQ(PacketThinnerCalculatorOptions::SYNC, thinner_type_);
if (sync_output_timestamps_) {
cc->Outputs().Index(0).AddPacket(
saved_packet_.At(NearestSyncTimestamp(saved_packet_.Timestamp())));
@ -269,7 +271,7 @@ absl::Status PacketThinnerCalculator::SyncThinnerProcess(
const Timestamp saved_sync = NearestSyncTimestamp(saved);
const Timestamp now = cc->InputTimestamp();
const Timestamp now_sync = NearestSyncTimestamp(now);
CHECK_LE(saved_sync, now_sync);
ABSL_CHECK_LE(saved_sync, now_sync);
if (saved_sync == now_sync) {
// Saved Packet is in same interval as current packet.
// Replace saved packet with current if it is at least as
@ -295,7 +297,7 @@ absl::Status PacketThinnerCalculator::SyncThinnerProcess(
}
Timestamp PacketThinnerCalculator::NearestSyncTimestamp(Timestamp now) const {
CHECK_NE(start_time_, Timestamp::Unset())
ABSL_CHECK_NE(start_time_, Timestamp::Unset())
<< "Method only valid for sync thinner calculator.";
// Computation is done using int64 arithmetic. No easy way to avoid
@ -303,12 +305,12 @@ Timestamp PacketThinnerCalculator::NearestSyncTimestamp(Timestamp now) const {
const int64_t now64 = now.Value();
const int64_t start64 = start_time_.Value();
const int64_t period64 = period_.Value();
CHECK_LE(0, period64);
ABSL_CHECK_LE(0, period64);
// Round now64 to its closest interval (units of period64).
int64_t sync64 =
(now64 - start64 + period64 / 2) / period64 * period64 + start64;
CHECK_LE(abs(now64 - sync64), period64 / 2)
ABSL_CHECK_LE(abs(now64 - sync64), period64 / 2)
<< "start64: " << start64 << "; now64: " << now64
<< "; sync64: " << sync64;

View File

@ -16,6 +16,7 @@
#include <string>
#include <vector>
#include "absl/log/absl_check.h"
#include "absl/strings/str_cat.h"
#include "mediapipe/calculators/core/packet_thinner_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
@ -70,7 +71,7 @@ class SimpleRunner : public CalculatorRunner {
}
double GetFrameRate() const {
CHECK(!Outputs().Index(0).header.IsEmpty());
ABSL_CHECK(!Outputs().Index(0).header.IsEmpty());
return Outputs().Index(0).header.Get<VideoHeader>().frame_rate;
}
};

View File

@ -123,7 +123,10 @@ class PreviousLoopbackCalculator : public Node {
// However, LOOP packet is empty.
kPrevLoop(cc).SetNextTimestampBound(main_spec.timestamp + 1);
} else {
kPrevLoop(cc).Send(loop_candidate.At(main_spec.timestamp));
// Avoids sending leftovers to a stream that's already closed.
if (!kPrevLoop(cc).IsClosed()) {
kPrevLoop(cc).Send(loop_candidate.At(main_spec.timestamp));
}
}
loop_packets_.pop_front();
main_packet_specs_.pop_front();

View File

@ -43,8 +43,8 @@ constexpr char kDisallowTag[] = "DISALLOW";
// Returns the timestamp values for a vector of Packets.
// TODO: puth this kind of test util in a common place.
std::vector<int64> TimestampValues(const std::vector<Packet>& packets) {
std::vector<int64> result;
std::vector<int64_t> TimestampValues(const std::vector<Packet>& packets) {
std::vector<int64_t> result;
for (const Packet& packet : packets) {
result.push_back(packet.Timestamp().Value());
}
@ -371,7 +371,7 @@ TEST(PreviousLoopbackCalculator, EmptyLoopForever) {
for (int main_ts = 0; main_ts < 50; ++main_ts) {
send_packet("in", main_ts);
MP_EXPECT_OK(graph_.WaitUntilIdle());
std::vector<int64> ts_values = TimestampValues(outputs);
std::vector<int64_t> ts_values = TimestampValues(outputs);
EXPECT_EQ(ts_values.size(), main_ts + 1);
for (int j = 0; j < main_ts + 1; ++j) {
EXPECT_EQ(ts_values[j], j);

View File

@ -14,6 +14,7 @@
#include <deque>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/core/sequence_shift_calculator.pb.h"
#include "mediapipe/framework/api2/node.h"
#include "mediapipe/framework/calculator_framework.h"
@ -101,7 +102,7 @@ void SequenceShiftCalculator::ProcessPositiveOffset(CalculatorContext* cc) {
kOut(cc).Send(packet_cache_.front().At(cc->InputTimestamp()));
packet_cache_.pop_front();
} else if (emit_empty_packets_before_first_packet_) {
LOG(FATAL) << "Not supported yet";
ABSL_LOG(FATAL) << "Not supported yet";
}
// Store current packet for later output.
packet_cache_.push_back(kIn(cc).packet());

View File

@ -17,6 +17,7 @@
#include <set>
#include <string>
#include "absl/status/status.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/ret_check.h"
@ -32,6 +33,7 @@ namespace {
constexpr char kTagAtPreStream[] = "AT_PRESTREAM";
constexpr char kTagAtPostStream[] = "AT_POSTSTREAM";
constexpr char kTagAtZero[] = "AT_ZERO";
constexpr char kTagAtFirstTick[] = "AT_FIRST_TICK";
constexpr char kTagAtTick[] = "AT_TICK";
constexpr char kTagTick[] = "TICK";
constexpr char kTagAtTimestamp[] = "AT_TIMESTAMP";
@ -43,6 +45,7 @@ static std::map<std::string, Timestamp>* kTimestampMap = []() {
res->emplace(kTagAtPostStream, Timestamp::PostStream());
res->emplace(kTagAtZero, Timestamp(0));
res->emplace(kTagAtTick, Timestamp::Unset());
res->emplace(kTagAtFirstTick, Timestamp::Unset());
res->emplace(kTagAtTimestamp, Timestamp::Unset());
return res;
}();
@ -59,8 +62,8 @@ std::string GetOutputTag(const CC& cc) {
// timestamp, depending on the tag used to define output stream(s). (One tag can
// be used only.)
//
// Valid tags are AT_PRESTREAM, AT_POSTSTREAM, AT_ZERO, AT_TICK, AT_TIMESTAMP
// and corresponding timestamps are Timestamp::PreStream(),
// Valid tags are AT_PRESTREAM, AT_POSTSTREAM, AT_ZERO, AT_TICK, AT_FIRST_TICK,
// AT_TIMESTAMP and corresponding timestamps are Timestamp::PreStream(),
// Timestamp::PostStream(), Timestamp(0), timestamp of a packet received in TICK
// input, and timestamp received from a side input.
//
@ -96,6 +99,7 @@ class SidePacketToStreamCalculator : public CalculatorBase {
private:
bool is_tick_processing_ = false;
bool close_on_first_tick_ = false;
std::string output_tag_;
};
REGISTER_CALCULATOR(SidePacketToStreamCalculator);
@ -103,13 +107,16 @@ REGISTER_CALCULATOR(SidePacketToStreamCalculator);
absl::Status SidePacketToStreamCalculator::GetContract(CalculatorContract* cc) {
const auto& tags = cc->Outputs().GetTags();
RET_CHECK(tags.size() == 1 && kTimestampMap->count(*tags.begin()) == 1)
<< "Only one of AT_PRESTREAM, AT_POSTSTREAM, AT_ZERO, AT_TICK and "
"AT_TIMESTAMP tags is allowed and required to specify output "
"stream(s).";
RET_CHECK(
(cc->Outputs().HasTag(kTagAtTick) && cc->Inputs().HasTag(kTagTick)) ||
(!cc->Outputs().HasTag(kTagAtTick) && !cc->Inputs().HasTag(kTagTick)))
<< "Either both of TICK and AT_TICK should be used or none of them.";
<< "Only one of AT_PRESTREAM, AT_POSTSTREAM, AT_ZERO, AT_TICK, "
"AT_FIRST_TICK and AT_TIMESTAMP tags is allowed and required to "
"specify output stream(s).";
const bool has_tick_output =
cc->Outputs().HasTag(kTagAtTick) || cc->Outputs().HasTag(kTagAtFirstTick);
const bool has_tick_input = cc->Inputs().HasTag(kTagTick);
RET_CHECK((has_tick_output && has_tick_input) ||
(!has_tick_output && !has_tick_input))
<< "Either both TICK input and tick (AT_TICK/AT_FIRST_TICK) output "
"should be used or none of them.";
RET_CHECK((cc->Outputs().HasTag(kTagAtTimestamp) &&
cc->InputSidePackets().HasTag(kTagSideInputTimestamp)) ||
(!cc->Outputs().HasTag(kTagAtTimestamp) &&
@ -121,7 +128,7 @@ absl::Status SidePacketToStreamCalculator::GetContract(CalculatorContract* cc) {
if (cc->Outputs().HasTag(kTagAtTimestamp)) {
RET_CHECK_EQ(num_entries + 1, cc->InputSidePackets().NumEntries())
<< "For AT_TIMESTAMP tag, 2 input side packets are required.";
cc->InputSidePackets().Tag(kTagSideInputTimestamp).Set<int64>();
cc->InputSidePackets().Tag(kTagSideInputTimestamp).Set<int64_t>();
} else {
RET_CHECK_EQ(num_entries, cc->InputSidePackets().NumEntries())
<< "Same number of input side packets and output streams is required.";
@ -148,11 +155,17 @@ absl::Status SidePacketToStreamCalculator::Open(CalculatorContext* cc) {
// timestamp bound update.
cc->SetOffset(TimestampDiff(0));
}
if (output_tag_ == kTagAtFirstTick) {
close_on_first_tick_ = true;
}
return absl::OkStatus();
}
absl::Status SidePacketToStreamCalculator::Process(CalculatorContext* cc) {
if (is_tick_processing_) {
if (cc->Outputs().Get(output_tag_, 0).IsClosed()) {
return absl::OkStatus();
}
// TICK input is guaranteed to be non-empty, as it's the only input stream
// for this calculator.
const auto& timestamp = cc->Inputs().Tag(kTagTick).Value().Timestamp();
@ -160,6 +173,9 @@ absl::Status SidePacketToStreamCalculator::Process(CalculatorContext* cc) {
cc->Outputs()
.Get(output_tag_, i)
.AddPacket(cc->InputSidePackets().Index(i).At(timestamp));
if (close_on_first_tick_) {
cc->Outputs().Get(output_tag_, i).Close();
}
}
return absl::OkStatus();
@ -170,6 +186,7 @@ absl::Status SidePacketToStreamCalculator::Process(CalculatorContext* cc) {
absl::Status SidePacketToStreamCalculator::Close(CalculatorContext* cc) {
if (!cc->Outputs().HasTag(kTagAtTick) &&
!cc->Outputs().HasTag(kTagAtFirstTick) &&
!cc->Outputs().HasTag(kTagAtTimestamp)) {
const auto& timestamp = kTimestampMap->at(output_tag_);
for (int i = 0; i < cc->Outputs().NumEntries(output_tag_); ++i) {
@ -178,8 +195,8 @@ absl::Status SidePacketToStreamCalculator::Close(CalculatorContext* cc) {
.AddPacket(cc->InputSidePackets().Index(i).At(timestamp));
}
} else if (cc->Outputs().HasTag(kTagAtTimestamp)) {
int64 timestamp =
cc->InputSidePackets().Tag(kTagSideInputTimestamp).Get<int64>();
int64_t timestamp =
cc->InputSidePackets().Tag(kTagSideInputTimestamp).Get<int64_t>();
for (int i = 0; i < cc->Outputs().NumEntries(output_tag_); ++i) {
cc->Outputs()
.Get(output_tag_, i)

View File

@ -27,13 +27,17 @@
#include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/port/status_matchers.h"
#include "mediapipe/framework/tool/options_util.h"
#include "mediapipe/util/packet_test_util.h"
namespace mediapipe {
namespace {
using testing::HasSubstr;
using ::testing::ElementsAre;
using ::testing::Eq;
using ::testing::HasSubstr;
using ::testing::IsEmpty;
TEST(SidePacketToStreamCalculator, WrongConfig_MissingTick) {
TEST(SidePacketToStreamCalculator, WrongConfigWithMissingTick) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(
@ -52,10 +56,35 @@ TEST(SidePacketToStreamCalculator, WrongConfig_MissingTick) {
EXPECT_THAT(
status.message(),
HasSubstr(
"Either both of TICK and AT_TICK should be used or none of them."));
"Either both TICK input and tick (AT_TICK/AT_FIRST_TICK) output "
"should be used or none of them."));
}
TEST(SidePacketToStreamCalculator, WrongConfig_MissingTimestampSideInput) {
TEST(SidePacketToStreamCalculator,
WrongConfigWithMissingTickForFirstTickProcessing) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(
input_stream: "tick"
input_side_packet: "side_packet"
output_stream: "packet"
node {
calculator: "SidePacketToStreamCalculator"
input_side_packet: "side_packet"
output_stream: "AT_FIRST_TICK:packet"
}
)pb");
CalculatorGraph graph;
auto status = graph.Initialize(graph_config);
EXPECT_FALSE(status.ok());
EXPECT_THAT(
status.message(),
HasSubstr(
"Either both TICK input and tick (AT_TICK/AT_FIRST_TICK) output "
"should be used or none of them."));
}
TEST(SidePacketToStreamCalculator, WrongConfigWithMissingTimestampSideInput) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(
@ -76,7 +105,7 @@ TEST(SidePacketToStreamCalculator, WrongConfig_MissingTimestampSideInput) {
"or none of them."));
}
TEST(SidePacketToStreamCalculator, WrongConfig_NonExistentTag) {
TEST(SidePacketToStreamCalculator, WrongConfigWithNonExistentTag) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(
@ -92,14 +121,13 @@ TEST(SidePacketToStreamCalculator, WrongConfig_NonExistentTag) {
CalculatorGraph graph;
auto status = graph.Initialize(graph_config);
EXPECT_FALSE(status.ok());
EXPECT_THAT(
status.message(),
HasSubstr("Only one of AT_PRESTREAM, AT_POSTSTREAM, AT_ZERO, AT_TICK and "
"AT_TIMESTAMP tags is allowed and required to specify output "
"stream(s)."));
EXPECT_THAT(status.message(),
HasSubstr("Only one of AT_PRESTREAM, AT_POSTSTREAM, AT_ZERO, "
"AT_TICK, AT_FIRST_TICK and AT_TIMESTAMP tags is "
"allowed and required to specify output stream(s)."));
}
TEST(SidePacketToStreamCalculator, WrongConfig_MixedTags) {
TEST(SidePacketToStreamCalculator, WrongConfigWithMixedTags) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(
@ -117,14 +145,13 @@ TEST(SidePacketToStreamCalculator, WrongConfig_MixedTags) {
CalculatorGraph graph;
auto status = graph.Initialize(graph_config);
EXPECT_FALSE(status.ok());
EXPECT_THAT(
status.message(),
HasSubstr("Only one of AT_PRESTREAM, AT_POSTSTREAM, AT_ZERO, AT_TICK and "
"AT_TIMESTAMP tags is allowed and required to specify output "
"stream(s)."));
EXPECT_THAT(status.message(),
HasSubstr("Only one of AT_PRESTREAM, AT_POSTSTREAM, AT_ZERO, "
"AT_TICK, AT_FIRST_TICK and AT_TIMESTAMP tags is "
"allowed and required to specify output stream(s)."));
}
TEST(SidePacketToStreamCalculator, WrongConfig_NotEnoughSidePackets) {
TEST(SidePacketToStreamCalculator, WrongConfigWithNotEnoughSidePackets) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(
@ -146,7 +173,7 @@ TEST(SidePacketToStreamCalculator, WrongConfig_NotEnoughSidePackets) {
"Same number of input side packets and output streams is required."));
}
TEST(SidePacketToStreamCalculator, WrongConfig_NotEnoughOutputStreams) {
TEST(SidePacketToStreamCalculator, WrongConfigWithNotEnoughOutputStreams) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(
@ -248,7 +275,50 @@ TEST(SidePacketToStreamCalculator, AtTick) {
tick_and_verify(/*at_timestamp=*/1025);
}
TEST(SidePacketToStreamCalculator, AtTick_MultipleSidePackets) {
TEST(SidePacketToStreamCalculator, AtFirstTick) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(
input_stream: "tick"
input_side_packet: "side_packet"
output_stream: "packet"
node {
calculator: "SidePacketToStreamCalculator"
input_stream: "TICK:tick"
input_side_packet: "side_packet"
output_stream: "AT_FIRST_TICK:packet"
}
)pb");
std::vector<Packet> output_packets;
tool::AddVectorSink("packet", &graph_config, &output_packets);
CalculatorGraph graph;
MP_ASSERT_OK(graph.Initialize(graph_config));
const int expected_value = 20;
const Timestamp kTestTimestamp(1234);
MP_ASSERT_OK(
graph.StartRun({{"side_packet", MakePacket<int>(expected_value)}}));
auto insert_tick = [&graph](Timestamp at_timestamp) {
MP_ASSERT_OK(graph.AddPacketToInputStream(
"tick", MakePacket<int>(/*doesn't matter*/ 1).At(at_timestamp)));
MP_ASSERT_OK(graph.WaitUntilIdle());
};
insert_tick(kTestTimestamp);
EXPECT_THAT(output_packets,
ElementsAre(PacketContainsTimestampAndPayload<int>(
Eq(kTestTimestamp), Eq(expected_value))));
output_packets.clear();
// Should not result in an additional output.
insert_tick(kTestTimestamp + 1);
EXPECT_THAT(output_packets, IsEmpty());
}
TEST(SidePacketToStreamCalculator, AtTickWithMultipleSidePackets) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(
@ -302,6 +372,62 @@ TEST(SidePacketToStreamCalculator, AtTick_MultipleSidePackets) {
tick_and_verify(/*at_timestamp=*/1025);
}
TEST(SidePacketToStreamCalculator, AtFirstTickWithMultipleSidePackets) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(
input_stream: "tick"
input_side_packet: "side_packet0"
input_side_packet: "side_packet1"
output_stream: "packet0"
output_stream: "packet1"
node {
calculator: "SidePacketToStreamCalculator"
input_stream: "TICK:tick"
input_side_packet: "side_packet0"
input_side_packet: "side_packet1"
output_stream: "AT_FIRST_TICK:0:packet0"
output_stream: "AT_FIRST_TICK:1:packet1"
}
)pb");
std::vector<Packet> output_packets0;
tool::AddVectorSink("packet0", &graph_config, &output_packets0);
std::vector<Packet> output_packets1;
tool::AddVectorSink("packet1", &graph_config, &output_packets1);
CalculatorGraph graph;
MP_ASSERT_OK(graph.Initialize(graph_config));
const int expected_value0 = 20;
const int expected_value1 = 128;
const Timestamp kTestTimestamp(1234);
MP_ASSERT_OK(
graph.StartRun({{"side_packet0", MakePacket<int>(expected_value0)},
{"side_packet1", MakePacket<int>(expected_value1)}}));
auto insert_tick = [&graph](Timestamp at_timestamp) {
MP_ASSERT_OK(graph.AddPacketToInputStream(
"tick", MakePacket<int>(/*doesn't matter*/ 1).At(at_timestamp)));
MP_ASSERT_OK(graph.WaitUntilIdle());
};
insert_tick(kTestTimestamp);
EXPECT_THAT(output_packets0,
ElementsAre(PacketContainsTimestampAndPayload<int>(
Eq(kTestTimestamp), Eq(expected_value0))));
EXPECT_THAT(output_packets1,
ElementsAre(PacketContainsTimestampAndPayload<int>(
Eq(kTestTimestamp), Eq(expected_value1))));
output_packets0.clear();
output_packets1.clear();
// Should not result in an additional output.
insert_tick(kTestTimestamp + 1);
EXPECT_THAT(output_packets0, IsEmpty());
EXPECT_THAT(output_packets1, IsEmpty());
}
TEST(SidePacketToStreamCalculator, AtTimestamp) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
@ -334,7 +460,7 @@ TEST(SidePacketToStreamCalculator, AtTimestamp) {
EXPECT_EQ(expected_value, output_packets.back().Get<int>());
}
TEST(SidePacketToStreamCalculator, AtTimestamp_MultipleOutputs) {
TEST(SidePacketToStreamCalculator, AtTimestampWithMultipleOutputs) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
R"pb(

View File

@ -17,6 +17,7 @@
#include "mediapipe/calculators/core/split_vector_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/body_rig.pb.h"
#include "mediapipe/framework/formats/landmark.pb.h"
#include "mediapipe/framework/port/canonical_errors.h"
#include "mediapipe/framework/port/ret_check.h"
@ -196,6 +197,18 @@ class SplitLandmarkListCalculator
};
REGISTER_CALCULATOR(SplitLandmarkListCalculator);
class SplitJointListCalculator : public SplitListsCalculator<Joint, JointList> {
protected:
int ListSize(const JointList& list) const override {
return list.joint_size();
}
const Joint GetItem(const JointList& list, int idx) const override {
return list.joint(idx);
}
Joint* AddItem(JointList& list) const override { return list.add_joint(); }
};
REGISTER_CALCULATOR(SplitJointListCalculator);
} // namespace mediapipe
// NOLINTNEXTLINE

View File

@ -18,6 +18,7 @@
#include "mediapipe/framework/formats/classification.pb.h"
#include "mediapipe/framework/formats/detection.pb.h"
#include "mediapipe/framework/formats/image.h"
#include "mediapipe/framework/formats/landmark.pb.h"
#include "mediapipe/framework/formats/matrix.h"
#include "mediapipe/framework/formats/rect.pb.h"
@ -86,4 +87,12 @@ REGISTER_CALCULATOR(SplitUint64tVectorCalculator);
typedef SplitVectorCalculator<float, false> SplitFloatVectorCalculator;
REGISTER_CALCULATOR(SplitFloatVectorCalculator);
typedef SplitVectorCalculator<mediapipe::Image, false>
SplitImageVectorCalculator;
REGISTER_CALCULATOR(SplitImageVectorCalculator);
typedef SplitVectorCalculator<std::array<float, 16>, false>
SplitAffineMatrixVectorCalculator;
REGISTER_CALCULATOR(SplitAffineMatrixVectorCalculator);
} // namespace mediapipe

View File

@ -12,11 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "mediapipe/framework/api2/node.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/timestamp.h"
namespace mediapipe {
namespace api2 {
// A calculator that takes a packet of an input stream and converts it to an
// output side packet. This calculator only works under the assumption that the
@ -28,21 +30,21 @@ namespace mediapipe {
// input_stream: "stream"
// output_side_packet: "side_packet"
// }
class StreamToSidePacketCalculator : public mediapipe::CalculatorBase {
class StreamToSidePacketCalculator : public Node {
public:
static absl::Status GetContract(mediapipe::CalculatorContract* cc) {
cc->Inputs().Index(0).SetAny();
cc->OutputSidePackets().Index(0).SetAny();
return absl::OkStatus();
}
static constexpr Input<AnyType>::Optional kIn{""};
static constexpr SideOutput<SameType<kIn>> kOut{""};
MEDIAPIPE_NODE_CONTRACT(kIn, kOut);
absl::Status Process(mediapipe::CalculatorContext* cc) override {
mediapipe::Packet& packet = cc->Inputs().Index(0).Value();
cc->OutputSidePackets().Index(0).Set(
packet.At(mediapipe::Timestamp::Unset()));
kOut(cc).Set(
kIn(cc).packet().As<AnyType>().At(mediapipe::Timestamp::Unset()));
return absl::OkStatus();
}
};
REGISTER_CALCULATOR(StreamToSidePacketCalculator);
MEDIAPIPE_REGISTER_NODE(StreamToSidePacketCalculator);
} // namespace api2
} // namespace mediapipe

View File

@ -0,0 +1,90 @@
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/status.h"
namespace mediapipe {
namespace {
constexpr char kInputValueTag[] = "IN";
constexpr char kTickerTag[] = "TICK";
constexpr char kOutputTag[] = "OUT";
constexpr char kIndicationTag[] = "FLAG";
} // namespace
// For every packet received on the TICK stream, if the IN stream is not
// empty - emit its value as is as OUT. Otherwise output a default packet.
// FLAG outputs true every time the default value has been used. It does not
// output anything when IN has a value.
//
// Example config:
// node {
// calculator: "ValueOrDefaultCalculator"
// input_stream: "IN:sometimes_missing_value"
// input_stream: "TICK:clock"
// output_stream: "OUT:value_or_default"
// output_stream: "FLAG:used_default"
// input_side_packet: "default"
// }
//
// TODO: Consider adding an option for a default value as a input-stream
// instead of a side-packet, so it will enable using standard calculators
// instead of creating a new packet-generators. It will also allow a dynamic
// default value.
class ValueOrDefaultCalculator : public mediapipe::CalculatorBase {
public:
ValueOrDefaultCalculator() {}
ValueOrDefaultCalculator(const ValueOrDefaultCalculator&) = delete;
ValueOrDefaultCalculator& operator=(const ValueOrDefaultCalculator&) = delete;
static mediapipe::Status GetContract(mediapipe::CalculatorContract* cc) {
cc->Inputs().Tag(kInputValueTag).SetAny();
cc->Inputs().Tag(kTickerTag).SetAny();
cc->Outputs().Tag(kOutputTag).SetSameAs(&cc->Inputs().Tag(kInputValueTag));
cc->Outputs().Tag(kIndicationTag).Set<bool>();
cc->InputSidePackets().Index(0).SetSameAs(
&cc->Inputs().Tag(kInputValueTag));
return mediapipe::OkStatus();
}
mediapipe::Status Open(mediapipe::CalculatorContext* cc) override {
if (!cc->Inputs().Tag(kInputValueTag).Header().IsEmpty()) {
cc->Outputs()
.Tag(kOutputTag)
.SetHeader(cc->Inputs().Tag(kInputValueTag).Header());
}
default_ = cc->InputSidePackets().Index(0);
cc->SetOffset(mediapipe::TimestampDiff(0));
return mediapipe::OkStatus();
}
mediapipe::Status Process(mediapipe::CalculatorContext* cc) override {
// Output according to the TICK signal.
if (cc->Inputs().Tag(kTickerTag).IsEmpty()) {
return mediapipe::OkStatus();
}
if (!cc->Inputs().Tag(kInputValueTag).IsEmpty()) {
// Output the input as is:
cc->Outputs()
.Tag(kOutputTag)
.AddPacket(cc->Inputs().Tag(kInputValueTag).Value());
} else {
// Output default:
cc->Outputs()
.Tag(kOutputTag)
.AddPacket(default_.At(cc->InputTimestamp()));
cc->Outputs()
.Tag(kIndicationTag)
.Add(new bool(true), cc->InputTimestamp());
}
return mediapipe::OkStatus();
}
private:
// The default value to replicate every time there is no new value.
mediapipe::Packet default_;
};
REGISTER_CALCULATOR(ValueOrDefaultCalculator);
} // namespace mediapipe

View File

@ -0,0 +1,240 @@
#include <algorithm>
#include <cstdint>
#include <vector>
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/calculator_runner.h"
#include "mediapipe/framework/packet.h"
#include "mediapipe/framework/port/gmock.h"
#include "mediapipe/framework/port/gtest.h"
#include "mediapipe/framework/port/status_matchers.h"
namespace mediapipe {
namespace {
using ::testing::AllOf;
using ::testing::ContainerEq;
using ::testing::Each;
using ::testing::ElementsAre;
using ::testing::IsEmpty;
using ::testing::SizeIs;
using ::testing::Test;
const int kDefaultValue = 0;
// Utility to a create a mediapipe graph runner with the tested calculator and a
// default value, for all the tests.
class ValueOrDefaultRunner : public mediapipe::CalculatorRunner {
public:
ValueOrDefaultRunner()
: mediapipe::CalculatorRunner(R"pb(
calculator: "ValueOrDefaultCalculator"
input_stream: "IN:in"
input_stream: "TICK:tick"
input_side_packet: "default"
output_stream: "OUT:out"
output_stream: "FLAG:used_default"
)pb") {
MutableSidePackets()->Index(0) = mediapipe::MakePacket<int>(kDefaultValue);
}
// Utility to push inputs to the runner to the TICK stream, so we could easily
// tick.
void TickAt(int64_t time) {
// The type or value of the stream isn't relevant, we use just a bool.
MutableInputs()->Tag("TICK").packets.push_back(
mediapipe::Adopt(new bool(false)).At(mediapipe::Timestamp(time)));
}
// Utility to push the real inputs to the runner (IN stream).
void ProvideInput(int64_t time, int value) {
MutableInputs()->Tag("IN").packets.push_back(
mediapipe::Adopt(new int(value)).At(mediapipe::Timestamp(time)));
}
// Extracts the timestamps (as int64) of the output stream of the calculator.
std::vector<int64_t> GetOutputTimestamps() const {
std::vector<int64_t> timestamps;
for (const mediapipe::Packet& packet : Outputs().Tag("OUT").packets) {
timestamps.emplace_back(packet.Timestamp().Value());
}
return timestamps;
}
// Extracts the values from the output stream of the calculator.
std::vector<int> GetOutputValues() const {
std::vector<int> values;
for (const mediapipe::Packet& packet : Outputs().Tag("OUT").packets) {
values.emplace_back(packet.Get<int>());
}
return values;
}
// Extracts the timestamps (as int64) of the flag stream, which indicates on
// times without an input value (i.e. using the default value).
std::vector<int64_t> GetFlagTimestamps() const {
std::vector<int64_t> timestamps;
for (const mediapipe::Packet& packet : Outputs().Tag("FLAG").packets) {
timestamps.emplace_back(packet.Timestamp().Value());
}
return timestamps;
}
// Extracts the output from the flags stream (which should always be true).
std::vector<bool> GetFlagValues() const {
std::vector<bool> flags;
for (const mediapipe::Packet& packet : Outputs().Tag("FLAG").packets) {
flags.emplace_back(packet.Get<bool>());
}
return flags;
}
};
// To be used as input values:
std::vector<int> GetIntegersRange(int size) {
std::vector<int> result;
for (int i = 0; i < size; ++i) {
// We start with default-value+1 so it won't contain the default value.
result.push_back(kDefaultValue + 1 + i);
}
return result;
}
TEST(ValueOrDefaultCalculatorTest, NoInputs) {
// Check that when no real inputs are provided - we get the default value over
// and over, with the correct timestamps.
ValueOrDefaultRunner runner;
const std::vector<int64_t> ticks = {0, 1, 2, 5, 8, 12, 33, 231};
for (int tick : ticks) {
runner.TickAt(tick);
}
MP_EXPECT_OK(runner.Run());
// Make sure we get the right timestamps:
EXPECT_THAT(runner.GetOutputTimestamps(), ContainerEq(ticks));
// All should be default value:
EXPECT_THAT(runner.GetOutputValues(),
AllOf(Each(kDefaultValue), SizeIs(ticks.size())));
// We should get the default indication all the time:
EXPECT_THAT(runner.GetFlagTimestamps(), ContainerEq(ticks));
}
TEST(ValueOrDefaultCalculatorTest, NeverDefault) {
// Check that when we provide the inputs on time - we get them as outputs.
ValueOrDefaultRunner runner;
const std::vector<int64_t> ticks = {0, 1, 2, 5, 8, 12, 33, 231};
const std::vector<int> values = GetIntegersRange(ticks.size());
for (int i = 0; i < ticks.size(); ++i) {
runner.TickAt(ticks[i]);
runner.ProvideInput(ticks[i], values[i]);
}
MP_EXPECT_OK(runner.Run());
// Make sure we get the right timestamps:
EXPECT_THAT(runner.GetOutputTimestamps(), ContainerEq(ticks));
// Should get the inputs values:
EXPECT_THAT(runner.GetOutputValues(), ContainerEq(values));
// We should never get the default indication:
EXPECT_THAT(runner.GetFlagTimestamps(), IsEmpty());
}
TEST(ValueOrDefaultCalculatorTest, DefaultAndValues) {
// Check that when we provide inputs only part of the time - we get them, but
// defaults at the missing times.
// That's the usual use case for this calculator.
ValueOrDefaultRunner runner;
const std::vector<int64_t> ticks = {0, 1, 5, 8, 12, 231};
// Provide inputs only part of the ticks.
// Chosen so there will be defaults before the first input, between the
// inputs and after the last input.
const std::vector<int64_t> in_ticks = {/*0,*/ 1, 5, /*8,*/ 12, /*, 231*/};
const std::vector<int> in_values = GetIntegersRange(in_ticks.size());
for (int tick : ticks) {
runner.TickAt(tick);
}
for (int i = 0; i < in_ticks.size(); ++i) {
runner.ProvideInput(in_ticks[i], in_values[i]);
}
MP_EXPECT_OK(runner.Run());
// Make sure we get all the timestamps:
EXPECT_THAT(runner.GetOutputTimestamps(), ContainerEq(ticks));
// The timestamps of the flag should be exactly the ones not in in_ticks.
EXPECT_THAT(runner.GetFlagTimestamps(), ElementsAre(0, 8, 231));
// And the values are default in these times, and the input values for
// in_ticks.
EXPECT_THAT(
runner.GetOutputValues(),
ElementsAre(kDefaultValue, 1, 2, kDefaultValue, 3, kDefaultValue));
}
TEST(ValueOrDefaultCalculatorTest, TimestampsMismatch) {
// Check that when we provide the inputs not on time - we don't get them.
ValueOrDefaultRunner runner;
const std::vector<int64_t> ticks = {1, 2, 5, 8, 12, 33, 231};
// The timestamps chosen so it will be before the first tick, in between ticks
// and after the last one. Also - more inputs than ticks.
const std::vector<int64_t> in_ticks = {0, 3, 4, 6, 7, 9, 10,
11, 13, 14, 15, 16, 232};
const std::vector<int> in_values = GetIntegersRange(in_ticks.size());
for (int tick : ticks) {
runner.TickAt(tick);
}
for (int i = 0; i < in_ticks.size(); ++i) {
runner.ProvideInput(in_ticks[i], in_values[i]);
}
MP_EXPECT_OK(runner.Run());
// Non of the in_ticks should be inserted:
EXPECT_THAT(runner.GetOutputTimestamps(), ContainerEq(ticks));
EXPECT_THAT(runner.GetOutputValues(),
AllOf(Each(kDefaultValue), SizeIs(ticks.size())));
// All (and only) ticks should get the default.
EXPECT_THAT(runner.GetFlagTimestamps(), ContainerEq(ticks));
}
TEST(ValueOrDefaultCalculatorTest, FlagValue) {
// Since we anyway suppose that the Flag is a bool - there is nothing
// interesting to check, but we should check once that the value is the right
// (true) one.
ValueOrDefaultRunner runner;
runner.TickAt(0);
MP_EXPECT_OK(runner.Run());
EXPECT_THAT(runner.GetFlagValues(), ElementsAre(true));
}
TEST(ValueOrDefaultCalculatorTest, FullTest) {
// Make sure that nothing gets wrong with an input that have both right and
// wrong timestamps, some defaults etc.
ValueOrDefaultRunner runner;
const std::vector<int64_t> ticks = {1, 2, 5, 8, 12, 33, 231};
const std::vector<int64_t> in_ticks = {0, 2, 4, 6, 8, 9, 12, 33, 54, 232};
const std::vector<int> in_values = GetIntegersRange(in_ticks.size());
for (int tick : ticks) {
runner.TickAt(tick);
}
for (int i = 0; i < in_ticks.size(); ++i) {
runner.ProvideInput(in_ticks[i], in_values[i]);
}
MP_EXPECT_OK(runner.Run());
EXPECT_THAT(runner.GetOutputTimestamps(), ContainerEq(ticks));
// Calculated by hand:
EXPECT_THAT(
runner.GetOutputValues(),
ElementsAre(kDefaultValue, 2, kDefaultValue, 5, 7, 8, kDefaultValue));
EXPECT_THAT(runner.GetFlagTimestamps(), ElementsAre(1, 5, 231));
EXPECT_THAT(runner.GetFlagValues(), AllOf(Each(true), SizeIs(3)));
}
} // namespace
} // namespace mediapipe

View File

@ -97,6 +97,7 @@ cc_library(
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:source_location",
"//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_check",
],
alwayslink = 1,
)
@ -125,6 +126,7 @@ cc_library(
"//mediapipe/framework/port:opencv_imgcodecs",
"//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_check",
],
alwayslink = 1,
)
@ -135,7 +137,6 @@ cc_library(
deps = [
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/formats:image_frame_opencv",
"//mediapipe/framework/port:opencv_imgcodecs",
"//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:status",
],
@ -152,11 +153,11 @@ cc_library(
"//mediapipe/framework/formats:image_format_cc_proto",
"//mediapipe/framework/formats:image_frame",
"//mediapipe/framework/formats:image_frame_opencv",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:opencv_core",
"//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:status",
"//mediapipe/framework/port:vector",
"@com_google_absl//absl/log:absl_log",
] + select({
"//mediapipe/gpu:disable_gpu": [],
"//conditions:default": [
@ -203,6 +204,7 @@ cc_library(
"//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:status",
"//mediapipe/framework/port:vector",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/strings",
] + select({
"//mediapipe/gpu:disable_gpu": [],
@ -262,9 +264,12 @@ cc_library(
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"//mediapipe/gpu:scale_mode_cc_proto",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
] + select({
"//mediapipe/gpu:disable_gpu": [],
"//conditions:default": [
"//mediapipe/gpu:gl_base_hdr",
"//mediapipe/gpu:gl_calculator_helper",
"//mediapipe/gpu:gl_quad_renderer",
"//mediapipe/gpu:gl_simple_shaders",
@ -274,6 +279,38 @@ cc_library(
alwayslink = 1,
)
cc_test(
name = "image_transformation_calculator_test",
srcs = ["image_transformation_calculator_test.cc"],
data = ["//mediapipe/calculators/image/testdata:test_images"],
tags = [
"desktop_only_test",
],
deps = [
":image_transformation_calculator",
"//mediapipe/framework:calculator_cc_proto",
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework:calculator_runner",
"//mediapipe/framework/deps:file_path",
"//mediapipe/framework/formats:image_format_cc_proto",
"//mediapipe/framework/formats:image_frame",
"//mediapipe/framework/formats:image_frame_opencv",
"//mediapipe/framework/port:gtest",
"//mediapipe/framework/port:opencv_imgcodecs",
"//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:parse_text_proto",
"//mediapipe/gpu:gpu_buffer_to_image_frame_calculator",
"//mediapipe/gpu:image_frame_to_gpu_buffer_calculator",
"//mediapipe/gpu:multi_pool",
"//third_party:opencv",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/strings",
"@com_google_googletest//:gtest_main",
],
)
cc_library(
name = "image_cropping_calculator",
srcs = ["image_cropping_calculator.cc"],
@ -301,6 +338,7 @@ cc_library(
"//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
] + select({
"//mediapipe/gpu:disable_gpu": [],
"//conditions:default": [
@ -317,6 +355,7 @@ cc_library(
cc_test(
name = "image_cropping_calculator_test",
srcs = ["image_cropping_calculator_test.cc"],
tags = ["not_run:arm"],
deps = [
":image_cropping_calculator",
":image_cropping_calculator_cc_proto",
@ -396,6 +435,7 @@ cc_library(
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/strings",
],
)
@ -420,6 +460,8 @@ cc_library(
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"//mediapipe/util:image_frame_util",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings",
"@libyuv",
],
@ -625,9 +667,9 @@ cc_library(
"//mediapipe/framework/formats:image",
"//mediapipe/framework/formats:image_format_cc_proto",
"//mediapipe/framework/formats:image_frame",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:status",
"//mediapipe/framework/port:vector",
"@com_google_absl//absl/log:absl_log",
] + select({
"//mediapipe/gpu:disable_gpu": [],
"//conditions:default": [
@ -650,6 +692,7 @@ cc_library(
cc_test(
name = "segmentation_smoothing_calculator_test",
srcs = ["segmentation_smoothing_calculator_test.cc"],
tags = ["not_run:arm"],
deps = [
":image_clone_calculator",
":image_clone_calculator_cc_proto",
@ -664,6 +707,7 @@ cc_test(
"//mediapipe/framework/port:opencv_imgcodecs",
"//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:parse_text_proto",
"@com_google_absl//absl/log:absl_log",
],
)
@ -686,6 +730,7 @@ cc_library(
"//mediapipe/gpu:gpu_buffer",
"//mediapipe/gpu:gpu_origin_cc_proto",
"//mediapipe/gpu:shader_util",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
@ -743,6 +788,7 @@ cc_library(
":affine_transformation_runner_gl",
"//mediapipe/gpu:gl_calculator_helper",
"//mediapipe/gpu:gpu_buffer",
"//mediapipe/gpu:gpu_service",
],
}) + select({
"//mediapipe/framework/port:disable_opencv": [],
@ -771,7 +817,10 @@ cc_test(
"//mediapipe/calculators/tensor:testdata/image_to_tensor/medium_sub_rect_with_rotation_border_zero_interp_cubic.png",
"//mediapipe/calculators/tensor:testdata/image_to_tensor/noop_except_range.png",
],
tags = ["desktop_only_test"],
tags = [
"desktop_only_test",
"not_run:arm",
],
deps = [
":affine_transformation",
":image_transformation_calculator",

View File

@ -20,6 +20,7 @@
#include "Eigen/Core"
#include "Eigen/Geometry"
#include "Eigen/LU"
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
@ -53,6 +54,10 @@ bool IsMatrixVerticalFlipNeeded(GpuOrigin::Mode gpu_origin) {
#endif // __APPLE__
case GpuOrigin::TOP_LEFT:
return false;
default:
ABSL_LOG(ERROR) << "Incorrect GpuOrigin: "
<< static_cast<int>(gpu_origin);
return true;
}
}
@ -218,7 +223,7 @@ class GlTextureWarpAffineRunner
absl::StrCat(mediapipe::kMediaPipeFragmentShaderPreamble,
interpolation_def, kFragShader);
ASSIGN_OR_RETURN(program_, create_fn(vert_src, frag_src));
MP_ASSIGN_OR_RETURN(program_, create_fn(vert_src, frag_src));
auto create_custom_zero_fn = [&]() -> absl::StatusOr<Program> {
std::string custom_zero_border_mode_def = R"(
@ -231,10 +236,10 @@ class GlTextureWarpAffineRunner
};
#if GL_CLAMP_TO_BORDER_MAY_BE_SUPPORTED
if (!IsGlClampToBorderSupported(gl_helper_->GetGlContext())) {
ASSIGN_OR_RETURN(program_custom_zero_, create_custom_zero_fn());
MP_ASSIGN_OR_RETURN(program_custom_zero_, create_custom_zero_fn());
}
#else
ASSIGN_OR_RETURN(program_custom_zero_, create_custom_zero_fn());
MP_ASSIGN_OR_RETURN(program_custom_zero_, create_custom_zero_fn());
#endif // GL_CLAMP_TO_BORDER_MAY_BE_SUPPORTED
glGenFramebuffers(1, &framebuffer_);
@ -384,6 +389,8 @@ class GlTextureWarpAffineRunner
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
glFlush();
return absl::OkStatus();
}

View File

@ -59,7 +59,7 @@ class OpenCvRunner
const ImageFrame& input, const std::array<float, 16>& matrix,
const AffineTransformation::Size& size,
AffineTransformation::BorderMode border_mode) override {
// OpenCV warpAffine works in absolute coordinates, so the transfom (which
// OpenCV warpAffine works in absolute coordinates, so the transform (which
// accepts and produces relative coordinates) should be adjusted to first
// normalize coordinates and then scale them.
// clang-format off

View File

@ -15,6 +15,7 @@
#include <memory>
#include <string>
#include "absl/log/absl_check.h"
#include "absl/strings/str_replace.h"
#include "mediapipe/calculators/image/bilateral_filter_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
@ -112,7 +113,7 @@ class BilateralFilterCalculator : public CalculatorBase {
REGISTER_CALCULATOR(BilateralFilterCalculator);
absl::Status BilateralFilterCalculator::GetContract(CalculatorContract* cc) {
CHECK_GE(cc->Inputs().NumEntries(), 1);
RET_CHECK_GE(cc->Inputs().NumEntries(), 1);
if (cc->Inputs().HasTag(kInputFrameTag) &&
cc->Inputs().HasTag(kInputFrameTagGpu)) {
@ -183,8 +184,8 @@ absl::Status BilateralFilterCalculator::Open(CalculatorContext* cc) {
sigma_color_ = options_.sigma_color();
sigma_space_ = options_.sigma_space();
CHECK_GE(sigma_color_, 0.0);
CHECK_GE(sigma_space_, 0.0);
ABSL_CHECK_GE(sigma_color_, 0.0);
ABSL_CHECK_GE(sigma_space_, 0.0);
if (!use_gpu_) sigma_color_ *= 255.0;
if (use_gpu_) {

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/log/absl_check.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/image_frame_opencv.h"
@ -25,8 +26,8 @@
namespace mediapipe {
namespace {
void SetColorChannel(int channel, uint8 value, cv::Mat* mat) {
CHECK(mat->depth() == CV_8U);
CHECK(channel < mat->channels());
ABSL_CHECK(mat->depth() == CV_8U);
ABSL_CHECK(channel < mat->channels());
const int step = mat->channels();
for (int r = 0; r < mat->rows; ++r) {
uint8* row_ptr = mat->ptr<uint8>(r);

View File

@ -64,7 +64,8 @@ class ImageCloneCalculator : public Node {
"GPU processing is disabled in build flags");
}
#else
MP_RETURN_IF_ERROR(mediapipe::GlCalculatorHelper::UpdateContract(cc));
MP_RETURN_IF_ERROR(mediapipe::GlCalculatorHelper::UpdateContract(
cc, /*request_gpu_as_optional=*/true));
#endif // MEDIAPIPE_DISABLE_GPU
return absl::OkStatus();
}
@ -72,9 +73,6 @@ class ImageCloneCalculator : public Node {
absl::Status Open(CalculatorContext* cc) override {
const auto& options = cc->Options<mediapipe::ImageCloneCalculatorOptions>();
output_on_gpu_ = options.output_on_gpu();
#if !MEDIAPIPE_DISABLE_GPU
MP_RETURN_IF_ERROR(gpu_helper_.Open(cc));
#endif // !MEDIAPIPE_DISABLE_GPU
return absl::OkStatus();
}
@ -104,6 +102,10 @@ class ImageCloneCalculator : public Node {
if (output_on_gpu_ && !input_on_gpu) {
#if !MEDIAPIPE_DISABLE_GPU
if (!gpu_initialized_) {
MP_RETURN_IF_ERROR(gpu_helper_.Open(cc));
gpu_initialized_ = true;
}
gpu_helper_.RunInGlContext([&output]() { output->ConvertToGpu(); });
#endif // !MEDIAPIPE_DISABLE_GPU
} else if (!output_on_gpu_ && input_on_gpu) {
@ -118,6 +120,7 @@ class ImageCloneCalculator : public Node {
bool output_on_gpu_;
#if !MEDIAPIPE_DISABLE_GPU
mediapipe::GlCalculatorHelper gpu_helper_;
bool gpu_initialized_ = false;
#endif // !MEDIAPIPE_DISABLE_GPU
};
MEDIAPIPE_REGISTER_NODE(ImageCloneCalculator);

View File

@ -16,6 +16,7 @@
#include <cmath>
#include "absl/log/absl_log.h"
#include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/image_frame_opencv.h"
#include "mediapipe/framework/formats/rect.pb.h"
@ -202,8 +203,9 @@ absl::Status ImageCroppingCalculator::ValidateBorderModeForGPU(
switch (options.border_mode()) {
case mediapipe::ImageCroppingCalculatorOptions::BORDER_ZERO:
LOG(WARNING) << "BORDER_ZERO mode is not supported by GPU "
<< "implementation and will fall back into BORDER_REPLICATE";
ABSL_LOG(WARNING)
<< "BORDER_ZERO mode is not supported by GPU "
<< "implementation and will fall back into BORDER_REPLICATE";
break;
case mediapipe::ImageCroppingCalculatorOptions::BORDER_REPLICATE:
break;

View File

@ -24,7 +24,7 @@ message ImageCroppingCalculatorOptions {
}
// Output texture buffer dimensions. The values defined in the options will be
// overriden by the WIDTH and HEIGHT input streams if they exist.
// overridden by the WIDTH and HEIGHT input streams if they exist.
optional int32 width = 1;
optional int32 height = 2;

View File

@ -77,7 +77,7 @@ absl::StatusOr<double> ComputeFocalLengthInPixels(int image_width,
return focal_length_pixels;
}
absl::StatusOr<ImageFileProperties> GetImageFileProperites(
absl::StatusOr<ImageFileProperties> GetImageFileProperties(
const std::string& image_bytes) {
easyexif::EXIFInfo result;
int code = result.parseFrom(image_bytes);
@ -92,11 +92,11 @@ absl::StatusOr<ImageFileProperties> GetImageFileProperites(
properties.set_focal_length_mm(result.FocalLength);
properties.set_focal_length_35mm(result.FocalLengthIn35mm);
ASSIGN_OR_RETURN(auto focal_length_pixels,
ComputeFocalLengthInPixels(properties.image_width(),
properties.image_height(),
properties.focal_length_35mm(),
properties.focal_length_mm()));
MP_ASSIGN_OR_RETURN(auto focal_length_pixels,
ComputeFocalLengthInPixels(properties.image_width(),
properties.image_height(),
properties.focal_length_35mm(),
properties.focal_length_mm()));
properties.set_focal_length_pixels(focal_length_pixels);
return properties;
@ -151,7 +151,7 @@ class ImageFilePropertiesCalculator : public CalculatorBase {
if (cc->InputSidePackets().NumEntries() == 1) {
const std::string& image_bytes =
cc->InputSidePackets().Index(0).Get<std::string>();
ASSIGN_OR_RETURN(properties_, GetImageFileProperites(image_bytes));
MP_ASSIGN_OR_RETURN(properties_, GetImageFileProperties(image_bytes));
read_properties_ = true;
}
@ -169,7 +169,7 @@ class ImageFilePropertiesCalculator : public CalculatorBase {
return absl::OkStatus();
}
const std::string& image_bytes = cc->Inputs().Index(0).Get<std::string>();
ASSIGN_OR_RETURN(properties_, GetImageFileProperites(image_bytes));
MP_ASSIGN_OR_RETURN(properties_, GetImageFileProperties(image_bytes));
read_properties_ = true;
}
if (read_properties_) {

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/status/status.h"
#include "mediapipe/calculators/image/image_transformation_calculator.pb.h"
#include "mediapipe/calculators/image/rotation_mode.pb.h"
#include "mediapipe/framework/calculator_framework.h"
@ -27,6 +28,7 @@
#include "mediapipe/gpu/scale_mode.pb.h"
#if !MEDIAPIPE_DISABLE_GPU
#include "mediapipe/gpu/gl_base.h"
#include "mediapipe/gpu/gl_calculator_helper.h"
#include "mediapipe/gpu/gl_quad_renderer.h"
#include "mediapipe/gpu/gl_simple_shaders.h"
@ -60,42 +62,42 @@ constexpr char kVideoPrestreamTag[] = "VIDEO_PRESTREAM";
int RotationModeToDegrees(mediapipe::RotationMode_Mode rotation) {
switch (rotation) {
case mediapipe::RotationMode_Mode_UNKNOWN:
case mediapipe::RotationMode_Mode_ROTATION_0:
case mediapipe::RotationMode::UNKNOWN:
case mediapipe::RotationMode::ROTATION_0:
return 0;
case mediapipe::RotationMode_Mode_ROTATION_90:
case mediapipe::RotationMode::ROTATION_90:
return 90;
case mediapipe::RotationMode_Mode_ROTATION_180:
case mediapipe::RotationMode::ROTATION_180:
return 180;
case mediapipe::RotationMode_Mode_ROTATION_270:
case mediapipe::RotationMode::ROTATION_270:
return 270;
}
}
mediapipe::RotationMode_Mode DegreesToRotationMode(int degrees) {
switch (degrees) {
case 0:
return mediapipe::RotationMode_Mode_ROTATION_0;
return mediapipe::RotationMode::ROTATION_0;
case 90:
return mediapipe::RotationMode_Mode_ROTATION_90;
return mediapipe::RotationMode::ROTATION_90;
case 180:
return mediapipe::RotationMode_Mode_ROTATION_180;
return mediapipe::RotationMode::ROTATION_180;
case 270:
return mediapipe::RotationMode_Mode_ROTATION_270;
return mediapipe::RotationMode::ROTATION_270;
default:
return mediapipe::RotationMode_Mode_UNKNOWN;
return mediapipe::RotationMode::UNKNOWN;
}
}
mediapipe::ScaleMode_Mode ParseScaleMode(
mediapipe::ScaleMode_Mode scale_mode,
mediapipe::ScaleMode_Mode default_mode) {
switch (scale_mode) {
case mediapipe::ScaleMode_Mode_DEFAULT:
case mediapipe::ScaleMode::DEFAULT:
return default_mode;
case mediapipe::ScaleMode_Mode_STRETCH:
case mediapipe::ScaleMode::STRETCH:
return scale_mode;
case mediapipe::ScaleMode_Mode_FIT:
case mediapipe::ScaleMode::FIT:
return scale_mode;
case mediapipe::ScaleMode_Mode_FILL_AND_CROP:
case mediapipe::ScaleMode::FILL_AND_CROP:
return scale_mode;
default:
return default_mode;
@ -208,6 +210,8 @@ class ImageTransformationCalculator : public CalculatorBase {
bool use_gpu_ = false;
cv::Scalar padding_color_;
ImageTransformationCalculatorOptions::InterpolationMode interpolation_mode_;
#if !MEDIAPIPE_DISABLE_GPU
GlCalculatorHelper gpu_helper_;
std::unique_ptr<QuadRenderer> rgb_renderer_;
@ -343,6 +347,11 @@ absl::Status ImageTransformationCalculator::Open(CalculatorContext* cc) {
options_.padding_color().green(),
options_.padding_color().blue());
interpolation_mode_ = options_.interpolation_mode();
if (options_.interpolation_mode() ==
ImageTransformationCalculatorOptions::DEFAULT) {
interpolation_mode_ = ImageTransformationCalculatorOptions::LINEAR;
}
if (use_gpu_) {
#if !MEDIAPIPE_DISABLE_GPU
// Let the helper access the GL context information.
@ -457,26 +466,48 @@ absl::Status ImageTransformationCalculator::RenderCpu(CalculatorContext* cc) {
ComputeOutputDimensions(input_width, input_height, &output_width,
&output_height);
int opencv_interpolation_mode = cv::INTER_LINEAR;
if (output_width_ > 0 && output_height_ > 0) {
cv::Mat scaled_mat;
if (scale_mode_ == mediapipe::ScaleMode_Mode_STRETCH) {
int scale_flag =
input_mat.cols > output_width_ && input_mat.rows > output_height_
? cv::INTER_AREA
: cv::INTER_LINEAR;
if (scale_mode_ == mediapipe::ScaleMode::STRETCH) {
if (interpolation_mode_ == ImageTransformationCalculatorOptions::LINEAR) {
// Use INTER_AREA for downscaling if interpolation mode is set to
// LINEAR.
if (input_mat.cols > output_width_ && input_mat.rows > output_height_) {
opencv_interpolation_mode = cv::INTER_AREA;
} else {
opencv_interpolation_mode = cv::INTER_LINEAR;
}
} else {
opencv_interpolation_mode = cv::INTER_NEAREST;
}
cv::resize(input_mat, scaled_mat, cv::Size(output_width_, output_height_),
0, 0, scale_flag);
0, 0, opencv_interpolation_mode);
} else {
const float scale =
std::min(static_cast<float>(output_width_) / input_width,
static_cast<float>(output_height_) / input_height);
const int target_width = std::round(input_width * scale);
const int target_height = std::round(input_height * scale);
int scale_flag = scale < 1.0f ? cv::INTER_AREA : cv::INTER_LINEAR;
if (scale_mode_ == mediapipe::ScaleMode_Mode_FIT) {
if (interpolation_mode_ == ImageTransformationCalculatorOptions::LINEAR) {
// Use INTER_AREA for downscaling if interpolation mode is set to
// LINEAR.
if (scale < 1.0f) {
opencv_interpolation_mode = cv::INTER_AREA;
} else {
opencv_interpolation_mode = cv::INTER_LINEAR;
}
} else {
opencv_interpolation_mode = cv::INTER_NEAREST;
}
if (scale_mode_ == mediapipe::ScaleMode::FIT) {
cv::Mat intermediate_mat;
cv::resize(input_mat, intermediate_mat,
cv::Size(target_width, target_height), 0, 0, scale_flag);
cv::Size(target_width, target_height), 0, 0,
opencv_interpolation_mode);
const int top = (output_height_ - target_height) / 2;
const int bottom = output_height_ - target_height - top;
const int left = (output_width_ - target_width) / 2;
@ -488,7 +519,7 @@ absl::Status ImageTransformationCalculator::RenderCpu(CalculatorContext* cc) {
padding_color_);
} else {
cv::resize(input_mat, scaled_mat, cv::Size(target_width, target_height),
0, 0, scale_flag);
0, 0, opencv_interpolation_mode);
output_width = target_width;
output_height = target_height;
}
@ -514,17 +545,17 @@ absl::Status ImageTransformationCalculator::RenderCpu(CalculatorContext* cc) {
cv::warpAffine(input_mat, rotated_mat, rotation_mat, rotated_size);
} else {
switch (rotation_) {
case mediapipe::RotationMode_Mode_UNKNOWN:
case mediapipe::RotationMode_Mode_ROTATION_0:
case mediapipe::RotationMode::UNKNOWN:
case mediapipe::RotationMode::ROTATION_0:
rotated_mat = input_mat;
break;
case mediapipe::RotationMode_Mode_ROTATION_90:
case mediapipe::RotationMode::ROTATION_90:
cv::rotate(input_mat, rotated_mat, cv::ROTATE_90_COUNTERCLOCKWISE);
break;
case mediapipe::RotationMode_Mode_ROTATION_180:
case mediapipe::RotationMode::ROTATION_180:
cv::rotate(input_mat, rotated_mat, cv::ROTATE_180);
break;
case mediapipe::RotationMode_Mode_ROTATION_270:
case mediapipe::RotationMode::ROTATION_270:
cv::rotate(input_mat, rotated_mat, cv::ROTATE_90_CLOCKWISE);
break;
}
@ -561,7 +592,7 @@ absl::Status ImageTransformationCalculator::RenderGpu(CalculatorContext* cc) {
ComputeOutputDimensions(input_width, input_height, &output_width,
&output_height);
if (scale_mode_ == mediapipe::ScaleMode_Mode_FILL_AND_CROP) {
if (scale_mode_ == mediapipe::ScaleMode::FILL_AND_CROP) {
const float scale =
std::min(static_cast<float>(output_width_) / input_width,
static_cast<float>(output_height_) / input_height);
@ -625,9 +656,24 @@ absl::Status ImageTransformationCalculator::RenderGpu(CalculatorContext* cc) {
input.format());
gpu_helper_.BindFramebuffer(dst);
if (scale_mode_ == mediapipe::ScaleMode::FIT) {
// In kFit scale mode, the rendered quad does not fill the whole
// framebuffer, so clear it beforehand.
glClearColor(padding_color_[0] / 255.0f, padding_color_[1] / 255.0f,
padding_color_[2] / 255.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
}
glActiveTexture(GL_TEXTURE1);
glBindTexture(src1.target(), src1.name());
if (interpolation_mode_ == ImageTransformationCalculatorOptions::NEAREST) {
// TODO: revert texture params.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
MP_RETURN_IF_ERROR(renderer->GlRender(
src1.width(), src1.height(), dst.width(), dst.height(), scale_mode,
rotation, flip_horizontally_, flip_vertically_,
@ -652,8 +698,8 @@ void ImageTransformationCalculator::ComputeOutputDimensions(
if (output_width_ > 0 && output_height_ > 0) {
*output_width = output_width_;
*output_height = output_height_;
} else if (rotation_ == mediapipe::RotationMode_Mode_ROTATION_90 ||
rotation_ == mediapipe::RotationMode_Mode_ROTATION_270) {
} else if (rotation_ == mediapipe::RotationMode::ROTATION_90 ||
rotation_ == mediapipe::RotationMode::ROTATION_270) {
*output_width = input_height;
*output_height = input_width;
} else {
@ -666,9 +712,9 @@ void ImageTransformationCalculator::ComputeOutputLetterboxPadding(
int input_width, int input_height, int output_width, int output_height,
std::array<float, 4>* padding) {
padding->fill(0.f);
if (scale_mode_ == mediapipe::ScaleMode_Mode_FIT) {
if (rotation_ == mediapipe::RotationMode_Mode_ROTATION_90 ||
rotation_ == mediapipe::RotationMode_Mode_ROTATION_270) {
if (scale_mode_ == mediapipe::ScaleMode::FIT) {
if (rotation_ == mediapipe::RotationMode::ROTATION_90 ||
rotation_ == mediapipe::RotationMode::ROTATION_270) {
std::swap(input_width, input_height);
}
const float input_aspect_ratio =

View File

@ -46,12 +46,24 @@ message ImageTransformationCalculatorOptions {
optional bool flip_horizontally = 5 [default = false];
// Scale mode.
optional ScaleMode.Mode scale_mode = 6;
// Padding type. This option is only used when the scale mode is FIT.
// Default is to use BORDER_CONSTANT. If set to false, it will use
// BORDER_REPLICATE instead.
// Padding type. This option is only used when the scale mode is FIT. If set
// to true (default), a constant border is added with color specified by
// padding_color. If set to false, a border is added by replicating edge
// pixels (only supported for CPU).
optional bool constant_padding = 7 [default = true];
// The color for the padding. This option is only used when the scale mode is
// FIT. Default is black. This is for CPU only.
// FIT. Default is black.
optional Color padding_color = 8;
// Interpolation method to use. Note that on CPU when LINEAR is specified,
// INTER_LINEAR is used for upscaling and INTER_AREA is used for downscaling.
enum InterpolationMode {
DEFAULT = 0;
LINEAR = 1;
NEAREST = 2;
}
// Mode DEFAULT will use LINEAR interpolation.
optional InterpolationMode interpolation_mode = 9;
}

View File

@ -0,0 +1,430 @@
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include "absl/container/flat_hash_set.h"
#include "absl/flags/flag.h"
#include "absl/log/absl_check.h"
#include "absl/strings/substitute.h"
#include "mediapipe/framework/calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/calculator_runner.h"
#include "mediapipe/framework/deps/file_path.h"
#include "mediapipe/framework/formats/image_format.pb.h"
#include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/image_frame_opencv.h"
#include "mediapipe/framework/port/gtest.h"
#include "mediapipe/framework/port/opencv_imgcodecs_inc.h"
#include "mediapipe/framework/port/opencv_imgproc_inc.h"
#include "mediapipe/framework/port/parse_text_proto.h"
#include "mediapipe/gpu/multi_pool.h"
#include "testing/base/public/gmock.h"
#include "testing/base/public/googletest.h"
#include "testing/base/public/gunit.h"
#include "third_party/OpenCV/core.hpp" // IWYU pragma: keep
#include "third_party/OpenCV/core/base.hpp"
#include "third_party/OpenCV/core/mat.hpp"
#include "third_party/OpenCV/core/types.hpp"
namespace mediapipe {
namespace {
absl::flat_hash_set<int> computeUniqueValues(const cv::Mat& mat) {
// Compute the unique values in cv::Mat
absl::flat_hash_set<int> unique_values;
for (int i = 0; i < mat.rows; i++) {
for (int j = 0; j < mat.cols; j++) {
unique_values.insert(mat.at<unsigned char>(i, j));
}
}
return unique_values;
}
TEST(ImageTransformationCalculatorTest, NearestNeighborResizing) {
cv::Mat input_mat;
cv::cvtColor(cv::imread(file::JoinPath("./",
"/mediapipe/calculators/"
"image/testdata/binary_mask.png")),
input_mat, cv::COLOR_BGR2GRAY);
Packet input_image_packet = MakePacket<ImageFrame>(
ImageFormat::GRAY8, input_mat.size().width, input_mat.size().height);
input_mat.copyTo(formats::MatView(&(input_image_packet.Get<ImageFrame>())));
std::vector<std::pair<int, int>> output_dims{
{256, 333}, {512, 512}, {1024, 1024}};
for (auto& output_dim : output_dims) {
Packet input_output_dim_packet =
MakePacket<std::pair<int, int>>(output_dim);
std::vector<std::string> scale_modes{"FIT", "STRETCH"};
for (const auto& scale_mode : scale_modes) {
CalculatorGraphConfig::Node node_config =
ParseTextProtoOrDie<CalculatorGraphConfig::Node>(
absl::Substitute(R"(
calculator: "ImageTransformationCalculator"
input_stream: "IMAGE:input_image"
input_stream: "OUTPUT_DIMENSIONS:image_size"
output_stream: "IMAGE:output_image"
options: {
[mediapipe.ImageTransformationCalculatorOptions.ext]: {
scale_mode: $0
interpolation_mode: NEAREST
}
})",
scale_mode));
CalculatorRunner runner(node_config);
runner.MutableInputs()->Tag("IMAGE").packets.push_back(
input_image_packet.At(Timestamp(0)));
runner.MutableInputs()
->Tag("OUTPUT_DIMENSIONS")
.packets.push_back(input_output_dim_packet.At(Timestamp(0)));
ABSL_QCHECK_OK(runner.Run());
const auto& outputs = runner.Outputs();
ABSL_QCHECK_EQ(outputs.NumEntries(), 1);
const std::vector<Packet>& packets = outputs.Tag("IMAGE").packets;
ABSL_QCHECK_EQ(packets.size(), 1);
const auto& result = packets[0].Get<ImageFrame>();
ASSERT_EQ(output_dim.first, result.Width());
ASSERT_EQ(output_dim.second, result.Height());
auto unique_input_values = computeUniqueValues(input_mat);
auto unique_output_values =
computeUniqueValues(formats::MatView(&result));
EXPECT_THAT(unique_input_values,
::testing::ContainerEq(unique_output_values));
}
}
}
TEST(ImageTransformationCalculatorTest,
NearestNeighborResizingWorksForFloatInput) {
cv::Mat input_mat;
cv::cvtColor(cv::imread(file::JoinPath("./",
"/mediapipe/calculators/"
"image/testdata/binary_mask.png")),
input_mat, cv::COLOR_BGR2GRAY);
Packet input_image_packet = MakePacket<ImageFrame>(
ImageFormat::VEC32F1, input_mat.size().width, input_mat.size().height);
cv::Mat packet_mat_view =
formats::MatView(&(input_image_packet.Get<ImageFrame>()));
input_mat.convertTo(packet_mat_view, CV_32FC1, 1 / 255.f);
std::vector<std::pair<int, int>> output_dims{
{256, 333}, {512, 512}, {1024, 1024}};
for (auto& output_dim : output_dims) {
Packet input_output_dim_packet =
MakePacket<std::pair<int, int>>(output_dim);
std::vector<std::string> scale_modes{"FIT", "STRETCH"};
for (const auto& scale_mode : scale_modes) {
CalculatorGraphConfig::Node node_config =
ParseTextProtoOrDie<CalculatorGraphConfig::Node>(
absl::Substitute(R"(
calculator: "ImageTransformationCalculator"
input_stream: "IMAGE:input_image"
input_stream: "OUTPUT_DIMENSIONS:image_size"
output_stream: "IMAGE:output_image"
options: {
[mediapipe.ImageTransformationCalculatorOptions.ext]: {
scale_mode: $0
interpolation_mode: NEAREST
}
})",
scale_mode));
CalculatorRunner runner(node_config);
runner.MutableInputs()->Tag("IMAGE").packets.push_back(
input_image_packet.At(Timestamp(0)));
runner.MutableInputs()
->Tag("OUTPUT_DIMENSIONS")
.packets.push_back(input_output_dim_packet.At(Timestamp(0)));
ABSL_QCHECK_OK(runner.Run());
const auto& outputs = runner.Outputs();
ABSL_QCHECK_EQ(outputs.NumEntries(), 1);
const std::vector<Packet>& packets = outputs.Tag("IMAGE").packets;
ABSL_QCHECK_EQ(packets.size(), 1);
const auto& result = packets[0].Get<ImageFrame>();
ASSERT_EQ(output_dim.first, result.Width());
ASSERT_EQ(output_dim.second, result.Height());
auto unique_input_values = computeUniqueValues(packet_mat_view);
auto unique_output_values =
computeUniqueValues(formats::MatView(&result));
EXPECT_THAT(unique_input_values,
::testing::ContainerEq(unique_output_values));
}
}
}
TEST(ImageTransformationCalculatorTest, NearestNeighborResizingGpu) {
cv::Mat input_mat;
cv::cvtColor(cv::imread(file::JoinPath("./",
"/mediapipe/calculators/"
"image/testdata/binary_mask.png")),
input_mat, cv::COLOR_BGR2RGBA);
std::vector<std::pair<int, int>> output_dims{
{256, 333}, {512, 512}, {1024, 1024}};
for (auto& output_dim : output_dims) {
std::vector<std::string> scale_modes{"FIT"}; //, "STRETCH"};
for (const auto& scale_mode : scale_modes) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
absl::Substitute(R"(
input_stream: "input_image"
input_stream: "image_size"
output_stream: "output_image"
node {
calculator: "ImageFrameToGpuBufferCalculator"
input_stream: "input_image"
output_stream: "input_image_gpu"
}
node {
calculator: "ImageTransformationCalculator"
input_stream: "IMAGE_GPU:input_image_gpu"
input_stream: "OUTPUT_DIMENSIONS:image_size"
output_stream: "IMAGE_GPU:output_image_gpu"
options: {
[mediapipe.ImageTransformationCalculatorOptions.ext]: {
scale_mode: $0
interpolation_mode: NEAREST
}
}
}
node {
calculator: "GpuBufferToImageFrameCalculator"
input_stream: "output_image_gpu"
output_stream: "output_image"
})",
scale_mode));
ImageFrame input_image(ImageFormat::SRGBA, input_mat.size().width,
input_mat.size().height);
input_mat.copyTo(formats::MatView(&input_image));
std::vector<Packet> output_image_packets;
tool::AddVectorSink("output_image", &graph_config, &output_image_packets);
CalculatorGraph graph(graph_config);
ABSL_QCHECK_OK(graph.StartRun({}));
ABSL_QCHECK_OK(graph.AddPacketToInputStream(
"input_image",
MakePacket<ImageFrame>(std::move(input_image)).At(Timestamp(0))));
ABSL_QCHECK_OK(graph.AddPacketToInputStream(
"image_size",
MakePacket<std::pair<int, int>>(output_dim).At(Timestamp(0))));
ABSL_QCHECK_OK(graph.WaitUntilIdle());
ABSL_QCHECK_EQ(output_image_packets.size(), 1);
const auto& output_image = output_image_packets[0].Get<ImageFrame>();
ASSERT_EQ(output_dim.first, output_image.Width());
ASSERT_EQ(output_dim.second, output_image.Height());
auto unique_input_values = computeUniqueValues(input_mat);
auto unique_output_values =
computeUniqueValues(formats::MatView(&output_image));
EXPECT_THAT(unique_input_values,
::testing::ContainerEq(unique_output_values));
}
}
}
TEST(ImageTransformationCalculatorTest,
NearestNeighborResizingWorksForFloatTexture) {
cv::Mat input_mat;
cv::cvtColor(cv::imread(file::JoinPath("./",
"/mediapipe/calculators/"
"image/testdata/binary_mask.png")),
input_mat, cv::COLOR_BGR2GRAY);
Packet input_image_packet = MakePacket<ImageFrame>(
ImageFormat::VEC32F1, input_mat.size().width, input_mat.size().height);
cv::Mat packet_mat_view =
formats::MatView(&(input_image_packet.Get<ImageFrame>()));
input_mat.convertTo(packet_mat_view, CV_32FC1, 1 / 255.f);
std::vector<std::pair<int, int>> output_dims{
{256, 333}, {512, 512}, {1024, 1024}};
for (auto& output_dim : output_dims) {
std::vector<std::string> scale_modes{"FIT"}; //, "STRETCH"};
for (const auto& scale_mode : scale_modes) {
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(
absl::Substitute(R"(
input_stream: "input_image"
input_stream: "image_size"
output_stream: "output_image"
node {
calculator: "ImageFrameToGpuBufferCalculator"
input_stream: "input_image"
output_stream: "input_image_gpu"
}
node {
calculator: "ImageTransformationCalculator"
input_stream: "IMAGE_GPU:input_image_gpu"
input_stream: "OUTPUT_DIMENSIONS:image_size"
output_stream: "IMAGE_GPU:output_image_gpu"
options: {
[mediapipe.ImageTransformationCalculatorOptions.ext]: {
scale_mode: $0
interpolation_mode: NEAREST
}
}
}
node {
calculator: "GpuBufferToImageFrameCalculator"
input_stream: "output_image_gpu"
output_stream: "output_image"
})",
scale_mode));
std::vector<Packet> output_image_packets;
tool::AddVectorSink("output_image", &graph_config, &output_image_packets);
CalculatorGraph graph(graph_config);
ABSL_QCHECK_OK(graph.StartRun({}));
ABSL_QCHECK_OK(graph.AddPacketToInputStream(
"input_image", input_image_packet.At(Timestamp(0))));
ABSL_QCHECK_OK(graph.AddPacketToInputStream(
"image_size",
MakePacket<std::pair<int, int>>(output_dim).At(Timestamp(0))));
ABSL_QCHECK_OK(graph.WaitUntilIdle());
ABSL_QCHECK_EQ(output_image_packets.size(), 1);
const auto& output_image = output_image_packets[0].Get<ImageFrame>();
ASSERT_EQ(output_dim.first, output_image.Width());
ASSERT_EQ(output_dim.second, output_image.Height());
auto unique_input_values = computeUniqueValues(packet_mat_view);
auto unique_output_values =
computeUniqueValues(formats::MatView(&output_image));
EXPECT_THAT(unique_input_values,
::testing::ContainerEq(unique_output_values));
}
}
}
TEST(ImageTransformationCalculatorTest, FitScalingClearsBackground) {
// Regression test for not clearing the background in FIT scaling mode.
// First scale an all-red (=r) image from 8x4 to 8x4, so it's a plain copy:
// rrrrrrrr
// rrrrrrrr
// rrrrrrrr
// rrrrrrrr
// Then scale an all-blue image from 4x4 to 8x4 in FIT mode. This should
// introduce dark yellow (=y) letterboxes left and right due to padding_color:
// yybbbbyy
// yybbbbyy
// yybbbbyy
// yybbbbyy
// We make sure that the all-red buffer gets reused. Without clearing the
// background, the blue (=b) image will have red letterboxes:
// rrbbbbrr
// rrbbbbrr
// rrbbbbrr
// rrbbbbrr
constexpr int kSmall = 4, kLarge = 8;
ImageFrame input_image_red(ImageFormat::SRGBA, kLarge, kSmall);
cv::Mat input_image_red_mat = formats::MatView(&input_image_red);
input_image_red_mat = cv::Scalar(255, 0, 0, 255);
ImageFrame input_image_blue(ImageFormat::SRGBA, kSmall, kSmall);
cv::Mat input_image_blue_mat = formats::MatView(&input_image_blue);
input_image_blue_mat = cv::Scalar(0, 0, 255, 255);
Packet input_image_red_packet =
MakePacket<ImageFrame>(std::move(input_image_red));
Packet input_image_blue_packet =
MakePacket<ImageFrame>(std::move(input_image_blue));
CalculatorGraphConfig graph_config =
ParseTextProtoOrDie<CalculatorGraphConfig>(absl::Substitute(
R"pb(
input_stream: "input_image"
output_stream: "output_image"
node {
calculator: "ImageFrameToGpuBufferCalculator"
input_stream: "input_image"
output_stream: "input_image_gpu"
}
node {
calculator: "ImageTransformationCalculator"
input_stream: "IMAGE_GPU:input_image_gpu"
output_stream: "IMAGE_GPU:output_image_gpu"
options: {
[mediapipe.ImageTransformationCalculatorOptions.ext]: {
scale_mode: FIT
output_width: $0,
output_height: $1,
padding_color: { red: 128, green: 128, blue: 0 }
}
}
}
node {
calculator: "GpuBufferToImageFrameCalculator"
input_stream: "output_image_gpu"
output_stream: "output_image"
})pb",
kLarge, kSmall));
std::vector<Packet> output_image_packets;
tool::AddVectorSink("output_image", &graph_config, &output_image_packets);
CalculatorGraph graph(graph_config);
ABSL_QCHECK_OK(graph.StartRun({}));
// Send the red image multiple times to cause the GPU pool to actually use
// a pool.
int num_red_packets =
std::max(kDefaultMultiPoolOptions.min_requests_before_pool, 1);
for (int n = 0; n < num_red_packets; ++n) {
ABSL_QCHECK_OK(graph.AddPacketToInputStream(
"input_image", input_image_red_packet.At(Timestamp(n))));
}
ABSL_QCHECK_OK(graph.AddPacketToInputStream(
"input_image", input_image_blue_packet.At(Timestamp(num_red_packets))));
ABSL_QCHECK_OK(graph.WaitUntilIdle());
ABSL_QCHECK_EQ(output_image_packets.size(), num_red_packets + 1);
const auto& output_image_red = output_image_packets[0].Get<ImageFrame>();
const auto& output_image_blue =
output_image_packets[num_red_packets].Get<ImageFrame>();
ABSL_QCHECK_EQ(output_image_red.Width(), kLarge);
ABSL_QCHECK_EQ(output_image_red.Height(), kSmall);
ABSL_QCHECK_EQ(output_image_blue.Width(), kLarge);
ABSL_QCHECK_EQ(output_image_blue.Height(), kSmall);
cv::Mat output_image_blue_mat = formats::MatView(&output_image_blue);
ImageFrame expected_image_blue(ImageFormat::SRGBA, kLarge, kSmall);
cv::Mat expected_image_blue_mat = formats::MatView(&expected_image_blue);
expected_image_blue_mat = cv::Scalar(128, 128, 0, 255);
cv::Rect rect((kLarge - kSmall) / 2, 0, kSmall, kSmall);
cv::rectangle(expected_image_blue_mat, rect, cv::Scalar(0, 0, 255, 255),
cv::FILLED);
EXPECT_EQ(cv::sum(cv::sum(output_image_blue_mat != expected_image_blue_mat)),
cv::Scalar(0));
}
} // namespace
} // namespace mediapipe

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/log/absl_check.h"
#include "mediapipe/calculators/image/opencv_image_encoder_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/image_frame_opencv.h"
@ -61,7 +62,7 @@ absl::Status OpenCvImageEncoderCalculator::Open(CalculatorContext* cc) {
absl::Status OpenCvImageEncoderCalculator::Process(CalculatorContext* cc) {
const ImageFrame& image_frame = cc->Inputs().Index(0).Get<ImageFrame>();
CHECK_EQ(1, image_frame.ByteDepth());
ABSL_CHECK_EQ(1, image_frame.ByteDepth());
std::unique_ptr<OpenCvImageEncoderCalculatorResults> encoded_result =
absl::make_unique<OpenCvImageEncoderCalculatorResults>();

Some files were not shown because too many files have changed in this diff Show More