Compare commits

...
Author SHA1 Message Date
MediaPipe TeamandCopybara-Service 64af919107 Internal change
PiperOrigin-RevId: 531007009
2023-05-10 14:38:19 -07:00
Sebastian SchmidtandCopybara-Service 1666f3ed80 Add .close() method to ImageSegmenterResult/InteractiveSegmenterResult/PoseLandmarkerResult
PiperOrigin-RevId: 530973944
2023-05-10 12:37:48 -07:00
Mark McDonaldandCopybara-Service a7ede9235c Internal change
PiperOrigin-RevId: 530806084
2023-05-09 22:34:07 -07:00
MediaPipe TeamandCopybara-Service ea1643f7f8 Internal update
PiperOrigin-RevId: 530777692
2023-05-09 19:47:43 -07:00
MediaPipe TeamandCopybara-Service f824424700 When returning multiple output streams together, keep them alive until callback.
PiperOrigin-RevId: 530771884
2023-05-09 19:00:00 -07:00
MediaPipe TeamandCopybara-Service 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 Teamandjqtang f95a782399 Internal change
PiperOrigin-RevId: 530751565
2023-05-09 17:03:20 -07:00
MediaPipe TeamandCopybara-Service 6ff39c418c Internal change
PiperOrigin-RevId: 530751097
2023-05-09 17:01:45 -07:00
MediaPipe TeamandCopybara-Service dd1779840d Update model_maker requirements.txt for release
PiperOrigin-RevId: 530748415
2023-05-09 16:49:41 -07:00
Sebastian SchmidtandGitHub a469f0151b Merge pull request #4386 from priankakariatyml/ios-cocoapods-opencv-fixes
Removed opencv framework from MPPVisionTaskRunner dependendencies
2023-05-09 17:08:32 -06:00
MediaPipe TeamandCopybara-Service 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 SchmidtandCopybara-Service bea5eb766d Move Java Connections arrays to Task class
PiperOrigin-RevId: 530719994
2023-05-09 14:52:33 -07:00
Sebastian SchmidtandCopybara-Service 6f3c80ae8a Prevent property mangling for options types
PiperOrigin-RevId: 530707361
2023-05-09 14:05:05 -07:00
Jiuqiang TangandCopybara-Service 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 TeamandCopybara-Service 08d19739e0 Allow passing --resource_root_dir to resolve asset lookups.
PiperOrigin-RevId: 530618235
2023-05-09 08:40:11 -07:00
MediaPipe TeamandCopybara-Service 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 TeamandCopybara-Service 10776ef86f Added error message if no provisioning profile found
PiperOrigin-RevId: 530498369
2023-05-08 22:20:19 -07:00
Sebastian SchmidtandCopybara-Service 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 #4380 from priankakariatyml:ios-cocoapods-fixes
PiperOrigin-RevId: 530409793
2023-05-08 14:35:09 -07:00
MediaPipe TeamandCopybara-Service 83a8743a8b Internal change
PiperOrigin-RevId: 530408554
2023-05-08 14:31:04 -07:00
MediaPipe TeamandCopybara-Service b40f0d3b72 Internal change
PiperOrigin-RevId: 530385895
2023-05-08 13:04:51 -07:00
Sebastian SchmidtandCopybara-Service ae8bedd352 Inline constants for FaceLandmarksConnections
PiperOrigin-RevId: 530384171
2023-05-08 12:58:18 -07:00
Sebastian SchmidtandCopybara-Service e3c2f31ddf Update WASM files for Alpha 14
PiperOrigin-RevId: 530341569
2023-05-08 10:31:46 -07:00
Shuang LiuandCopybara-Service 0c75c76623 Fix a typo.
PiperOrigin-RevId: 530339315
2023-05-08 10:24:29 -07:00
Copybara-Service 1360977730 Merge pull request #4373 from priankakariatyml:ios-object-detector-async-fixes
PiperOrigin-RevId: 530233608
2023-05-08 01:14:01 -07:00
MediaPipe TeamandCopybara-Service 613f645c74 Update CalculatorOptions to encourage proto3 options
PiperOrigin-RevId: 530127533
2023-05-07 11:25:43 -07:00
MediaPipe TeamandCopybara-Service 876987b389 Remove auxiliary landmarks in PoseLandmarker API results.
PiperOrigin-RevId: 529989746
2023-05-06 12:58:00 -07:00
Sebastian SchmidtandCopybara-Service ddb84702f6 Simplify MPMask by removing the Type Enums from the public API
PiperOrigin-RevId: 529975377
2023-05-06 10:26:13 -07:00
Sebastian SchmidtandCopybara-Service 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 SchmidtandCopybara-Service 8a6fe90759 Remove single-channel types from MPImage
PiperOrigin-RevId: 529956549
2023-05-06 07:04:14 -07:00
MediaPipe TeamandCopybara-Service 800a7b4a27 Object detector handle empty packet when no object is detected.
PiperOrigin-RevId: 529919638
2023-05-06 01:11:01 -07:00
MediaPipe TeamandCopybara-Service 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 SchmidtandCopybara-Service fb7f06b509 Remove error check that canvas must be defined
PiperOrigin-RevId: 529906685
2023-05-05 23:22:40 -07:00
Sebastian SchmidtandCopybara-Service 6aad5742c3 Internal
PiperOrigin-RevId: 529890599
2023-05-05 21:51:51 -07:00
Sebastian SchmidtandCopybara-Service 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 TeamandCopybara-Service 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 SchmidtandCopybara-Service 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 #4355 from priankakariatyml:ios-opencv-build-from-source
PiperOrigin-RevId: 529800547
2023-05-05 13:34:46 -07:00
Sebastian SchmidtandCopybara-Service f065910559 Create non-callback APIs for APIs that return callbacks.
PiperOrigin-RevId: 529799515
2023-05-05 13:30:36 -07:00
MediaPipe TeamandCopybara-Service ecc8dca8ba Internal change
PiperOrigin-RevId: 529752098
2023-05-05 10:28:38 -07:00
MediaPipe TeamandCopybara-Service c24e7a250c Internal change
PiperOrigin-RevId: 529617578
2023-05-04 23:01:32 -07:00
Sebastian SchmidtandCopybara-Service 18d893c697 Add scribble support to InteractiveSegmenter Web API
PiperOrigin-RevId: 529594131
2023-05-04 20:44:26 -07:00
MediaPipe TeamandCopybara-Service 61cfe2ca9b Object Detector remove nms operation from exported tflite
PiperOrigin-RevId: 529559380
2023-05-04 17:36:11 -07:00
MediaPipe Teamandjqtang 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
MediaPipe TeamandCopybara-Service 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 SchmidtandCopybara-Service 767db32d69 Support multiple poses for PoseLandmarker
PiperOrigin-RevId: 529430797
2023-05-04 09:29:12 -07:00
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 8ec0724b65 Updated documentation to include note about rgba images 2023-05-04 19:44:11 +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
Jiuqiang TangandCopybara-Service c6e3f08282 Expose FaceAligner and LanguageDetector to be public MediaPipe Tasks Python API.
PiperOrigin-RevId: 529227382
2023-05-03 16:38:49 -07:00
MediaPipe TeamandCopybara-Service 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 #4325 from kinaryml:language-detector-python
PiperOrigin-RevId: 529213966
2023-05-03 15:50:42 -07:00
MediaPipe TeamandCopybara-Service a09e39d431 Add TransformerParameters proto
PiperOrigin-RevId: 529213840
2023-05-03 15:46:50 -07:00
Yuqi LiandCopybara-Service e428bdb7e8 internal change.
PiperOrigin-RevId: 529181374
2023-05-03 13:37:16 -07:00
MediaPipe TeamandCopybara-Service 606b83ac65 Internal change
PiperOrigin-RevId: 529180655
2023-05-03 13:32:44 -07:00
MediaPipe TeamandCopybara-Service 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 #4361 from kinaryml:face-aligner-python
PiperOrigin-RevId: 529165597
2023-05-03 12:39:23 -07:00
MediaPipe TeamandCopybara-Service c780559214 Internal change
PiperOrigin-RevId: 529161249
2023-05-03 12:20:44 -07:00
MediaPipe TeamandCopybara-Service 09662749ea Support scribble input for Interactive Segmenter
PiperOrigin-RevId: 529156049
2023-05-03 12:01:10 -07:00
MediaPipe TeamandCopybara-Service baa8fc68a1 Make uploading to GPU optional in Image.GetGpuBuffer().
PiperOrigin-RevId: 529066617
2023-05-03 05:57:58 -07:00
MediaPipe TeamandCopybara-Service 3789156a41 Internal change
PiperOrigin-RevId: 529011480
2023-05-03 00:29:13 -07:00
MediaPipe TeamandCopybara-Service 1dea01aecc Internal change
PiperOrigin-RevId: 528996603
2023-05-02 22:57:38 -07:00
MediaPipe TeamandCopybara-Service c698381e48 Internal change
PiperOrigin-RevId: 528939095
2023-05-02 18:05:31 -07:00
Jiuqiang TangandCopybara-Service bf11fb313e Expose PoseLandmarker as a public MediaPipe Tasks Python API.
PiperOrigin-RevId: 528882303
2023-05-02 14:04:01 -07:00
Jiuqiang TangandCopybara-Service 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 LiandCopybara-Service 9ce16fddeb nit: format the documentation of LandmarksDetectionResult.
PiperOrigin-RevId: 528848566
2023-05-02 11:56:47 -07:00
MediaPipe TeamandCopybara-Service 421c9e8e97 Fix typo
PiperOrigin-RevId: 528829423
2023-05-02 10:51:47 -07:00
MediaPipe TeamandCopybara-Service 4d112c132f Fix msan errors.
PiperOrigin-RevId: 528825081
2023-05-02 10:37:50 -07:00
Jiuqiang TangandCopybara-Service 60055f6fee Add more comments and usage example of the face stylizer graph.
PiperOrigin-RevId: 528823127
2023-05-02 10:32:43 -07:00
MediaPipe TeamandCopybara-Service 7fdbbee5be Internal change
PiperOrigin-RevId: 528799585
2023-05-02 09:07:29 -07:00
MediaPipe TeamandCopybara-Service 5b93477589 internal change
PiperOrigin-RevId: 528719459
2023-05-02 02:17:18 -07:00
Chuo-Ling ChangandCopybara-Service 3719aaef7e Fix typo.
PiperOrigin-RevId: 528693117
2023-05-01 23:52:45 -07:00
MediaPipe TeamandCopybara-Service 0a8be0d09d Internal change
PiperOrigin-RevId: 528632873
2023-05-01 18:40:33 -07:00
Jiuqiang TangandCopybara-Service fca728d226 Set face alignment image width and hight to 256.
PiperOrigin-RevId: 528583074
2023-05-01 15:01:39 -07:00
Jiuqiang TangandCopybara-Service 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 TeamandCopybara-Service 5526e96b21 Internal change for proto library outputs.
PiperOrigin-RevId: 528539840
2023-05-01 12:17:29 -07:00
Yuqi LiandCopybara-Service 085f8265fb Internal change
PiperOrigin-RevId: 528517562
2023-05-01 11:01:23 -07:00
Kinar RandGitHub 544e4b66f7 Merge branch 'google:master' into face-aligner-python 2023-05-01 22:56:00 +05:30
MediaPipe TeamandCopybara-Service cab619f8da Fix typo in README
PiperOrigin-RevId: 528506206
2023-05-01 10:25:05 -07:00
Jiuqiang TangandCopybara-Service 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 TeamandCopybara-Service 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 TeamandCopybara-Service 80b19fff4b Internal Change
PiperOrigin-RevId: 528399911
2023-04-30 23:10:21 -07:00
Jiuqiang TangandCopybara-Service c29e43dda0 Add the "FACE_ALIGNMENT" output stream to the face stylizer graph.
PiperOrigin-RevId: 528345204
2023-04-30 16:59:36 -07:00
MediaPipe TeamandCopybara-Service c450283715 Add a filegroup for referencing model.
PiperOrigin-RevId: 528251316
2023-04-30 01:19:19 -07:00
Sebastian SchmidtandCopybara-Service 8e510a3255 Invoke PoseListener callback while C++ Packet is still active
PiperOrigin-RevId: 528061429
2023-04-28 21:22:02 -07:00
Sebastian SchmidtandCopybara-Service 253f13ad62 Invoke callback for InteractiveSegmenter while C++ Packets are active
PiperOrigin-RevId: 528053621
2023-04-28 20:34:17 -07:00
Sebastian SchmidtandCopybara-Service d5c5457d25 Only log warnings once if color conversion is not specified
PiperOrigin-RevId: 528052009
2023-04-28 20:24:17 -07:00
Sebastian SchmidtandCopybara-Service a9721ae2fb Invoke callback for ImageSegmenter while C++ Packets are active
PiperOrigin-RevId: 528047220
2023-04-28 20:01:10 -07:00
Sebastian SchmidtandCopybara-Service e15add2475 Shorten MPImage API
PiperOrigin-RevId: 528039371
2023-04-28 19:00:17 -07:00
Esha UbowejaandCopybara-Service 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 SchmidtandCopybara-Service 874cc9dea3 Update PoseLandmarker to return MPImage
PiperOrigin-RevId: 528022223
2023-04-28 17:13:07 -07:00
Sebastian SchmidtandCopybara-Service dcef6df1cb Update InteractiveSegmenter to return MPImage
PiperOrigin-RevId: 528010944
2023-04-28 16:13:51 -07:00
Copybara-Service bbbc0f98c5 Merge pull request #4268 from priankakariatyml:object-detector-objc-tests
PiperOrigin-RevId: 527991967
2023-04-28 14:52:20 -07:00
Sebastian SchmidtandCopybara-Service 2c1d9c6582 Update ImageSegmenter to return MPImage
PiperOrigin-RevId: 527990991
2023-04-28 14:48:30 -07:00
Sebastian SchmidtandCopybara-Service a544098100 Update FaceStylizer to return MPImage
PiperOrigin-RevId: 527980696
2023-04-28 14:05:11 -07:00
Copybara-Service 5cffb3973f Merge pull request #4303 from kinaryml:pose-landmarker-python
PiperOrigin-RevId: 527948047
2023-04-28 11:59:28 -07:00
Copybara-Service 2bb1b454ea Merge pull request #4300 from priankakariatyml:ios-text-cocoapods-force-load
PiperOrigin-RevId: 527932547
2023-04-28 11:06:44 -07:00
MediaPipe TeamandCopybara-Service 3dce259bf6 Internal change
PiperOrigin-RevId: 527931585
2023-04-28 11:02:26 -07:00
MediaPipe TeamandCopybara-Service b2fbb2ddab Internal change
PiperOrigin-RevId: 527909361
2023-04-28 09:43:56 -07:00
MediaPipe TeamandCopybara-Service 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 RandGitHub 76c8251faf Merge branch 'google:master' into language-detector-python 2023-04-28 09:28:54 +05:30
Sebastian SchmidtandCopybara-Service 5d9761cbfd Update tests and demos to call "close".
PiperOrigin-RevId: 527746909
2023-04-27 18:58:57 -07:00
Sebastian SchmidtandCopybara-Service 28b9b8d8a3 Open-sources LanguageDetector model.
PiperOrigin-RevId: 527745108
2023-04-27 18:47:07 -07:00
Sebastian SchmidtandCopybara-Service 5e41d47f3a Add "close()" method to MP Web Tasks
PiperOrigin-RevId: 527726737
2023-04-27 17:16:40 -07:00
Sebastian SchmidtandCopybara-Service 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 SchmidtandCopybara-Service 4e1270c18f Internal
PiperOrigin-RevId: 527680530
2023-04-27 14:14:54 -07:00
MediaPipe TeamandCopybara-Service 212f110c65 Add nose in facemesh drawing
PiperOrigin-RevId: 527644154
2023-04-27 12:00:37 -07:00
MediaPipe TeamandCopybara-Service 3ca2427cc8 Blendshapes graph take smoothed face landmarks as input.
PiperOrigin-RevId: 527640341
2023-04-27 11:46:40 -07:00
MediaPipe TeamandCopybara-Service 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 #4269 from shmishra99:master
PiperOrigin-RevId: 527634460
2023-04-27 11:27:15 -07:00
Sebastian SchmidtandCopybara-Service 1b82821f15 Add support for single-channel images to MPImage
PiperOrigin-RevId: 527629970
2023-04-27 11:12:34 -07:00
Sebastian SchmidtandCopybara-Service a5852b0513 Internal change
PiperOrigin-RevId: 527623223
2023-04-27 10:50:36 -07:00
Copybara-Service cd47080057 Merge pull request #4351 from kuaashish:master
PiperOrigin-RevId: 527619288
2023-04-27 10:37:23 -07:00
Sebastian SchmidtandCopybara-Service d5157a039e Add .github workspace import
PiperOrigin-RevId: 527617546
2023-04-27 10:31:44 -07:00
Sebastian SchmidtandCopybara-Service b457060c3a Generify tests for MPImage
PiperOrigin-RevId: 527611864
2023-04-27 10:12:30 -07:00
Sebastian SchmidtandCopybara-Service bc3434108e Update MPImage to use containers
PiperOrigin-RevId: 527596164
2023-04-27 09:18:05 -07:00
Jiuqiang TangandCopybara-Service 7c70c62465 Fix typo and improve comments.
PiperOrigin-RevId: 527580369
2023-04-27 08:10:29 -07:00
MediaPipe TeamandCopybara-Service 7b055df211 Internal change
PiperOrigin-RevId: 527473249
2023-04-26 22:14:32 -07:00
MediaPipe TeamandCopybara-Service 2122b5d7be Internal change
PiperOrigin-RevId: 527430483
2023-04-26 18:17:56 -07:00
MediaPipe TeamandCopybara-Service 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 TeamandCopybara-Service baed44ab10 Internal change
PiperOrigin-RevId: 527416263
2023-04-26 17:12:34 -07:00
MediaPipe TeamandCopybara-Service 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 TeamandCopybara-Service c44cc30ece DetectionPostProcessingGraph for post processing raw tensors from detection models.
PiperOrigin-RevId: 527363291
2023-04-26 13:44:54 -07:00
MediaPipe TeamandCopybara-Service 48aa88f39d Change object detector learning rate decay to cosine decay.
PiperOrigin-RevId: 527337105
2023-04-26 12:13:17 -07:00
kuaashishandGitHub 6f97203562 Rename 18-other-issues.md to 19-other-issues.md 2023-04-26 16:38:23 +05:30
kuaashishandGitHub 5f505b09e3 Rename 17-solution-legacy-issue-template.yaml to 18-solution-legacy-issue-template.yaml 2023-04-26 16:38:05 +05:30
kuaashishandGitHub 275eb31a8f Rename 16-documentation-issue-template.yaml to 17-documentation-issue-template.yaml 2023-04-26 16:37:44 +05:30
kuaashishandGitHub f9d14157ff Rename 15-bug-issue-template.yaml to 16-bug-issue-template.yaml 2023-04-26 16:37:28 +05:30
kuaashishandGitHub 9c8fe490d4 Rename 14-build-install-issue-template.yaml to 15-build-install-issue-template.yaml 2023-04-26 16:36:58 +05:30
kuaashishandGitHub f36f2c64b5 Rename 16-feature-request-issue-template.yaml to 14-feature-request-issue-template.yaml 2023-04-26 16:36:33 +05:30
kuaashishandGitHub d6b4067319 Rename 15-feature-request-issue-template.yaml to 16-feature-request-issue-template.yaml 2023-04-26 16:35:44 +05:30
kuaashishandGitHub 7d6ccb2dd1 Rename 14-feature-request-issue-template.yaml to 15-feature-request-issue-template.yaml 2023-04-26 16:35:16 +05:30
kuaashishandGitHub 728cb26644 Rename 13-feature-request-issue-template.yaml to 14-feature-request-issue-template.yaml 2023-04-26 16:34:48 +05:30
kuaashishandGitHub 4046b97416 Rename 50-other-issues.md to 18-other-issues.md 2023-04-26 16:32:41 +05:30
kuaashishandGitHub 00f355e301 Rename Solution(Legacy_issue_template).yaml to 17-solution-legacy-issue-template.yaml 2023-04-26 16:32:06 +05:30
kuaashishandGitHub a002e24080 Rename Documentation_issue_template.yaml to 16-documentation-issue-template.yaml 2023-04-26 16:31:16 +05:30
kuaashishandGitHub d15701a5e0 Rename bug_issue_template.yaml to 15-bug-issue-template.yaml 2023-04-26 16:30:46 +05:30
kuaashishandGitHub a99b0d6b9c Rename build.install_issue_template.yaml to 14-build-install-issue-template.yaml 2023-04-26 16:30:23 +05:30
kuaashishandGitHub badccdd87b Rename feature_request_issue_template.yaml to 13-feature-request-issue-template.yaml 2023-04-26 16:29:49 +05:30
kuaashishandGitHub 2d69c48e39 Rename studio_issue_template.yaml to 12-studio-issue-template.yaml 2023-04-26 16:27:12 +05:30
kuaashishandGitHub 17bee87b27 Rename model_maker_issue_template.yaml to 11-model-maker-issue-template.yaml 2023-04-26 16:26:39 +05:30
kuaashishandGitHub db2592a04d Rename task_issue_template.yaml to 00-task-issue-template.yaml 2023-04-26 16:24:20 +05:30
MediaPipe TeamandCopybara-Service 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 TeamandCopybara-Service 17f5b95387 Internal change.
PiperOrigin-RevId: 527010360
2023-04-25 10:41:52 -07:00
Sebastian SchmidtandCopybara-Service 9e30b00685 Invoke the FaceStylizer callback even if no faces are detected
PiperOrigin-RevId: 527008261
2023-04-25 10:35:12 -07:00
Jiuqiang TangandCopybara-Service 3bc8276678 Remove "All Rights Reserved." in copyright headers.
PiperOrigin-RevId: 526982992
2023-04-25 09:06:29 -07:00
MediaPipe TeamandCopybara-Service 0fc6118680 Internal change.
PiperOrigin-RevId: 526892368
2023-04-25 01:30:43 -07:00
MediaPipe TeamandCopybara-Service 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 TangandCopybara-Service a0eb1b696c Internal changes.
PiperOrigin-RevId: 526759809
2023-04-24 14:45:35 -07:00
MediaPipe TeamandCopybara-Service 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 TeamandCopybara-Service ceb911ae06 Add nullable annotation to AudioDataProducer#setAudioConsumer
PiperOrigin-RevId: 526697945
2023-04-24 11:10:07 -07:00
Sebastian SchmidtandCopybara-Service 61854dc6a3 Create Pose Detector Web API
PiperOrigin-RevId: 526672533
2023-04-24 09:53:05 -07:00
Jiuqiang TangandCopybara-Service 6773188e26 Make FaceLandmarksConnections to be a public class.
PiperOrigin-RevId: 526667505
2023-04-24 09:34:14 -07:00
Sebastian SchmidtandCopybara-Service 35cf8c35f2 Internal change
PiperOrigin-RevId: 526658482
2023-04-24 09:01:55 -07:00
MediaPipe TeamandCopybara-Service abded49e5b Internal change
PiperOrigin-RevId: 526300079
2023-04-22 10:52:14 -07:00
MediaPipe TeamandCopybara-Service a6c1bb6324 Internal change
PiperOrigin-RevId: 526235882
2023-04-22 00:28:52 -07:00
MediaPipe TeamandCopybara-Service 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 TeamandCopybara-Service a6c35e9ba5 Fixes the typos in tasks internal files.
PiperOrigin-RevId: 526063515
2023-04-21 09:46:39 -07:00
Sebastian SchmidtandCopybara-Service 9be748db00 Create MPImage type for Web
PiperOrigin-RevId: 525873209
2023-04-20 16:01:04 -07:00
Sebastian SchmidtandCopybara-Service e9bb849503 Fix Typo
PiperOrigin-RevId: 525861968
2023-04-20 15:15:13 -07:00
MediaPipe TeamandCopybara-Service bd73617e5c Internal change
PiperOrigin-RevId: 525854969
2023-04-20 14:47:17 -07:00
MediaPipe TeamandCopybara-Service 02bdb9aba0 Internal change
PiperOrigin-RevId: 525845988
2023-04-20 14:14:58 -07:00
MediaPipe TeamandCopybara-Service 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 TeamandCopybara-Service d4c7ad0411 Internal change
PiperOrigin-RevId: 525775875
2023-04-20 10:00:01 -07:00
MediaPipe TeamandCopybara-Service a89ec882b0 Internal change
PiperOrigin-RevId: 525774601
2023-04-20 09:55:35 -07:00
Kinar RandGitHub 9032bce577 Update copyright 2023-04-20 13:21:56 +05:30
Kinar RandGitHub 21ddba0d60 Update copyright 2023-04-20 13:21:31 +05:30
MediaPipe TeamandCopybara-Service 331692577e Internal change
PiperOrigin-RevId: 525660743
2023-04-19 23:47:59 -07:00
Copybara-Service 44aa607e06 Merge pull request #4302 from kinaryml:segmenter-python-add-labels
PiperOrigin-RevId: 525571089
2023-04-19 15:46:20 -07:00
Sebastian SchmidtandCopybara-Service ffbd799b8d Extract shared types to create and test landmarks
PiperOrigin-RevId: 525568412
2023-04-19 15:37:42 -07:00
MediaPipe TeamandCopybara-Service 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 TeamandCopybara-Service 5bd3282515 Internal change
PiperOrigin-RevId: 525513792
2023-04-19 12:05:44 -07:00
MediaPipe TeamandCopybara-Service 3231591f7f draw right eye with blue color
PiperOrigin-RevId: 525508840
2023-04-19 11:47:38 -07:00
MediaPipe TeamandCopybara-Service b2586e7e3b Internal change
PiperOrigin-RevId: 525495248
2023-04-19 11:01:13 -07:00
MediaPipe TeamandCopybara-Service eb62479190 Internal change
PiperOrigin-RevId: 525487344
2023-04-19 10:35:49 -07:00
Bekzhan BekbolatulyandCopybara-Service 9818ebb630 Internal change
PiperOrigin-RevId: 525476655
2023-04-19 09:58:22 -07:00
MediaPipe TeamandCopybara-Service 0aea6d90a8 Internal change
PiperOrigin-RevId: 525407296
2023-04-19 04:10:02 -07:00
MediaPipe TeamandCopybara-Service 01f4439d83 Internal change
PiperOrigin-RevId: 525399975
2023-04-19 03:33:01 -07:00
MediaPipe TeamandCopybara-Service de84696be6 Internal change
PiperOrigin-RevId: 525390694
2023-04-19 02:39:54 -07:00
MediaPipe TeamandCopybara-Service b83fa5b67d Internal change
PiperOrigin-RevId: 525365673
2023-04-19 00:17:50 -07:00
MediaPipe TeamandCopybara-Service 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 RandGitHub 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 RandGitHub d621df8046 Merge branch 'google:master' into segmenter-python-add-labels 2023-04-19 09:51:42 +05:30
Sebastian SchmidtandCopybara-Service 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 #4280 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 TeamandCopybara-Service 64d1e74c20 Internal MediaPipe Tasks change
PiperOrigin-RevId: 525182282
2023-04-18 10:20:03 -07:00
MediaPipe TeamandCopybara-Service 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 TeamandCopybara-Service 88a10de345 Internal change
PiperOrigin-RevId: 525084368
2023-04-18 02:15:02 -07:00
MediaPipe TeamandCopybara-Service b4e27c137e Internal change
PiperOrigin-RevId: 525069421
2023-04-18 00:54:16 -07:00
MediaPipe TeamandCopybara-Service 63cd09951d Internal change
PiperOrigin-RevId: 525030969
2023-04-17 21:17:08 -07:00
MediaPipe TeamandCopybara-Service 43fd744296 Internal Changes
PiperOrigin-RevId: 524997017
2023-04-17 17:43:40 -07:00
Sebastian SchmidtandCopybara-Service 47e55fcf2f Add HAND_CONNECTIONS to HandLandmarker and GestureRecognizer
PiperOrigin-RevId: 524951052
2023-04-17 14:31:40 -07:00
MediaPipe TeamandCopybara-Service 2564fec44c Internal MediaPipe Tasks change.
PiperOrigin-RevId: 524942203
2023-04-17 14:09:14 -07:00
Sebastian SchmidtandCopybara-Service b147002b7e Support new output format for InteractiveSegmenter
PiperOrigin-RevId: 524940992
2023-04-17 14:04:56 -07:00
MediaPipe TeamandCopybara-Service 48cc96cf3c Internal change
PiperOrigin-RevId: 524517985
2023-04-15 06:18:05 -07:00
MediaPipe TeamandCopybara-Service 547d3c00a7 Internal change
PiperOrigin-RevId: 524496413
2023-04-15 02:34:17 -07:00
MediaPipe TeamandCopybara-Service b63a0e15a3 Internal change
PiperOrigin-RevId: 524485761
2023-04-15 01:00:05 -07:00
MediaPipe TeamandCopybara-Service 1c3a061038 Internal change
PiperOrigin-RevId: 524481964
2023-04-15 00:24:46 -07:00
MediaPipe TeamandCopybara-Service 5fc0d26d8d Internal change
PiperOrigin-RevId: 524457848
2023-04-14 21:33:14 -07:00
Copybara-Service cd4ae32a10 Merge pull request #4288 from google:pr4279
PiperOrigin-RevId: 524443045
2023-04-14 19:54:49 -07:00
MediaPipe TeamandCopybara-Service 411ffaeb43 Update Java interactive segmenter to output both confidence masks and category mask optionally.
PiperOrigin-RevId: 524442070
2023-04-14 19:45:27 -07:00
Jiuqiang TangandCopybara-Service e14a88052a Remove resizing and rotation from face stylizer's postprocessing step.
The resizing and rotation logic is useful when the pipeline needs to paste the stylized face image back to the original image. To only output the stylized face image, resizing and rotation may result to strange outputs.

PiperOrigin-RevId: 524441372
2023-04-14 19:37:52 -07:00
Copybara-Service 8b3395edfb Merge pull request #4283 from priankakariatyml:ios-timestamp-renaming
PiperOrigin-RevId: 524420908
2023-04-14 17:13:17 -07:00
MediaPipe TeamandCopybara-Service e1643a5abb Fix in preparation for Emscripten updates
PiperOrigin-RevId: 524414804
2023-04-14 16:40:34 -07:00
Jiuqiang TangandCopybara-Service 67ed42d9c6 Always link the "pose_landmarks_detector_graph" target.
PiperOrigin-RevId: 524397174
2023-04-14 15:14:20 -07:00
Sebastian SchmidtandCopybara-Service d3903f885a Update Flatbuffers to 23.1.21
PiperOrigin-RevId: 524391723
2023-04-14 14:50:38 -07:00
kinaryml 5f5ce22020 Added the PoseLandmarker Python API and a simple test 2023-04-14 14:09:15 -07:00
MediaPipe TeamandCopybara-Service abd6574c6d Internal MediaPipe Tasks change.
PiperOrigin-RevId: 524377097
2023-04-14 13:49:31 -07:00
Sebastian SchmidtandCopybara-Service 92f45c98d8 Support new output format for ImageSegmenter
PiperOrigin-RevId: 524371021
2023-04-14 13:25:10 -07:00
MediaPipe TeamandCopybara-Service f5197a3adc Expose get_graph_config function for task_runner.
PiperOrigin-RevId: 524365682
2023-04-14 13:03:32 -07:00
MediaPipe TeamandCopybara-Service dbeb5a8126 Add Pose Landmarker Java API
PiperOrigin-RevId: 524359521
2023-04-14 12:36:37 -07:00
Sebastian SchmidtandCopybara-Service 3f1fc6f520 Add model links to NPM Readme
PiperOrigin-RevId: 524353352
2023-04-14 12:15:28 -07:00
MediaPipe TeamandCopybara-Service 77d1761c7f Added CoreAudio and MediaToolbox to BUILD file
PiperOrigin-RevId: 524352900
2023-04-14 12:10:59 -07:00
Bekzhan BekbolatulyandCopybara-Service 54d208aa5c Internal change
PiperOrigin-RevId: 524345939
2023-04-14 11:44:36 -07:00
MediaPipe TeamandCopybara-Service 257fa01b68 Internal MediaPipe Tasks change.
PiperOrigin-RevId: 524345005
2023-04-14 11:40:18 -07:00
MediaPipe TeamandCopybara-Service 27038f534a Internal change.
PiperOrigin-RevId: 524336899
2023-04-14 11:11:07 -07:00
Jiuqiang TangandCopybara-Service 534da98ccb Internal changes
PiperOrigin-RevId: 524334347
2023-04-14 11:01:53 -07:00
MediaPipe TeamandCopybara-Service dfc604f500 Patch for FileLocator and asset scripts not working together
PiperOrigin-RevId: 524320143
2023-04-14 10:11:24 -07:00
Jiuqiang TangandCopybara-Service e6bb9e29c0 Internal change
PiperOrigin-RevId: 524317439
2023-04-14 10:01:01 -07:00
Bekzhan BekbolatulyandCopybara-Service 89e6b824ae Update TF version to 2023-04-12
PiperOrigin-RevId: 524301262
2023-04-14 08:49:05 -07:00
MediaPipe TeamandCopybara-Service 6da95183bc Internal change
PiperOrigin-RevId: 524259260
2023-04-14 04:48:00 -07:00
MediaPipe TeamandCopybara-Service 1fd0f9328e Internal change
PiperOrigin-RevId: 524249794
2023-04-14 03:50:01 -07:00
MediaPipe TeamandCopybara-Service 215465bee0 Internal change
PiperOrigin-RevId: 524229420
2023-04-14 01:50:30 -07:00
MediaPipe TeamandCopybara-Service 06bbd9c599 Internal change
PiperOrigin-RevId: 524212873
2023-04-14 00:09:30 -07:00
Prianka Liz Kariat 7b1b94416a Updated timestamp variable name 2023-04-14 12:13:46 +05:30
MediaPipe TeamandCopybara-Service f934b220b2 Internal change
PiperOrigin-RevId: 524202659
2023-04-13 23:01:20 -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
MediaPipe TeamandCopybara-Service 18ef79ac9f add face renderer for adapter
PiperOrigin-RevId: 524148938
2023-04-13 17:41:19 -07:00
Sebastian Schmidt 17f2d0e1e5 Add Face Landmarks Connection constants for the Python API 2023-04-13 14:19:10 -06:00
kinaryml a03fa448dc Explicitly state the modes in the tests for ImageSegmenterOptions and InteractiveSegmenterOptions 2023-04-13 11:55:37 -07:00
Prianka Liz Kariat 2c154e20cc Updated all references of timestampMs to timestampInMilliseconds 2023-04-13 17:56:09 +05:30
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
1136 changed files with 42553 additions and 5171 deletions
+3
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
-34
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.
+66
View File
@@ -0,0 +1,66 @@
# 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: false
# 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"
+91 -104
View File
@@ -4,8 +4,6 @@ title: Home
nav_order: 1
---
![MediaPipe](https://mediapipe.dev/images/mediapipe_small.png)
----
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
@@ -14,86 +12,111 @@ 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)
<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>
**Attention**: MediaPipe Solutions Preview is an early release. [Learn
more](https://developers.google.com/mediapipe/solutions/about#notice).
--------------------------------------------------------------------------------
**On-device machine learning for everyone**
## Live ML anywhere
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.
[MediaPipe](https://google.github.io/mediapipe/) offers cross-platform, customizable
ML solutions for live and streaming media.
* [See demos](https://goo.gle/mediapipe-studio)
* [Learn more](https://developers.google.com/mediapipe/solutions)
![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*
## Get started
----
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).
## ML solutions in MediaPipe
## Solutions
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)
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.
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)
These libraries and resources provide the core functionality for each MediaPipe
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. -->
* **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.
[]() | [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) | | | ✅ | | |
These tools let you customize and evaluate solutions:
See also
[MediaPipe Models and Model Cards](https://google.github.io/mediapipe/solutions/models)
for ML models released in MediaPipe.
* **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).
## Getting started
### Legacy solutions
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).
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 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).
For more on the legacy solutions, see the [documentation](https://github.com/google/mediapipe/tree/master/docs/solutions).
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).
## Framework
## Publications
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.
[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 +125,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 +154,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.
+29 -3
View File
@@ -239,6 +239,16 @@ http_archive(
repo_mapping = {"@com_google_glog" : "@com_github_glog_glog_no_gflags"},
)
http_archive(
name = "darts_clone",
build_file = "@//third_party:darts_clone.BUILD",
sha256 = "c97f55d05c98da6fcaf7f9ecc6a6dc6bc5b18b8564465f77abff8879d446491c",
strip_prefix = "darts-clone-e40ce4627526985a7767444b6ed6893ab6ff8983",
urls = [
"https://github.com/s-yata/darts-clone/archive/e40ce4627526985a7767444b6ed6893ab6ff8983.zip",
],
)
http_archive(
name = "org_tensorflow_text",
sha256 = "f64647276f7288d1b1fe4c89581d51404d0ce4ae97f2bcc4c19bd667549adca8",
@@ -365,6 +375,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",
@@ -458,9 +484,9 @@ http_archive(
)
# TensorFlow repo should always go after the other external dependencies.
# TF on 2023-03-08.
_TENSORFLOW_GIT_COMMIT = "24f7ee636d62e1f8d8330357f8bbd65956dfb84d"
_TENSORFLOW_SHA256 = "7f8a96dd99215c0cdc77230d3dbce43e60102b64a89203ad04aa09b0a187a4bd"
# TF on 2023-04-12.
_TENSORFLOW_GIT_COMMIT = "d712c0c9e24519cc8cd3720279666720d1000eee"
_TENSORFLOW_SHA256 = "ba98de6ea5f720071246691a1536ecd5e1b1763033e8c82a1e721a06d3dfd4c1"
http_archive(
name = "org_tensorflow",
urls = [
+13 -2
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',
+1 -1
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.
+1 -1
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.
+91 -104
View File
@@ -4,8 +4,6 @@ title: Home
nav_order: 1
---
![MediaPipe](https://mediapipe.dev/images/mediapipe_small.png)
----
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
@@ -14,86 +12,111 @@ 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)
<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>
**Attention**: MediaPipe Solutions Preview is an early release. [Learn
more](https://developers.google.com/mediapipe/solutions/about#notice).
--------------------------------------------------------------------------------
**On-device machine learning for everyone**
## Live ML anywhere
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.
[MediaPipe](https://google.github.io/mediapipe/) offers cross-platform, customizable
ML solutions for live and streaming media.
* [See demos](https://goo.gle/mediapipe-studio)
* [Learn more](https://developers.google.com/mediapipe/solutions)
![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*
## Get started
----
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).
## ML solutions in MediaPipe
## Solutions
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)
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.
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)
These libraries and resources provide the core functionality for each MediaPipe
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. -->
* **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.
[]() | [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) | | | ✅ | | |
These tools let you customize and evaluate solutions:
See also
[MediaPipe Models and Model Cards](https://google.github.io/mediapipe/solutions/models)
for ML models released in MediaPipe.
* **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).
## Getting started
### Legacy solutions
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).
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 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).
For more on the legacy solutions, see the [documentation](https://github.com/google/mediapipe/tree/master/docs/solutions).
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).
## Framework
## Publications
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.
[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 +125,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 +154,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.
+1
View File
@@ -141,6 +141,7 @@ config_setting(
"ios_armv7",
"ios_arm64",
"ios_arm64e",
"ios_sim_arm64",
]
]
@@ -433,9 +433,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,
@@ -78,7 +78,7 @@ class ConstantSidePacketCalculator : public CalculatorBase {
} else if (packet_options.has_string_value()) {
packet.Set<std::string>();
} else if (packet_options.has_uint64_value()) {
packet.Set<uint64>();
packet.Set<uint64_t>();
} else if (packet_options.has_classification_list_value()) {
packet.Set<ClassificationList>();
} else if (packet_options.has_landmark_list_value()) {
@@ -112,7 +112,7 @@ class ConstantSidePacketCalculator : public CalculatorBase {
} else if (packet_options.has_string_value()) {
packet.Set(MakePacket<std::string>(packet_options.string_value()));
} else if (packet_options.has_uint64_value()) {
packet.Set(MakePacket<uint64>(packet_options.uint64_value()));
packet.Set(MakePacket<uint64_t>(packet_options.uint64_value()));
} else if (packet_options.has_classification_list_value()) {
packet.Set(MakePacket<ClassificationList>(
packet_options.classification_list_value()));
@@ -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.
//
+16 -15
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;
@@ -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];
}
@@ -35,14 +35,14 @@ class GateCalculatorTest : public ::testing::Test {
}
// Use this when ALLOW/DISALLOW input is provided as a side packet.
void RunTimeStep(int64 timestamp, bool stream_payload) {
void RunTimeStep(int64_t timestamp, bool stream_payload) {
runner_->MutableInputs()->Get("", 0).packets.push_back(
MakePacket<bool>(stream_payload).At(Timestamp(timestamp)));
MP_ASSERT_OK(runner_->Run()) << "Calculator execution failed.";
}
// Use this when ALLOW/DISALLOW input is provided as an input stream.
void RunTimeStep(int64 timestamp, const std::string& control_tag,
void RunTimeStep(int64_t timestamp, const std::string& control_tag,
bool control) {
runner_->MutableInputs()->Get("", 0).packets.push_back(
MakePacket<bool>(true).At(Timestamp(timestamp)));
@@ -134,9 +134,9 @@ TEST_F(GateCalculatorTest, AllowByALLOWOptionToTrue) {
}
)");
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, true);
constexpr int64 kTimestampValue1 = 43;
constexpr int64_t kTimestampValue1 = 43;
RunTimeStep(kTimestampValue1, false);
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
@@ -159,9 +159,9 @@ TEST_F(GateCalculatorTest, DisallowByALLOWOptionSetToFalse) {
}
)");
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, true);
constexpr int64 kTimestampValue1 = 43;
constexpr int64_t kTimestampValue1 = 43;
RunTimeStep(kTimestampValue1, false);
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
@@ -175,9 +175,9 @@ TEST_F(GateCalculatorTest, DisallowByALLOWOptionNotSet) {
output_stream: "test_output"
)");
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, true);
constexpr int64 kTimestampValue1 = 43;
constexpr int64_t kTimestampValue1 = 43;
RunTimeStep(kTimestampValue1, false);
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
@@ -193,9 +193,9 @@ TEST_F(GateCalculatorTest, AllowByALLOWSidePacketSetToTrue) {
)");
runner()->MutableSidePackets()->Tag(kAllowTag) = Adopt(new bool(true));
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, true);
constexpr int64 kTimestampValue1 = 43;
constexpr int64_t kTimestampValue1 = 43;
RunTimeStep(kTimestampValue1, false);
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
@@ -215,9 +215,9 @@ TEST_F(GateCalculatorTest, AllowByDisallowSidePacketSetToFalse) {
)");
runner()->MutableSidePackets()->Tag(kDisallowTag) = Adopt(new bool(false));
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, true);
constexpr int64 kTimestampValue1 = 43;
constexpr int64_t kTimestampValue1 = 43;
RunTimeStep(kTimestampValue1, false);
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
@@ -237,9 +237,9 @@ TEST_F(GateCalculatorTest, DisallowByALLOWSidePacketSetToFalse) {
)");
runner()->MutableSidePackets()->Tag(kAllowTag) = Adopt(new bool(false));
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, true);
constexpr int64 kTimestampValue1 = 43;
constexpr int64_t kTimestampValue1 = 43;
RunTimeStep(kTimestampValue1, false);
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
@@ -255,9 +255,9 @@ TEST_F(GateCalculatorTest, DisallowByDISALLOWSidePacketSetToTrue) {
)");
runner()->MutableSidePackets()->Tag(kDisallowTag) = Adopt(new bool(true));
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, true);
constexpr int64 kTimestampValue1 = 43;
constexpr int64_t kTimestampValue1 = 43;
RunTimeStep(kTimestampValue1, false);
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
@@ -272,13 +272,13 @@ TEST_F(GateCalculatorTest, Allow) {
output_stream: "test_output"
)");
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, "ALLOW", true);
constexpr int64 kTimestampValue1 = 43;
constexpr int64_t kTimestampValue1 = 43;
RunTimeStep(kTimestampValue1, "ALLOW", false);
constexpr int64 kTimestampValue2 = 44;
constexpr int64_t kTimestampValue2 = 44;
RunTimeStep(kTimestampValue2, "ALLOW", true);
constexpr int64 kTimestampValue3 = 45;
constexpr int64_t kTimestampValue3 = 45;
RunTimeStep(kTimestampValue3, "ALLOW", false);
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
@@ -297,13 +297,13 @@ TEST_F(GateCalculatorTest, Disallow) {
output_stream: "test_output"
)");
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, "DISALLOW", true);
constexpr int64 kTimestampValue1 = 43;
constexpr int64_t kTimestampValue1 = 43;
RunTimeStep(kTimestampValue1, "DISALLOW", false);
constexpr int64 kTimestampValue2 = 44;
constexpr int64_t kTimestampValue2 = 44;
RunTimeStep(kTimestampValue2, "DISALLOW", true);
constexpr int64 kTimestampValue3 = 45;
constexpr int64_t kTimestampValue3 = 45;
RunTimeStep(kTimestampValue3, "DISALLOW", false);
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
@@ -323,13 +323,13 @@ TEST_F(GateCalculatorTest, AllowWithStateChange) {
output_stream: "STATE_CHANGE:state_changed"
)");
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, "ALLOW", false);
constexpr int64 kTimestampValue1 = 43;
constexpr int64_t kTimestampValue1 = 43;
RunTimeStep(kTimestampValue1, "ALLOW", true);
constexpr int64 kTimestampValue2 = 44;
constexpr int64_t kTimestampValue2 = 44;
RunTimeStep(kTimestampValue2, "ALLOW", true);
constexpr int64 kTimestampValue3 = 45;
constexpr int64_t kTimestampValue3 = 45;
RunTimeStep(kTimestampValue3, "ALLOW", false);
const std::vector<Packet>& output =
@@ -379,13 +379,13 @@ TEST_F(GateCalculatorTest, DisallowWithStateChange) {
output_stream: "STATE_CHANGE:state_changed"
)");
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, "DISALLOW", true);
constexpr int64 kTimestampValue1 = 43;
constexpr int64_t kTimestampValue1 = 43;
RunTimeStep(kTimestampValue1, "DISALLOW", false);
constexpr int64 kTimestampValue2 = 44;
constexpr int64_t kTimestampValue2 = 44;
RunTimeStep(kTimestampValue2, "DISALLOW", false);
constexpr int64 kTimestampValue3 = 45;
constexpr int64_t kTimestampValue3 = 45;
RunTimeStep(kTimestampValue3, "DISALLOW", true);
const std::vector<Packet>& output =
@@ -432,7 +432,7 @@ TEST_F(GateCalculatorTest, DisallowInitialNoStateTransition) {
output_stream: "STATE_CHANGE:state_changed"
)");
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, "DISALLOW", false);
const std::vector<Packet>& output =
@@ -450,7 +450,7 @@ TEST_F(GateCalculatorTest, AllowInitialNoStateTransition) {
output_stream: "STATE_CHANGE:state_changed"
)");
constexpr int64 kTimestampValue0 = 42;
constexpr int64_t kTimestampValue0 = 42;
RunTimeStep(kTimestampValue0, "ALLOW", true);
const std::vector<Packet>& output =
@@ -458,5 +458,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
@@ -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],
@@ -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.
@@ -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.
@@ -18,7 +18,7 @@
namespace {
// Reflect an integer against the lower and upper bound of an interval.
int64 ReflectBetween(int64 ts, int64 ts_min, int64 ts_max) {
int64_t ReflectBetween(int64_t ts, int64_t ts_min, int64_t ts_max) {
if (ts < ts_min) return 2 * ts_min - ts - 1;
if (ts >= ts_max) return 2 * ts_max - ts - 1;
return ts;
@@ -47,7 +47,7 @@ constexpr char kOptionsTag[] = "OPTIONS";
// Returns a TimestampDiff (assuming microseconds) corresponding to the
// given time in seconds.
TimestampDiff TimestampDiffFromSeconds(double seconds) {
return TimestampDiff(MathUtil::SafeRound<int64, double>(
return TimestampDiff(MathUtil::SafeRound<int64_t, double>(
seconds * Timestamp::kTimestampUnitsPerSecond));
}
} // namespace
@@ -117,8 +117,8 @@ absl::Status PacketResamplerCalculator::Open(CalculatorContext* cc) {
<< "The output frame rate must be smaller than "
<< Timestamp::kTimestampUnitsPerSecond;
frame_time_usec_ = static_cast<int64>(1000000.0 / frame_rate_);
jitter_usec_ = static_cast<int64>(1000000.0 * jitter_ / frame_rate_);
frame_time_usec_ = static_cast<int64_t>(1000000.0 / frame_rate_);
jitter_usec_ = static_cast<int64_t>(1000000.0 * jitter_ / frame_rate_);
RET_CHECK_LE(jitter_usec_, frame_time_usec_);
video_header_.frame_rate = frame_rate_;
@@ -198,17 +198,18 @@ PacketResamplerCalculator::GetSamplingStrategy(
return absl::make_unique<JitterWithoutReflectionStrategy>(this);
}
Timestamp PacketResamplerCalculator::PeriodIndexToTimestamp(int64 index) const {
Timestamp PacketResamplerCalculator::PeriodIndexToTimestamp(
int64_t index) const {
CHECK_EQ(jitter_, 0.0);
CHECK_NE(first_timestamp_, Timestamp::Unset());
return first_timestamp_ + TimestampDiffFromSeconds(index / frame_rate_);
}
int64 PacketResamplerCalculator::TimestampToPeriodIndex(
int64_t PacketResamplerCalculator::TimestampToPeriodIndex(
Timestamp timestamp) const {
CHECK_EQ(jitter_, 0.0);
CHECK_NE(first_timestamp_, Timestamp::Unset());
return MathUtil::SafeRound<int64, double>(
return MathUtil::SafeRound<int64_t, double>(
(timestamp - first_timestamp_).Seconds() * frame_rate_);
}
@@ -289,11 +290,11 @@ absl::Status LegacyJitterWithReflectionStrategy::Process(
}
while (true) {
const int64 last_diff =
const int64_t last_diff =
(next_output_timestamp_ - calculator_->last_packet_.Timestamp())
.Value();
RET_CHECK_GT(last_diff, 0);
const int64 curr_diff =
const int64_t curr_diff =
(next_output_timestamp_ - cc->InputTimestamp()).Value();
if (curr_diff > 0) {
break;
@@ -559,11 +560,11 @@ absl::Status JitterWithoutReflectionStrategy::Process(CalculatorContext* cc) {
}
while (true) {
const int64 last_diff =
const int64_t last_diff =
(next_output_timestamp_ - calculator_->last_packet_.Timestamp())
.Value();
RET_CHECK_GT(last_diff, 0);
const int64 curr_diff =
const int64_t curr_diff =
(next_output_timestamp_ - cc->InputTimestamp()).Value();
if (curr_diff > 0) {
break;
@@ -631,7 +632,7 @@ absl::Status NoJitterStrategy::Process(CalculatorContext* cc) {
} else {
// Initialize first_timestamp_ with the first packet timestamp
// aligned to the base_timestamp_.
int64 first_index = MathUtil::SafeRound<int64, double>(
int64_t first_index = MathUtil::SafeRound<int64_t, double>(
(cc->InputTimestamp() - base_timestamp_).Seconds() *
calculator_->frame_rate_);
calculator_->first_timestamp_ =
@@ -646,7 +647,7 @@ absl::Status NoJitterStrategy::Process(CalculatorContext* cc) {
}
}
const Timestamp received_timestamp = cc->InputTimestamp();
const int64 received_timestamp_idx =
const int64_t received_timestamp_idx =
calculator_->TimestampToPeriodIndex(received_timestamp);
// Only consider the received packet if it belongs to the current period
// (== period_count_) or to a newer one (> period_count_).
@@ -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)));
}
@@ -97,7 +97,7 @@ class PacketThinnerCalculator : public CalculatorBase {
cc->Inputs().Index(0).SetAny();
cc->Outputs().Index(0).SetSameAs(&cc->Inputs().Index(0));
if (cc->InputSidePackets().HasTag(kPeriodTag)) {
cc->InputSidePackets().Tag(kPeriodTag).Set<int64>();
cc->InputSidePackets().Tag(kPeriodTag).Set<int64_t>();
}
return absl::OkStatus();
}
@@ -173,7 +173,7 @@ absl::Status PacketThinnerCalculator::Open(CalculatorContext* cc) {
if (cc->InputSidePackets().HasTag(kPeriodTag)) {
period_ =
TimestampDiff(cc->InputSidePackets().Tag(kPeriodTag).Get<int64>());
TimestampDiff(cc->InputSidePackets().Tag(kPeriodTag).Get<int64_t>());
} else {
period_ = TimestampDiff(options.period());
}
@@ -300,13 +300,13 @@ Timestamp PacketThinnerCalculator::NearestSyncTimestamp(Timestamp now) const {
// Computation is done using int64 arithmetic. No easy way to avoid
// since Timestamps don't support div and multiply.
const int64 now64 = now.Value();
const int64 start64 = start_time_.Value();
const int64 period64 = period_.Value();
const int64_t now64 = now.Value();
const int64_t start64 = start_time_.Value();
const int64_t period64 = period_.Value();
CHECK_LE(0, period64);
// Round now64 to its closest interval (units of period64).
int64 sync64 =
int64_t sync64 =
(now64 - start64 + period64 / 2) / period64 * period64 + start64;
CHECK_LE(abs(now64 - sync64), period64 / 2)
<< "start64: " << start64 << "; now64: " << now64
@@ -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);
@@ -121,7 +121,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.";
@@ -178,8 +178,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)
@@ -64,16 +64,16 @@ REGISTER_CALCULATOR(StringToIntCalculator);
using StringToUintCalculator = StringToIntCalculatorTemplate<unsigned int>;
REGISTER_CALCULATOR(StringToUintCalculator);
using StringToInt32Calculator = StringToIntCalculatorTemplate<int32>;
using StringToInt32Calculator = StringToIntCalculatorTemplate<int32_t>;
REGISTER_CALCULATOR(StringToInt32Calculator);
using StringToUint32Calculator = StringToIntCalculatorTemplate<uint32>;
using StringToUint32Calculator = StringToIntCalculatorTemplate<uint32_t>;
REGISTER_CALCULATOR(StringToUint32Calculator);
using StringToInt64Calculator = StringToIntCalculatorTemplate<int64>;
using StringToInt64Calculator = StringToIntCalculatorTemplate<int64_t>;
REGISTER_CALCULATOR(StringToInt64Calculator);
using StringToUint64Calculator = StringToIntCalculatorTemplate<uint64>;
using StringToUint64Calculator = StringToIntCalculatorTemplate<uint64_t>;
REGISTER_CALCULATOR(StringToUint64Calculator);
} // namespace mediapipe
@@ -75,16 +75,16 @@ absl::Status FindInterpolationAlgorithm(
void CropImageFrame(const ImageFrame& original, int col_start, int row_start,
int crop_width, int crop_height, ImageFrame* cropped) {
const uint8* src = original.PixelData();
uint8* dst = cropped->MutablePixelData();
const uint8_t* src = original.PixelData();
uint8_t* dst = cropped->MutablePixelData();
int des_y = 0;
for (int y = row_start; y < row_start + crop_height; ++y) {
const uint8* src_line = src + y * original.WidthStep();
const uint8* src_pixel = src_line + col_start *
original.NumberOfChannels() *
original.ByteDepth();
uint8* dst_line = dst + des_y * cropped->WidthStep();
const uint8_t* src_line = src + y * original.WidthStep();
const uint8_t* src_pixel = src_line + col_start *
original.NumberOfChannels() *
original.ByteDepth();
uint8_t* dst_line = dst + des_y * cropped->WidthStep();
std::memcpy(
dst_line, src_pixel,
crop_width * cropped->NumberOfChannels() * cropped->ByteDepth());
@@ -591,9 +591,9 @@ absl::Status ScaleImageCalculator::Process(CalculatorContext* cc) {
const int y_size = output_width_ * output_height_;
const int uv_size = output_width_ * output_height_ / 4;
std::unique_ptr<uint8_t[]> yuv_data(new uint8_t[y_size + uv_size * 2]);
uint8* y = yuv_data.get();
uint8* u = y + y_size;
uint8* v = u + uv_size;
uint8_t* y = yuv_data.get();
uint8_t* u = y + y_size;
uint8_t* v = u + uv_size;
RET_CHECK_EQ(0, I420Scale(yuv_image->data(0), yuv_image->stride(0),
yuv_image->data(1), yuv_image->stride(1),
yuv_image->data(2), yuv_image->stride(2),
@@ -166,7 +166,7 @@ class WarpAffineRunnerHolder<mediapipe::Image> {
const ImageFrame image_frame(frame_ptr->Format(), frame_ptr->Width(),
frame_ptr->Height(), frame_ptr->WidthStep(),
const_cast<uint8_t*>(frame_ptr->PixelData()),
[](uint8* data){});
[](uint8_t* data){});
ASSIGN_OR_RETURN(auto result,
runner->Run(image_frame, matrix, size, border_mode));
return mediapipe::Image(std::make_shared<ImageFrame>(std::move(result)));
@@ -101,7 +101,7 @@ void RunTest(const std::string& graph_text, const std::string& tag,
ImageFrame input_image(
input.channels() == 4 ? ImageFormat::SRGBA : ImageFormat::SRGB,
input.cols, input.rows, input.step, input.data, [](uint8*) {});
input.cols, input.rows, input.step, input.data, [](uint8_t*) {});
MP_ASSERT_OK(graph.AddPacketToInputStream(
"input_image",
MakePacket<ImageFrame>(std::move(input_image)).At(Timestamp(0))));
+7 -7
View File
@@ -401,8 +401,8 @@ cc_library_with_tflite(
hdrs = ["inference_calculator.h"],
tflite_deps = [
"//mediapipe/util/tflite:tflite_model_loader",
"@org_tensorflow//tensorflow/lite/core/shims:framework_stable",
"@org_tensorflow//tensorflow/lite/core/shims:builtin_ops",
"@org_tensorflow//tensorflow/lite:framework_stable",
"@org_tensorflow//tensorflow/lite/kernels:builtin_ops",
],
deps = [
":inference_calculator_cc_proto",
@@ -506,7 +506,7 @@ cc_library_with_tflite(
name = "tflite_delegate_ptr",
hdrs = ["tflite_delegate_ptr.h"],
tflite_deps = [
"@org_tensorflow//tensorflow/lite/core/shims:c_api_types",
"@org_tensorflow//tensorflow/lite/c:c_api_types",
],
)
@@ -517,8 +517,8 @@ cc_library_with_tflite(
tflite_deps = [
":tflite_delegate_ptr",
"//mediapipe/util/tflite:tflite_model_loader",
"@org_tensorflow//tensorflow/lite/core/shims:c_api_types",
"@org_tensorflow//tensorflow/lite/core/shims:framework_stable",
"@org_tensorflow//tensorflow/lite:framework_stable",
"@org_tensorflow//tensorflow/lite/c:c_api_types",
],
deps = [
":inference_runner",
@@ -546,8 +546,8 @@ cc_library(
"@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@org_tensorflow//tensorflow/lite/core/shims:c_api_types",
"@org_tensorflow//tensorflow/lite/core/shims:framework_stable",
"@org_tensorflow//tensorflow/lite:framework_stable",
"@org_tensorflow//tensorflow/lite/c:c_api_types",
"@org_tensorflow//tensorflow/lite/delegates/xnnpack:xnnpack_delegate",
] + select({
"//conditions:default": [],
@@ -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.
@@ -95,7 +95,8 @@ absl::Status FrameBufferProcessor::Convert(const mediapipe::Image& input,
static_cast<int>(range_max) == 255);
}
auto input_frame = input.GetGpuBuffer().GetReadView<FrameBuffer>();
auto input_frame =
input.GetGpuBuffer(/*upload_to_gpu=*/false).GetReadView<FrameBuffer>();
const auto& output_shape = output_tensor.shape();
MP_RETURN_IF_ERROR(ValidateTensorShape(output_shape));
FrameBuffer::Dimension output_dimension{/*width=*/output_shape.dims[2],
@@ -94,8 +94,8 @@ InferenceCalculator::GetOpResolverAsPacket(CalculatorContext* cc) {
return kSideInCustomOpResolver(cc).As<tflite::OpResolver>();
}
return PacketAdopting<tflite::OpResolver>(
std::make_unique<tflite_shims::ops::builtin::
BuiltinOpResolverWithoutDefaultDelegates>());
std::make_unique<
tflite::ops::builtin::BuiltinOpResolverWithoutDefaultDelegates>());
}
} // namespace api2
@@ -26,7 +26,7 @@
#include "mediapipe/framework/formats/tensor.h"
#include "mediapipe/util/tflite/tflite_model_loader.h"
#include "tensorflow/lite/core/api/op_resolver.h"
#include "tensorflow/lite/core/shims/cc/kernels/register.h"
#include "tensorflow/lite/kernels/register.h"
namespace mediapipe {
namespace api2 {
@@ -97,8 +97,8 @@ class InferenceCalculator : public NodeIntf {
// Deprecated. Prefers to use "OP_RESOLVER" input side packet instead.
// TODO: Removes the "CUSTOM_OP_RESOLVER" side input after the
// migration.
static constexpr SideInput<tflite_shims::ops::builtin::BuiltinOpResolver>::
Optional kSideInCustomOpResolver{"CUSTOM_OP_RESOLVER"};
static constexpr SideInput<tflite::ops::builtin::BuiltinOpResolver>::Optional
kSideInCustomOpResolver{"CUSTOM_OP_RESOLVER"};
static constexpr SideInput<tflite::OpResolver>::Optional kSideInOpResolver{
"OP_RESOLVER"};
static constexpr SideInput<TfLiteModelPtr>::Optional kSideInModel{"MODEL"};
@@ -24,7 +24,7 @@
#include "mediapipe/calculators/tensor/inference_calculator_utils.h"
#include "mediapipe/calculators/tensor/inference_interpreter_delegate_runner.h"
#include "mediapipe/calculators/tensor/inference_runner.h"
#include "tensorflow/lite/core/shims/cc/interpreter.h"
#include "tensorflow/lite/interpreter.h"
#if defined(MEDIAPIPE_ANDROID)
#include "tensorflow/lite/delegates/nnapi/nnapi_delegate.h"
#endif // ANDROID
@@ -22,9 +22,9 @@
#include "mediapipe/framework/formats/tensor.h"
#include "mediapipe/framework/mediapipe_profiling.h"
#include "mediapipe/framework/port/ret_check.h"
#include "tensorflow/lite/core/shims/c/c_api_types.h"
#include "tensorflow/lite/core/shims/cc/interpreter.h"
#include "tensorflow/lite/core/shims/cc/interpreter_builder.h"
#include "tensorflow/lite/c/c_api_types.h"
#include "tensorflow/lite/interpreter.h"
#include "tensorflow/lite/interpreter_builder.h"
#include "tensorflow/lite/string_util.h"
#define PERFETTO_TRACK_EVENT_NAMESPACE mediapipe
@@ -33,8 +33,8 @@ namespace mediapipe {
namespace {
using Interpreter = ::tflite_shims::Interpreter;
using InterpreterBuilder = ::tflite_shims::InterpreterBuilder;
using Interpreter = ::tflite::Interpreter;
using InterpreterBuilder = ::tflite::InterpreterBuilder;
template <typename T>
void CopyTensorBufferToInterpreter(const Tensor& input_tensor,
@@ -23,8 +23,8 @@
#include "mediapipe/calculators/tensor/tflite_delegate_ptr.h"
#include "mediapipe/framework/api2/packet.h"
#include "mediapipe/util/tflite/tflite_model_loader.h"
#include "tensorflow/lite/c/c_api_types.h"
#include "tensorflow/lite/core/api/op_resolver.h"
#include "tensorflow/lite/core/shims/c/c_api_types.h"
namespace mediapipe {
@@ -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.
@@ -18,7 +18,7 @@
#include <functional>
#include <memory>
#include "tensorflow/lite/core/shims/c/c_api_types.h"
#include "tensorflow/lite/c/c_api_types.h"
namespace mediapipe {
+28
View File
@@ -400,6 +400,16 @@ cc_library(
# compile your binary with the flag TENSORFLOW_PROTOS=lite.
cc_library(
name = "tensorflow_inference_calculator_no_envelope_loader",
deps = [
":tensorflow_inference_calculator_for_boq",
],
alwayslink = 1,
)
# This dependency removed tensorflow_jellyfish_deps and xprofilez_with_server because they failed
# Boq conformance test. Weigh your use case to see if this will work for you.
cc_library(
name = "tensorflow_inference_calculator_for_boq",
srcs = ["tensorflow_inference_calculator.cc"],
deps = [
":tensorflow_inference_calculator_cc_proto",
@@ -585,6 +595,24 @@ cc_library(
# See yaqs/1092546221614039040
cc_library(
name = "tensorflow_session_from_saved_model_generator_no_envelope_loader",
defines = select({
"//mediapipe:android": ["__ANDROID__"],
"//conditions:default": [],
}),
deps = [
":tensorflow_session_from_saved_model_generator_for_boq",
] + select({
"//conditions:default": [
"//learning/brain/frameworks/uptc/public:uptc_session_no_envelope_loader",
],
}),
alwayslink = 1,
)
# Same library as tensorflow_session_from_saved_model_generator without uptc_session,
# envelop_loader and remote_session dependencies.
cc_library(
name = "tensorflow_session_from_saved_model_generator_for_boq",
srcs = ["tensorflow_session_from_saved_model_generator.cc"],
defines = select({
"//mediapipe:android": ["__ANDROID__"],
@@ -61,12 +61,12 @@ constexpr char kSessionBundleTag[] = "SESSION_BUNDLE";
// overload GPU/TPU/...
class SimpleSemaphore {
public:
explicit SimpleSemaphore(uint32 initial_count) : count_(initial_count) {}
explicit SimpleSemaphore(uint32_t initial_count) : count_(initial_count) {}
SimpleSemaphore(const SimpleSemaphore&) = delete;
SimpleSemaphore(SimpleSemaphore&&) = delete;
// Acquires the semaphore by certain amount.
void Acquire(uint32 amount) {
void Acquire(uint32_t amount) {
mutex_.Lock();
while (count_ < amount) {
cond_.Wait(&mutex_);
@@ -76,7 +76,7 @@ class SimpleSemaphore {
}
// Releases the semaphore by certain amount.
void Release(uint32 amount) {
void Release(uint32_t amount) {
mutex_.Lock();
count_ += amount;
cond_.SignalAll();
@@ -84,7 +84,7 @@ class SimpleSemaphore {
}
private:
uint32 count_;
uint32_t count_;
absl::Mutex mutex_;
absl::CondVar cond_;
};
@@ -488,7 +488,7 @@ class TensorFlowInferenceCalculator : public CalculatorBase {
// necessary.
absl::Status OutputBatch(CalculatorContext* cc,
std::unique_ptr<InferenceState> inference_state) {
const int64 start_time = absl::ToUnixMicros(clock_->TimeNow());
const int64_t start_time = absl::ToUnixMicros(clock_->TimeNow());
std::vector<std::pair<mediapipe::ProtoString, tf::Tensor>> input_tensors;
for (auto& keyed_tensors : inference_state->input_tensor_batches_) {
@@ -544,7 +544,7 @@ class TensorFlowInferenceCalculator : public CalculatorBase {
get_session_run_throttle(options_.max_concurrent_session_runs());
session_run_throttle->Acquire(1);
}
const int64 run_start_time = absl::ToUnixMicros(clock_->TimeNow());
const int64_t run_start_time = absl::ToUnixMicros(clock_->TimeNow());
tf::Status tf_status;
{
#if !defined(MEDIAPIPE_MOBILE) && !defined(__APPLE__)
@@ -562,7 +562,7 @@ class TensorFlowInferenceCalculator : public CalculatorBase {
// informative error message.
RET_CHECK(tf_status.ok()) << "Run failed: " << tf_status.ToString();
const int64 run_end_time = absl::ToUnixMicros(clock_->TimeNow());
const int64_t run_end_time = absl::ToUnixMicros(clock_->TimeNow());
cc->GetCounter(kTotalSessionRunsTimeUsecsCounterSuffix)
->IncrementBy(run_end_time - run_start_time);
cc->GetCounter(kTotalNumSessionRunsCounterSuffix)->Increment();
@@ -611,7 +611,7 @@ class TensorFlowInferenceCalculator : public CalculatorBase {
}
// Get end time and report.
const int64 end_time = absl::ToUnixMicros(clock_->TimeNow());
const int64_t end_time = absl::ToUnixMicros(clock_->TimeNow());
cc->GetCounter(kTotalUsecsCounterSuffix)
->IncrementBy(end_time - start_time);
cc->GetCounter(kTotalProcessedTimestampsCounterSuffix)
@@ -650,7 +650,7 @@ class TensorFlowInferenceCalculator : public CalculatorBase {
// The static singleton semaphore to throttle concurrent session runs.
static SimpleSemaphore* get_session_run_throttle(
int32 max_concurrent_session_runs) {
int32_t max_concurrent_session_runs) {
static SimpleSemaphore* session_run_throttle =
new SimpleSemaphore(max_concurrent_session_runs);
return session_run_throttle;
@@ -197,15 +197,15 @@ class UnpackMediaSequenceCalculator : public CalculatorBase {
// timestamp and the associated feature. This information is used in process
// to output batches of packets in order.
timestamps_.clear();
int64 last_timestamp_seen = Timestamp::PreStream().Value();
int64_t last_timestamp_seen = Timestamp::PreStream().Value();
first_timestamp_seen_ = Timestamp::OneOverPostStream().Value();
for (const auto& map_kv : sequence_->feature_lists().feature_list()) {
if (absl::StrContains(map_kv.first, "/timestamp")) {
LOG(INFO) << "Found feature timestamps: " << map_kv.first
<< " with size: " << map_kv.second.feature_size();
int64 recent_timestamp = Timestamp::PreStream().Value();
int64_t recent_timestamp = Timestamp::PreStream().Value();
for (int i = 0; i < map_kv.second.feature_size(); ++i) {
int64 next_timestamp =
int64_t next_timestamp =
mpms::GetInt64sAt(*sequence_, map_kv.first, i).Get(0);
RET_CHECK_GT(next_timestamp, recent_timestamp)
<< "Timestamps must be sequential. If you're seeing this message "
@@ -361,8 +361,8 @@ class UnpackMediaSequenceCalculator : public CalculatorBase {
// any particular call to Process(). At the every end, we output the
// poststream packets. If we only have poststream packets,
// last_timestamp_key_ will be empty.
int64 start_timestamp = 0;
int64 end_timestamp = 0;
int64_t start_timestamp = 0;
int64_t end_timestamp = 0;
if (last_timestamp_key_.empty() || process_poststream_) {
process_poststream_ = true;
start_timestamp = Timestamp::PostStream().Value();
@@ -481,14 +481,14 @@ class UnpackMediaSequenceCalculator : public CalculatorBase {
// Store a map from the keys for each stream to the timestamps for each
// key. This allows us to identify which packets to output for each stream
// for timestamps within a given time window.
std::map<std::string, std::vector<int64>> timestamps_;
std::map<std::string, std::vector<int64_t>> timestamps_;
// Store the stream with the latest timestamp in the SequenceExample.
std::string last_timestamp_key_;
// Store the index of the current timestamp. Will be less than
// timestamps_[last_timestamp_key_].size().
int current_timestamp_index_;
// Store the very first timestamp, so we output everything on the first frame.
int64 first_timestamp_seen_;
int64_t first_timestamp_seen_;
// List of keypoint names.
std::vector<std::string> keypoint_names_;
// Default keypoint location when missing.
@@ -54,7 +54,7 @@ class VectorToTensorFloatCalculatorTest : public ::testing::Test {
}
}
const int64 time = 1234;
const int64_t time = 1234;
runner_->MutableInputs()->Index(0).packets.push_back(
Adopt(input.release()).At(Timestamp(time)));
@@ -91,7 +91,7 @@ TEST_F(VectorToTensorFloatCalculatorTest, ConvertsFromVectorFloat) {
// 2^i can be represented exactly in floating point numbers if 'i' is small.
input->at(i) = static_cast<float>(1 << i);
}
const int64 time = 1234;
const int64_t time = 1234;
runner_->MutableInputs()->Index(0).packets.push_back(
Adopt(input.release()).At(Timestamp(time)));
+2
View File
@@ -1285,12 +1285,14 @@ cc_library(
srcs = ["flat_color_image_calculator.cc"],
deps = [
":flat_color_image_calculator_cc_proto",
"//mediapipe/framework:calculator_contract",
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/api2:node",
"//mediapipe/framework/formats:image",
"//mediapipe/framework/formats:image_frame",
"//mediapipe/framework/formats:image_frame_opencv",
"//mediapipe/framework/port:opencv_core",
"//mediapipe/framework/port:ret_check",
"//mediapipe/util:color_cc_proto",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
@@ -471,7 +471,7 @@ absl::Status AnnotationOverlayCalculator::CreateRenderTargetCpu(
auto input_mat = formats::MatView(&input_frame);
if (input_frame.Format() == ImageFormat::GRAY8) {
cv::Mat rgb_mat;
cv::cvtColor(input_mat, rgb_mat, CV_GRAY2RGB);
cv::cvtColor(input_mat, rgb_mat, cv::COLOR_GRAY2RGB);
rgb_mat.copyTo(*image_mat);
} else {
input_mat.copyTo(*image_mat);
@@ -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.
@@ -15,14 +15,13 @@
#include <memory>
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "mediapipe/calculators/util/flat_color_image_calculator.pb.h"
#include "mediapipe/framework/api2/node.h"
#include "mediapipe/framework/calculator_contract.h"
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/image.h"
#include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/image_frame_opencv.h"
#include "mediapipe/framework/port/opencv_core_inc.h"
#include "mediapipe/util/color.pb.h"
namespace mediapipe {
@@ -32,6 +31,7 @@ namespace {
using ::mediapipe::api2::Input;
using ::mediapipe::api2::Node;
using ::mediapipe::api2::Output;
using ::mediapipe::api2::SideOutput;
} // namespace
// A calculator for generating an image filled with a single color.
@@ -45,7 +45,8 @@ using ::mediapipe::api2::Output;
//
// Outputs:
// IMAGE (Image)
// Image filled with the requested color.
// Image filled with the requested color. Can be either an output_stream
// or an output_side_packet.
//
// Example useage:
// node {
@@ -68,9 +69,10 @@ class FlatColorImageCalculator : public Node {
public:
static constexpr Input<Image>::Optional kInImage{"IMAGE"};
static constexpr Input<Color>::Optional kInColor{"COLOR"};
static constexpr Output<Image> kOutImage{"IMAGE"};
static constexpr Output<Image>::Optional kOutImage{"IMAGE"};
static constexpr SideOutput<Image>::Optional kOutSideImage{"IMAGE"};
MEDIAPIPE_NODE_CONTRACT(kInImage, kInColor, kOutImage);
MEDIAPIPE_NODE_CONTRACT(kInImage, kInColor, kOutImage, kOutSideImage);
static absl::Status UpdateContract(CalculatorContract* cc) {
const auto& options = cc->Options<FlatColorImageCalculatorOptions>();
@@ -81,6 +83,13 @@ class FlatColorImageCalculator : public Node {
RET_CHECK(kInColor(cc).IsConnected() ^ options.has_color())
<< "Either set COLOR input stream, or set through options";
RET_CHECK(kOutImage(cc).IsConnected() ^ kOutSideImage(cc).IsConnected())
<< "Set IMAGE either as output stream, or as output side packet";
RET_CHECK(!kOutSideImage(cc).IsConnected() ||
(options.has_output_height() && options.has_output_width()))
<< "Set size through options, when setting IMAGE as output side packet";
return absl::OkStatus();
}
@@ -88,6 +97,9 @@ class FlatColorImageCalculator : public Node {
absl::Status Process(CalculatorContext* cc) override;
private:
std::optional<std::shared_ptr<ImageFrame>> CreateOutputFrame(
CalculatorContext* cc);
bool use_dimension_from_option_ = false;
bool use_color_from_option_ = false;
};
@@ -96,10 +108,31 @@ MEDIAPIPE_REGISTER_NODE(FlatColorImageCalculator);
absl::Status FlatColorImageCalculator::Open(CalculatorContext* cc) {
use_dimension_from_option_ = !kInImage(cc).IsConnected();
use_color_from_option_ = !kInColor(cc).IsConnected();
if (!kOutImage(cc).IsConnected()) {
std::optional<std::shared_ptr<ImageFrame>> output_frame =
CreateOutputFrame(cc);
if (output_frame.has_value()) {
kOutSideImage(cc).Set(Image(output_frame.value()));
}
}
return absl::OkStatus();
}
absl::Status FlatColorImageCalculator::Process(CalculatorContext* cc) {
if (kOutImage(cc).IsConnected()) {
std::optional<std::shared_ptr<ImageFrame>> output_frame =
CreateOutputFrame(cc);
if (output_frame.has_value()) {
kOutImage(cc).Send(Image(output_frame.value()));
}
}
return absl::OkStatus();
}
std::optional<std::shared_ptr<ImageFrame>>
FlatColorImageCalculator::CreateOutputFrame(CalculatorContext* cc) {
const auto& options = cc->Options<FlatColorImageCalculatorOptions>();
int output_height = -1;
@@ -112,7 +145,7 @@ absl::Status FlatColorImageCalculator::Process(CalculatorContext* cc) {
output_height = input_image.height();
output_width = input_image.width();
} else {
return absl::OkStatus();
return std::nullopt;
}
Color color;
@@ -121,7 +154,7 @@ absl::Status FlatColorImageCalculator::Process(CalculatorContext* cc) {
} else if (!kInColor(cc).IsEmpty()) {
color = kInColor(cc).Get();
} else {
return absl::OkStatus();
return std::nullopt;
}
auto output_frame = std::make_shared<ImageFrame>(ImageFormat::SRGB,
@@ -130,9 +163,7 @@ absl::Status FlatColorImageCalculator::Process(CalculatorContext* cc) {
output_mat.setTo(cv::Scalar(color.r(), color.g(), color.b()));
kOutImage(cc).Send(Image(output_frame));
return absl::OkStatus();
return output_frame;
}
} // namespace mediapipe
@@ -113,6 +113,35 @@ TEST(FlatColorImageCalculatorTest, SpecifyDimensionThroughOptions) {
}
}
TEST(FlatColorImageCalculatorTest, ProducesOutputSidePacket) {
CalculatorRunner runner(R"pb(
calculator: "FlatColorImageCalculator"
output_side_packet: "IMAGE:out_packet"
options {
[mediapipe.FlatColorImageCalculatorOptions.ext] {
output_width: 1
output_height: 1
color: {
r: 100,
g: 200,
b: 255,
}
}
}
)pb");
MP_ASSERT_OK(runner.Run());
const auto& image = runner.OutputSidePackets().Tag(kImageTag).Get<Image>();
EXPECT_EQ(image.width(), 1);
EXPECT_EQ(image.height(), 1);
auto image_frame = image.GetImageFrameSharedPtr();
const uint8_t* pixel_data = image_frame->PixelData();
EXPECT_EQ(pixel_data[0], 100);
EXPECT_EQ(pixel_data[1], 200);
EXPECT_EQ(pixel_data[2], 255);
}
TEST(FlatColorImageCalculatorTest, FailureMissingDimension) {
CalculatorRunner runner(R"pb(
calculator: "FlatColorImageCalculator"
@@ -206,5 +235,56 @@ TEST(FlatColorImageCalculatorTest, FailureDuplicateColor) {
HasSubstr("Either set COLOR input stream"));
}
TEST(FlatColorImageCalculatorTest, FailureDuplicateOutputs) {
CalculatorRunner runner(R"pb(
calculator: "FlatColorImageCalculator"
output_stream: "IMAGE:out_image"
output_side_packet: "IMAGE:out_packet"
options {
[mediapipe.FlatColorImageCalculatorOptions.ext] {
output_width: 1
output_height: 1
color: {
r: 100,
g: 200,
b: 255,
}
}
}
)pb");
ASSERT_THAT(
runner.Run().message(),
HasSubstr("Set IMAGE either as output stream, or as output side packet"));
}
TEST(FlatColorImageCalculatorTest, FailureSettingInputImageOnOutputSidePacket) {
CalculatorRunner runner(R"pb(
calculator: "FlatColorImageCalculator"
input_stream: "IMAGE:image"
output_side_packet: "IMAGE:out_packet"
options {
[mediapipe.FlatColorImageCalculatorOptions.ext] {
color: {
r: 100,
g: 200,
b: 255,
}
}
}
)pb");
auto image_frame = std::make_shared<ImageFrame>(ImageFormat::SRGB,
kImageWidth, kImageHeight);
for (int ts = 0; ts < 3; ++ts) {
runner.MutableInputs()->Tag(kImageTag).packets.push_back(
MakePacket<Image>(image_frame).At(Timestamp(ts)));
}
ASSERT_THAT(runner.Run().message(),
HasSubstr("Set size through options, when setting IMAGE as "
"output side packet"));
}
} // namespace
} // namespace mediapipe
@@ -18,6 +18,9 @@ package mediapipe;
import "mediapipe/framework/calculator.proto";
option java_package = "com.google.mediapipe.calculator.proto";
option java_outer_classname = "LogicCalculatorOptionsProto";
message LogicCalculatorOptions {
extend CalculatorOptions {
optional LogicCalculatorOptions ext = 338731246;
+2
View File
@@ -48,6 +48,7 @@ cc_library(
"//mediapipe/framework/port:opencv_video",
"//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:status",
"//mediapipe/util:resource_util",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
],
@@ -73,6 +74,7 @@ cc_library(
"//mediapipe/gpu:gl_calculator_helper",
"//mediapipe/gpu:gpu_buffer",
"//mediapipe/gpu:gpu_shared_data_internal",
"//mediapipe/util:resource_util",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
],
@@ -28,11 +28,8 @@
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h"
using mediapipe::Adopt;
using mediapipe::CalculatorBase;
using mediapipe::ImageFrame;
using mediapipe::PacketTypeSet;
using mediapipe::autoflip::Border;
constexpr char kDetectedBorders[] = "DETECTED_BORDERS";
constexpr int kMinBorderDistance = 5;
@@ -28,16 +28,12 @@
#include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/port/status_matchers.h"
using mediapipe::Adopt;
using mediapipe::CalculatorGraphConfig;
using mediapipe::CalculatorRunner;
using mediapipe::ImageFormat;
using mediapipe::ImageFrame;
using mediapipe::Packet;
using mediapipe::PacketTypeSet;
using mediapipe::ParseTextProtoOrDie;
using mediapipe::Timestamp;
using mediapipe::autoflip::Border;
namespace mediapipe {
namespace autoflip {
@@ -31,14 +31,11 @@
#include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/port/status_matchers.h"
using mediapipe::Adopt;
using mediapipe::CalculatorGraphConfig;
using mediapipe::CalculatorRunner;
using mediapipe::ImageFormat;
using mediapipe::ImageFrame;
using mediapipe::PacketTypeSet;
using mediapipe::ParseTextProtoOrDie;
using mediapipe::Timestamp;
namespace mediapipe {
namespace autoflip {
@@ -28,8 +28,6 @@
using mediapipe::Packet;
using mediapipe::PacketTypeSet;
using mediapipe::autoflip::DetectionSet;
using mediapipe::autoflip::SalientRegion;
using mediapipe::autoflip::SignalType;
constexpr char kIsShotBoundaryTag[] = "IS_SHOT_BOUNDARY";
constexpr char kSignalInputsTag[] = "SIGNAL";
@@ -190,14 +190,16 @@ TEST(PaddingEffectGeneratorTest, ScaleToMultipleOfTwo) {
double target_aspect_ratio = 0.5;
int expect_width = 14;
int expect_height = input_height;
auto test_frame = absl::make_unique<ImageFrame>(/*format=*/ImageFormat::SRGB,
input_width, input_height);
ImageFrame test_frame(/*format=*/ImageFormat::SRGB, input_width,
input_height);
cv::Mat mat = formats::MatView(&test_frame);
mat = cv::Scalar(0, 0, 0);
PaddingEffectGenerator generator(test_frame->Width(), test_frame->Height(),
PaddingEffectGenerator generator(test_frame.Width(), test_frame.Height(),
target_aspect_ratio,
/*scale_to_multiple_of_two=*/true);
ImageFrame result_frame;
MP_ASSERT_OK(generator.Process(*test_frame, 0.3, 40, 0.0, &result_frame));
MP_ASSERT_OK(generator.Process(test_frame, 0.3, 40, 0.0, &result_frame));
EXPECT_EQ(result_frame.Width(), expect_width);
EXPECT_EQ(result_frame.Height(), expect_height);
}
@@ -26,6 +26,7 @@
#include "mediapipe/framework/port/opencv_video_inc.h"
#include "mediapipe/framework/port/parse_text_proto.h"
#include "mediapipe/framework/port/status.h"
#include "mediapipe/util/resource_util.h"
constexpr char kInputStream[] = "input_video";
constexpr char kOutputStream[] = "output_video";
@@ -30,6 +30,7 @@
#include "mediapipe/gpu/gl_calculator_helper.h"
#include "mediapipe/gpu/gpu_buffer.h"
#include "mediapipe/gpu/gpu_shared_data_internal.h"
#include "mediapipe/util/resource_util.h"
constexpr char kInputStream[] = "input_video";
constexpr char kOutputStream[] = "output_video";
@@ -147,12 +147,18 @@ def main():
f"Looking for profiles for app ids with prefix '{bundle_id_prefix}' in '{profile_dir}'"
)
profiles_found = False
for name in os.listdir(profile_dir):
if not name.endswith(".mobileprovision"):
continue
profiles_found = True
profile_path = os.path.join(profile_dir, name)
process_profile(profile_path, our_app_id_re)
if not profiles_found:
print("Error: Unable to find any provisioning profiles " +
f"(*.mobileprovision files) in '{profile_dir}'")
if __name__ == "__main__":
main()
+3 -1
View File
@@ -33,7 +33,9 @@ bzl_library(
srcs = [
"transitive_protos.bzl",
],
visibility = ["//mediapipe/framework:__subpackages__"],
visibility = [
"//mediapipe/framework:__subpackages__",
],
)
bzl_library(
+1 -1
View File
@@ -52,7 +52,7 @@ int select = cc->Inputs().Tag(kSelectTag).Get<int>();
write
```
int select = kSelectTag(cc).Get(); // alternative: *kSelectTag(cc)
int select = kSelect(cc).Get(); // alternative: *kSelect(cc)
```
Sets of multiple ports can be declared with `::Multiple`. Note, also, that a tag
+10
View File
@@ -223,6 +223,16 @@ class SourceImpl {
return !(*this == other);
}
Src& SetName(const char* name) {
base_->name_ = std::string(name);
return *this;
}
Src& SetName(absl::string_view name) {
base_->name_ = std::string(name);
return *this;
}
Src& SetName(std::string name) {
base_->name_ = std::move(name);
return *this;
-2
View File
@@ -19,8 +19,6 @@ namespace mediapipe {
namespace api2 {
namespace test {
using testing::ElementsAre;
// Returns the packet values for a vector of Packets.
template <typename T>
std::vector<T> PacketValues(const std::vector<mediapipe::Packet>& packets) {
+5
View File
@@ -467,6 +467,11 @@ class SideFallbackT : public Base {
// CalculatorContext (e.g. kOut(cc)), and provides a type-safe interface to
// OutputStreamShard. Like that class, this class will not be usually named in
// calculator code, but used as a temporary object (e.g. kOut(cc).Send(...)).
//
// If not connected (!IsConnected()) SetNextTimestampBound is safe to call and
// does nothing.
// All the sub-classes that define Send should implement it to be safe to to
// call if not connected and do nothing in such case.
class OutputShardAccessBase {
public:
OutputShardAccessBase(const CalculatorContext& cc, OutputStreamShard* output)
+5 -7
View File
@@ -23,15 +23,13 @@ package mediapipe;
option java_package = "com.google.mediapipe.proto";
option java_outer_classname = "CalculatorOptionsProto";
// Options for Calculators. Each Calculator implementation should
// have its own options proto, which should look like this:
// Options for Calculators, DEPRECATED. New calculators are encouraged to use
// proto3 syntax options:
//
// message MyCalculatorOptions {
// extend CalculatorOptions {
// optional MyCalculatorOptions ext = <unique id, e.g. the CL#>;
// }
// optional string field_needed_by_my_calculator = 1;
// optional int32 another_field = 2;
// // proto3 does not expect "optional"
// string field_needed_by_my_calculator = 1;
// int32 another_field = 2;
// // etc
// }
message CalculatorOptions {
+1 -1
View File
@@ -1,4 +1,4 @@
/* Copyright 2023 The MediaPipe Authors. All Rights Reserved.
/* 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.
+1 -1
View File
@@ -1,4 +1,4 @@
/* Copyright 2023 The MediaPipe Authors. All Rights Reserved.
/* 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.
+5 -5
View File
@@ -113,11 +113,11 @@ class Image {
#endif // MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER
#endif // !MEDIAPIPE_DISABLE_GPU
// Get a GPU view. Automatically uploads from CPU if needed.
const mediapipe::GpuBuffer GetGpuBuffer() const {
#if !MEDIAPIPE_DISABLE_GPU
if (use_gpu_ == false) ConvertToGpu();
#endif // !MEDIAPIPE_DISABLE_GPU
// Provides access to the underlying GpuBuffer storage.
// Automatically uploads from CPU to GPU if needed and requested through the
// `upload_to_gpu` argument.
const mediapipe::GpuBuffer GetGpuBuffer(bool upload_to_gpu = true) const {
if (!use_gpu_ && upload_to_gpu) ConvertToGpu();
return gpu_buffer_;
}
@@ -0,0 +1,31 @@
"""Rules implementation for mediapipe_proto_alias.bzl, do not load directly."""
def _copy_header_impl(ctx):
source = ctx.attr.source.replace("//", "").replace(":", "/")
files = []
for dep in ctx.attr.deps:
for header in dep[CcInfo].compilation_context.direct_headers:
if (header.short_path == source):
files.append(header)
if len(files) != 1:
fail("Expected exactly 1 source, got ", str(files))
dest_file = ctx.actions.declare_file(ctx.attr.filename)
# Use expand_template() with no substitutions as a simple copier.
ctx.actions.expand_template(
template = files[0],
output = dest_file,
substitutions = {},
)
return [DefaultInfo(files = depset([dest_file]))]
copy_header = rule(
implementation = _copy_header_impl,
attrs = {
"filename": attr.string(),
"source": attr.string(),
"deps": attr.label_list(providers = [CcInfo]),
},
output_to_genfiles = True,
outputs = {"out": "%{filename}"},
)
+1 -3
View File
@@ -15,9 +15,7 @@
licenses(["notice"])
package(
default_visibility = ["//mediapipe/framework:__subpackages__"],
)
package(default_visibility = ["//mediapipe/framework:__subpackages__"])
cc_library(
name = "simple_calculator",
+1 -1
View File
@@ -310,7 +310,7 @@ class Scheduler {
absl::Mutex state_mutex_;
// Current state of the scheduler.
std::atomic<State> state_ = ATOMIC_VAR_INIT(STATE_NOT_STARTED);
std::atomic<State> state_ = STATE_NOT_STARTED;
// True if all graph input streams are closed.
bool graph_input_streams_closed_ ABSL_GUARDED_BY(state_mutex_) = false;
@@ -131,9 +131,9 @@ class FixedSizeInputStreamHandler : public DefaultInputStreamHandler {
ABSL_EXCLUSIVE_LOCKS_REQUIRED(erase_mutex_) {
// Record the most recent first kept timestamp on any stream.
for (const auto& stream : input_stream_managers_) {
int32 queue_size = (stream->QueueSize() >= trigger_queue_size_)
? target_queue_size_
: trigger_queue_size_ - 1;
int32_t queue_size = (stream->QueueSize() >= trigger_queue_size_)
? target_queue_size_
: trigger_queue_size_ - 1;
if (stream->QueueSize() > queue_size) {
kept_timestamp_ = std::max(
kept_timestamp_, stream->GetMinTimestampAmongNLatest(queue_size + 1)
@@ -214,8 +214,8 @@ class FixedSizeInputStreamHandler : public DefaultInputStreamHandler {
}
private:
int32 trigger_queue_size_;
int32 target_queue_size_;
int32_t trigger_queue_size_;
int32_t target_queue_size_;
bool fixed_min_size_;
// Indicates that GetNodeReadiness has returned kReadyForProcess once, and
// the corresponding call to FillInputSet has not yet completed.
@@ -30,15 +30,15 @@ namespace mediapipe {
namespace {
const int64 kMaxPacketId = 100;
const int64 kSlowCalculatorRate = 10;
const int64_t kMaxPacketId = 100;
const int64_t kSlowCalculatorRate = 10;
// Rate limiter for TestSlowCalculator.
ABSL_CONST_INIT absl::Mutex g_source_mutex(absl::kConstInit);
int64 g_source_counter ABSL_GUARDED_BY(g_source_mutex);
int64_t g_source_counter ABSL_GUARDED_BY(g_source_mutex);
// Rate limiter for TestSourceCalculator.
int64 g_slow_counter ABSL_GUARDED_BY(g_source_mutex);
int64_t g_slow_counter ABSL_GUARDED_BY(g_source_mutex);
// Flag that indicates that the source is done.
bool g_source_done ABSL_GUARDED_BY(g_source_mutex);
@@ -47,7 +47,7 @@ class TestSourceCalculator : public CalculatorBase {
public:
TestSourceCalculator() : current_packet_id_(0) {}
static absl::Status GetContract(CalculatorContract* cc) {
cc->Outputs().Index(0).Set<int64>();
cc->Outputs().Index(0).Set<int64_t>();
return absl::OkStatus();
}
absl::Status Open(CalculatorContext* cc) override {
@@ -62,7 +62,7 @@ class TestSourceCalculator : public CalculatorBase {
g_source_done = true;
return tool::StatusStop();
}
cc->Outputs().Index(0).Add(new int64(0), Timestamp(current_packet_id_));
cc->Outputs().Index(0).Add(new int64_t(0), Timestamp(current_packet_id_));
++current_packet_id_;
{
absl::MutexLock lock(&g_source_mutex);
@@ -78,7 +78,7 @@ class TestSourceCalculator : public CalculatorBase {
return g_source_counter <= kSlowCalculatorRate * g_slow_counter ||
g_source_counter <= 1;
}
int64 current_packet_id_;
int64_t current_packet_id_;
};
REGISTER_CALCULATOR(TestSourceCalculator);
@@ -87,8 +87,8 @@ class TestSlowCalculator : public CalculatorBase {
public:
TestSlowCalculator() = default;
static absl::Status GetContract(CalculatorContract* cc) {
cc->Inputs().Index(0).Set<int64>();
cc->Outputs().Index(0).Set<int64>();
cc->Inputs().Index(0).Set<int64_t>();
cc->Outputs().Index(0).Set<int64_t>();
return absl::OkStatus();
}
absl::Status Open(CalculatorContext* cc) override {
@@ -97,7 +97,7 @@ class TestSlowCalculator : public CalculatorBase {
return absl::OkStatus();
}
absl::Status Process(CalculatorContext* cc) override {
cc->Outputs().Index(0).Add(new int64(0),
cc->Outputs().Index(0).Add(new int64_t(0),
cc->Inputs().Index(0).Value().Timestamp());
{
absl::MutexLock lock(&g_source_mutex);
@@ -118,8 +118,9 @@ class TestSlowCalculator : public CalculatorBase {
REGISTER_CALCULATOR(TestSlowCalculator);
// Return the values of the timestamps of a vector of Packets.
static std::vector<int64> TimestampValues(const std::vector<Packet>& packets) {
std::vector<int64> result;
static std::vector<int64_t> TimestampValues(
const std::vector<Packet>& packets) {
std::vector<int64_t> result;
for (const Packet& p : packets) {
result.push_back(p.Timestamp().Value());
}
@@ -174,7 +175,7 @@ TEST_P(FixedSizeInputStreamHandlerTest, DropsPackets) {
// consumed. In this way, the TestSlowCalculator consumes and outputs only
// every tenth packet.
EXPECT_EQ(output_packets.size(), 11);
std::vector<int64> expected_ts = {0, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99};
std::vector<int64_t> expected_ts = {0, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99};
EXPECT_THAT(TimestampValues(output_packets),
testing::ContainerEq(expected_ts));
}
@@ -344,18 +345,18 @@ TEST_P(FixedSizeInputStreamHandlerTest, LateArrivalDrop) {
if (GetParam()) {
EXPECT_THAT(TimestampValues(output_packets[0]),
testing::ContainerEq(std::vector<int64>{1, 2, 3, 4, 5, 6}));
testing::ContainerEq(std::vector<int64_t>{1, 2, 3, 4, 5, 6}));
EXPECT_THAT(TimestampValues(output_packets[1]),
testing::ContainerEq(std::vector<int64>{3, 4, 5, 6, 7}));
testing::ContainerEq(std::vector<int64_t>{3, 4, 5, 6, 7}));
EXPECT_THAT(TimestampValues(output_packets[2]),
testing::ContainerEq(std::vector<int64>{4, 5, 6, 7}));
testing::ContainerEq(std::vector<int64_t>{4, 5, 6, 7}));
} else {
EXPECT_THAT(TimestampValues(output_packets[0]),
testing::ContainerEq(std::vector<int64>{5, 6}));
testing::ContainerEq(std::vector<int64_t>{5, 6}));
EXPECT_THAT(TimestampValues(output_packets[1]),
testing::ContainerEq(std::vector<int64>{5, 6, 7}));
testing::ContainerEq(std::vector<int64_t>{5, 6, 7}));
EXPECT_THAT(TimestampValues(output_packets[2]),
testing::ContainerEq(std::vector<int64>{5, 6, 7}));
testing::ContainerEq(std::vector<int64_t>{5, 6, 7}));
}
}
+1
View File
@@ -791,6 +791,7 @@ cc_library(
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@stblib//:stb_image",
"@stblib//:stb_image_write",
],
+53
View File
@@ -0,0 +1,53 @@
# 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.
"""MediaPipe Task Library Helper Rules for iOS"""
MPP_TASK_MINIMUM_OS_VERSION = "11.0"
# When the static framework is built with bazel, the all header files are moved
# to the "Headers" directory with no header path prefixes. This auxiliary rule
# is used for stripping the path prefix to the C/iOS API header files included by
# other C/iOS API header files.
# In case of C header files, includes start with a keyword of "#include'.
# Imports in iOS header files start with a keyword of '#import'.
def strip_api_include_path_prefix(name, hdr_labels, prefix = ""):
"""Create modified header files with the import path stripped out.
Args:
name: The name to be used as a prefix to the generated genrules.
hdr_labels: List of header labels to strip out the include path. Each
label must end with a colon followed by the header file name.
prefix: Optional prefix path to prepend to the header inclusion path.
"""
for hdr_label in hdr_labels:
hdr_filename = hdr_label.split(":")[-1]
# The last path component of iOS header files is sources/some_file.h
# Hence it wiill contain a '/'. So the string can be split at '/' to get
# the header file name.
if "/" in hdr_filename:
hdr_filename = hdr_filename.split("/")[-1]
hdr_basename = hdr_filename.split(".")[0]
native.genrule(
name = "{}_{}".format(name, hdr_basename),
srcs = [hdr_label],
outs = [hdr_filename],
cmd = """
sed 's|#\\([a-z]*\\) ".*/\\([^/]\\{{1,\\}}\\.h\\)"|#\\1 "{}\\2"|'\
"$(location {})"\
> "$@"
""".format(prefix, hdr_label),
)
@@ -54,6 +54,7 @@ def mediapipe_proto_library_impl(
def_java_proto = True,
def_jspb_proto = True,
def_go_proto = True,
def_dart_proto = True,
def_options_lib = True):
"""Defines the proto_library targets needed for all mediapipe platforms.
@@ -75,6 +76,7 @@ def mediapipe_proto_library_impl(
def_java_proto: define the java_proto_library target
def_jspb_proto: define the jspb_proto_library target
def_go_proto: define the go_proto_library target
def_dart_proto: define the dart_proto_library target
def_options_lib: define the mediapipe_options_library target
"""
@@ -258,6 +260,7 @@ def mediapipe_proto_library(
def_java_proto = True,
def_jspb_proto = True,
def_go_proto = True,
def_dart_proto = True,
def_options_lib = True,
def_rewrite = True,
portable_deps = None): # @unused
@@ -283,6 +286,7 @@ def mediapipe_proto_library(
def_java_proto: define the java_proto_library target
def_jspb_proto: define the jspb_proto_library target
def_go_proto: define the go_proto_library target
def_dart_proto: define the dart_proto_library target
def_options_lib: define the mediapipe_options_library target
def_rewrite: define a sibling mediapipe_proto_library with package "mediapipe"
"""
@@ -304,6 +308,7 @@ def mediapipe_proto_library(
def_java_proto = def_java_proto,
def_jspb_proto = def_jspb_proto,
def_go_proto = def_go_proto,
def_dart_proto = def_dart_proto,
def_options_lib = def_options_lib,
)
@@ -333,6 +338,7 @@ def mediapipe_proto_library(
def_java_proto = def_java_proto,
def_jspb_proto = def_jspb_proto,
def_go_proto = def_go_proto,
def_dart_proto = def_dart_proto,
# A clone of mediapipe_options_library() will redefine some classes.
def_options_lib = False,
)
+1 -1
View File
@@ -60,7 +60,7 @@ std::string GetUnusedSidePacketName(
}
std::string candidate = input_side_packet_name_base;
int iter = 2;
while (mediapipe::ContainsKey(input_side_packets, candidate)) {
while (input_side_packets.contains(candidate)) {
candidate = absl::StrCat(input_side_packet_name_base, "_",
absl::StrFormat("%02d", iter));
++iter;
@@ -27,10 +27,6 @@ namespace options_field_util {
using ::mediapipe::proto_ns::internal::WireFormatLite;
using FieldType = WireFormatLite::FieldType;
using ::mediapipe::proto_ns::io::ArrayInputStream;
using ::mediapipe::proto_ns::io::CodedInputStream;
using ::mediapipe::proto_ns::io::CodedOutputStream;
using ::mediapipe::proto_ns::io::StringOutputStream;
// Utility functions for OptionsFieldUtil.
namespace {
+1 -1
View File
@@ -101,7 +101,7 @@ void TestSuccessTagMap(const std::vector<std::string>& tag_index_names,
EXPECT_EQ(tags.size(), tag_map->Mapping().size())
<< "Parameters: in " << tag_map->DebugString();
for (int i = 0; i < tags.size(); ++i) {
EXPECT_TRUE(mediapipe::ContainsKey(tag_map->Mapping(), tags[i]))
EXPECT_TRUE(tag_map->Mapping().contains(tags[i]))
<< "Parameters: Trying to find \"" << tags[i] << "\" in\n"
<< tag_map->DebugString();
}
+4 -2
View File
@@ -974,7 +974,7 @@ class TemplateParser::Parser::ParserImpl {
}
// Consumes an identifier and saves its value in the identifier parameter.
// Returns false if the token is not of type IDENTFIER.
// Returns false if the token is not of type IDENTIFIER.
bool ConsumeIdentifier(std::string* identifier) {
if (LookingAtType(io::Tokenizer::TYPE_IDENTIFIER)) {
*identifier = tokenizer_.current().text;
@@ -1672,7 +1672,9 @@ class TemplateParser::Parser::MediaPipeParserImpl
if (field_type == ProtoUtilLite::FieldType::TYPE_MESSAGE) {
*args = {""};
} else {
MEDIAPIPE_CHECK_OK(ProtoUtilLite::Serialize({"1"}, field_type, args));
constexpr char kPlaceholderValue[] = "1";
MEDIAPIPE_CHECK_OK(
ProtoUtilLite::Serialize({kPlaceholderValue}, field_type, args));
}
}
+8
View File
@@ -26,6 +26,7 @@
#include "absl/status/status.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
#include "absl/strings/substitute.h"
#include "mediapipe/framework/calculator.pb.h"
@@ -311,6 +312,13 @@ std::unique_ptr<ImageFrame> LoadTestPng(absl::string_view path,
// Returns the path to the output if successful.
absl::StatusOr<std::string> SavePngTestOutput(
const mediapipe::ImageFrame& image, absl::string_view prefix) {
absl::flat_hash_set<ImageFormat::Format> supported_formats = {
ImageFormat::GRAY8, ImageFormat::SRGB, ImageFormat::SRGBA,
ImageFormat::LAB8, ImageFormat::SBGRA};
if (!supported_formats.contains(image.Format())) {
return absl::CancelledError(
absl::StrFormat("Format %d can not be saved to PNG.", image.Format()));
}
std::string now_string = absl::FormatTime(absl::Now());
std::string output_relative_path =
absl::StrCat(prefix, "_", now_string, ".png");
+1 -1
View File
@@ -1,4 +1,4 @@
/* Copyright 2023 The MediaPipe Authors. All Rights Reserved.
/* 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.
+3 -1
View File
@@ -340,7 +340,9 @@ absl::Status GlContext::FinishInitialization(bool create_thread) {
}
LOG(INFO) << "GL version: " << gl_major_version_ << "." << gl_minor_version_
<< " (" << version_string << ")";
<< " (" << version_string
<< "), renderer: " << glGetString(GL_RENDERER);
{
auto status = GetGlExtensions();
if (!status.ok()) {
+2 -2
View File
@@ -454,8 +454,8 @@ class GlContext : public std::enable_shared_from_this<GlContext> {
// Number of glFinish calls completed on the GL thread.
// Changes should be guarded by mutex_. However, we use simple atomic
// loads for efficiency on the fast path.
std::atomic<int64_t> gl_finish_count_ = ATOMIC_VAR_INIT(0);
std::atomic<int64_t> gl_finish_count_target_ = ATOMIC_VAR_INIT(0);
std::atomic<int64_t> gl_finish_count_ = 0;
std::atomic<int64_t> gl_finish_count_target_ = 0;
GlContext* context_waiting_on_ ABSL_GUARDED_BY(mutex_) = nullptr;
+7 -46
View File
@@ -67,53 +67,14 @@ absl::Status GlContext::CreateContextInternal(
// TODO: Investigate this option in more detail, esp. on Safari.
attrs.preserveDrawingBuffer = 0;
// Since the Emscripten canvas target finding function is visible from here,
// we hijack findCanvasEventTarget directly for enforcing old Module.canvas
// behavior if the user desires, falling back to the new DOM element CSS
// selector behavior next if that is specified, and finally just allowing the
// lookup to proceed on a null target.
// TODO: Ensure this works with all options (in particular,
// multithreading options, like the special-case combination of USE_PTHREADS
// and OFFSCREEN_FRAMEBUFFER)
// clang-format off
EM_ASM(
let init_once = true;
if (init_once) {
const cachedFindCanvasEventTarget = findCanvasEventTarget;
if (typeof cachedFindCanvasEventTarget !== 'function') {
if (typeof console !== 'undefined') {
console.error('Expected Emscripten global function '
+ '"findCanvasEventTarget" not found. WebGL context creation '
+ 'may fail.');
}
return;
}
findCanvasEventTarget = function(target) {
if (target == 0) {
if (Module && Module.canvas) {
return Module.canvas;
} else if (Module && Module.canvasCssSelector) {
return cachedFindCanvasEventTarget(Module.canvasCssSelector);
}
if (typeof console !== 'undefined') {
console.warn('Module properties canvas and canvasCssSelector not ' +
'found during WebGL context creation.');
}
}
// We still go through with the find attempt, although for most use
// cases it will not succeed, just in case the user does want to fall-
// back.
return cachedFindCanvasEventTarget(target);
}; // NOLINT: Necessary semicolon.
init_once = false;
}
);
// clang-format on
// Quick patch for -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR so it also
// looks for our #canvas target in Module.canvas, where we expect it to be.
// -s OFFSCREENCANVAS_SUPPORT=1 will no longer work with this under the new
// event target behavior, but it was never supposed to be tapping into our
// canvas anyways. See b/278155946 for more background.
EM_ASM({ specialHTMLTargets["#canvas"] = Module.canvas; });
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context_handle =
emscripten_webgl_create_context(nullptr, &attrs);
emscripten_webgl_create_context("#canvas", &attrs);
// Check for failure
if (context_handle <= 0) {
+1 -1
View File
@@ -64,7 +64,7 @@ std::unique_ptr<GlTextureBuffer> GlTextureBuffer::Create(
int actual_ws = image_frame.WidthStep();
int alignment = 0;
std::unique_ptr<ImageFrame> temp;
const uint8* data = image_frame.PixelData();
const uint8_t* data = image_frame.PixelData();
// Let's see if the pixel data is tightly aligned to one of the alignments
// supported by OpenGL, preferring 4 if possible since it's the default.
@@ -1,4 +1,4 @@
/* Copyright 2023 The MediaPipe Authors. All Rights Reserved.
/* 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.
@@ -1,4 +1,4 @@
/* Copyright 2023 The MediaPipe Authors. All Rights Reserved.
/* 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.
@@ -1,4 +1,4 @@
/* Copyright 2023 The MediaPipe Authors. All Rights Reserved.
/* 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.
@@ -167,7 +167,7 @@ GpuBufferStorageYuvImage::GpuBufferStorageYuvImage(int width, int height,
GpuBufferFormat format) {
libyuv::FourCC fourcc = FourCCForGpuBufferFormat(format);
int y_stride = std::ceil(1.0f * width / kDefaultDataAligment);
auto y_data = std::make_unique<uint8[]>(y_stride * height);
auto y_data = std::make_unique<uint8_t[]>(y_stride * height);
switch (fourcc) {
case libyuv::FOURCC_NV12:
case libyuv::FOURCC_NV21: {
@@ -175,7 +175,7 @@ GpuBufferStorageYuvImage::GpuBufferStorageYuvImage(int width, int height,
int uv_width = 2 * std::ceil(0.5f * width);
int uv_height = std::ceil(0.5f * height);
int uv_stride = std::ceil(1.0f * uv_width / kDefaultDataAligment);
auto uv_data = std::make_unique<uint8[]>(uv_stride * uv_height);
auto uv_data = std::make_unique<uint8_t[]>(uv_stride * uv_height);
yuv_image_ = std::make_shared<YUVImage>(
fourcc, std::move(y_data), y_stride, std::move(uv_data), uv_stride,
nullptr, 0, width, height);
@@ -187,8 +187,8 @@ GpuBufferStorageYuvImage::GpuBufferStorageYuvImage(int width, int height,
int uv_width = std::ceil(0.5f * width);
int uv_height = std::ceil(0.5f * height);
int uv_stride = std::ceil(1.0f * uv_width / kDefaultDataAligment);
auto u_data = std::make_unique<uint8[]>(uv_stride * uv_height);
auto v_data = std::make_unique<uint8[]>(uv_stride * uv_height);
auto u_data = std::make_unique<uint8_t[]>(uv_stride * uv_height);
auto v_data = std::make_unique<uint8_t[]>(uv_stride * uv_height);
yuv_image_ = std::make_shared<YUVImage>(
fourcc, std::move(y_data), y_stride, std::move(u_data), uv_stride,
std::move(v_data), uv_stride, width, height);
+1 -1
View File
@@ -1,4 +1,4 @@
/* Copyright 2023 The MediaPipe Authors. All Rights Reserved.
/* 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.
+2 -1
View File
@@ -31,7 +31,8 @@
namespace mediapipe {
namespace {
void FillImageFrameRGBA(ImageFrame& image, uint8 r, uint8 g, uint8 b, uint8 a) {
void FillImageFrameRGBA(ImageFrame& image, uint8_t r, uint8_t g, uint8_t b,
uint8_t a) {
auto* data = image.MutablePixelData();
for (int y = 0; y < image.Height(); ++y) {
auto* row = data + image.WidthStep() * y;
@@ -14,8 +14,10 @@
package com.google.mediapipe.components;
import javax.annotation.Nullable;
/** Lightweight abstraction for an object that can produce audio data. */
public interface AudioDataProducer {
/** Set the consumer that receives the audio data from this producer. */
void setAudioConsumer(AudioDataConsumer consumer);
void setAudioConsumer(@Nullable AudioDataConsumer consumer);
}
@@ -71,7 +71,10 @@ android_library(
"AudioDataProducer.java",
],
visibility = ["//visibility:public"],
deps = ["@maven//:com_google_guava_guava"],
deps = [
"@maven//:com_google_code_findbugs_jsr305",
"@maven//:com_google_guava_guava",
],
)
# MicrophoneHelper that provides access to audio data from a microphone

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