Compare commits
@@ -87,6 +87,9 @@ build:ios_fat --config=ios
|
|||||||
build:ios_fat --ios_multi_cpus=armv7,arm64
|
build:ios_fat --ios_multi_cpus=armv7,arm64
|
||||||
build:ios_fat --watchos_cpus=armv7k
|
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 --apple_platform_type=macos
|
||||||
build:darwin_x86_64 --macos_minimum_os=10.12
|
build:darwin_x86_64 --macos_minimum_os=10.12
|
||||||
build:darwin_x86_64 --cpu=darwin_x86_64
|
build:darwin_x86_64 --cpu=darwin_x86_64
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
5.2.0
|
6.1.1
|
||||||
|
|||||||
@@ -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.
|
|
||||||
@@ -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"
|
||||||
+1
-1
@@ -61,7 +61,7 @@ RUN pip3 install tf_slim
|
|||||||
RUN ln -s /usr/bin/python3 /usr/bin/python
|
RUN ln -s /usr/bin/python3 /usr/bin/python
|
||||||
|
|
||||||
# Install bazel
|
# Install bazel
|
||||||
ARG BAZEL_VERSION=5.2.0
|
ARG BAZEL_VERSION=6.1.1
|
||||||
RUN mkdir /bazel && \
|
RUN mkdir /bazel && \
|
||||||
wget --no-check-certificate -O /bazel/installer.sh "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/b\
|
wget --no-check-certificate -O /bazel/installer.sh "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/b\
|
||||||
azel-${BAZEL_VERSION}-installer-linux-x86_64.sh" && \
|
azel-${BAZEL_VERSION}-installer-linux-x86_64.sh" && \
|
||||||
|
|||||||
@@ -199,3 +199,20 @@
|
|||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
|
===========================================================================
|
||||||
|
For files under tasks/cc/text/language_detector/custom_ops/utils/utf/
|
||||||
|
===========================================================================
|
||||||
|
/*
|
||||||
|
* The authors of this software are Rob Pike and Ken Thompson.
|
||||||
|
* Copyright (c) 2002 by Lucent Technologies.
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose without fee is hereby granted, provided that this entire notice
|
||||||
|
* is included in all copies of any software which is or includes a copy
|
||||||
|
* or modification of this software and in all copies of the supporting
|
||||||
|
* documentation for such software.
|
||||||
|
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
|
||||||
|
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
|
||||||
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
|
*/
|
||||||
|
|||||||
@@ -1,94 +1,121 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe
|
||||||
title: Home
|
title: Home
|
||||||
nav_order: 1
|
nav_order: 1
|
||||||
---
|
---
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
## Live ML anywhere
|
|
||||||
|
|
||||||
[MediaPipe](https://google.github.io/mediapipe/) offers cross-platform, customizable
|
|
||||||
ML solutions for live and streaming media.
|
|
||||||
|
|
||||||
 | 
|
|
||||||
:------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------:
|
|
||||||
***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 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*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
**Attention:** *Thanks for your interest in MediaPipe! We are moving to
|
**Attention:** *We have moved to
|
||||||
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
as the primary developer documentation
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
site for MediaPipe starting April 3, 2023.*
|
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|

|
||||||
|
|
||||||
----
|
**Attention**: MediaPipe Solutions Preview is an early release. [Learn
|
||||||
|
more](https://developers.google.com/mediapipe/solutions/about#notice).
|
||||||
|
|
||||||
## ML solutions in MediaPipe
|
**On-device machine learning for everyone**
|
||||||
|
|
||||||
Face Detection | Face Mesh | Iris | Hands | Pose | Holistic
|
Delight your customers with innovative machine learning features. MediaPipe
|
||||||
:----------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | :------:
|
contains everything that you need to customize and deploy to mobile (Android,
|
||||||
[](https://google.github.io/mediapipe/solutions/face_detection) | [](https://google.github.io/mediapipe/solutions/face_mesh) | [](https://google.github.io/mediapipe/solutions/iris) | [](https://google.github.io/mediapipe/solutions/hands) | [](https://google.github.io/mediapipe/solutions/pose) | [](https://google.github.io/mediapipe/solutions/holistic)
|
iOS), web, desktop, edge devices, and IoT, effortlessly.
|
||||||
|
|
||||||
Hair Segmentation | Object Detection | Box Tracking | Instant Motion Tracking | Objectron | KNIFT
|
* [See demos](https://goo.gle/mediapipe-studio)
|
||||||
:-------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: | :---:
|
* [Learn more](https://developers.google.com/mediapipe/solutions)
|
||||||
[](https://google.github.io/mediapipe/solutions/hair_segmentation) | [](https://google.github.io/mediapipe/solutions/object_detection) | [](https://google.github.io/mediapipe/solutions/box_tracking) | [](https://google.github.io/mediapipe/solutions/instant_motion_tracking) | [](https://google.github.io/mediapipe/solutions/objectron) | [](https://google.github.io/mediapipe/solutions/knift)
|
|
||||||
|
|
||||||
<!-- []() in the first cell is needed to preserve table formatting in GitHub Pages. -->
|
## Get started
|
||||||
<!-- Whenever this table is updated, paste a copy to solutions/solutions.md. -->
|
|
||||||
|
|
||||||
[]() | [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)
|
You can get started with MediaPipe Solutions by by checking out any of the
|
||||||
:---------------------------------------------------------------------------------------- | :-------------------------------------------------------------: | :-----------------------------------------------------: | :-----------------------------------------------------: | :-----------------------------------------------------------: | :-----------------------------------------------------------: | :--------------------------------------------------------------------:
|
developer guides for
|
||||||
[Face Detection](https://google.github.io/mediapipe/solutions/face_detection) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅
|
[vision](https://developers.google.com/mediapipe/solutions/vision/object_detector),
|
||||||
[Face Mesh](https://google.github.io/mediapipe/solutions/face_mesh) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
[text](https://developers.google.com/mediapipe/solutions/text/text_classifier),
|
||||||
[Iris](https://google.github.io/mediapipe/solutions/iris) | ✅ | ✅ | ✅ | | |
|
and
|
||||||
[Hands](https://google.github.io/mediapipe/solutions/hands) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
[audio](https://developers.google.com/mediapipe/solutions/audio/audio_classifier)
|
||||||
[Pose](https://google.github.io/mediapipe/solutions/pose) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
tasks. If you need help setting up a development environment for use with
|
||||||
[Holistic](https://google.github.io/mediapipe/solutions/holistic) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
MediaPipe Tasks, check out the setup guides for
|
||||||
[Selfie Segmentation](https://google.github.io/mediapipe/solutions/selfie_segmentation) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
[Android](https://developers.google.com/mediapipe/solutions/setup_android), [web
|
||||||
[Hair Segmentation](https://google.github.io/mediapipe/solutions/hair_segmentation) | ✅ | | ✅ | | |
|
apps](https://developers.google.com/mediapipe/solutions/setup_web), and
|
||||||
[Object Detection](https://google.github.io/mediapipe/solutions/object_detection) | ✅ | ✅ | ✅ | | | ✅
|
[Python](https://developers.google.com/mediapipe/solutions/setup_python).
|
||||||
[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) | | | ✅ | | |
|
|
||||||
|
|
||||||
See also
|
## Solutions
|
||||||
[MediaPipe Models and Model Cards](https://google.github.io/mediapipe/solutions/models)
|
|
||||||
for ML models released in MediaPipe.
|
|
||||||
|
|
||||||
## Getting started
|
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.
|
||||||
|
|
||||||
To start using MediaPipe
|
These libraries and resources provide the core functionality for each MediaPipe
|
||||||
[solutions](https://google.github.io/mediapipe/solutions/solutions) with only a few
|
Solution:
|
||||||
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).
|
|
||||||
|
|
||||||
To use MediaPipe in C++, Android and iOS, which allow further customization of
|
* **MediaPipe Tasks**: Cross-platform APIs and libraries for deploying
|
||||||
the [solutions](https://google.github.io/mediapipe/solutions/solutions) as well as
|
solutions. [Learn
|
||||||
building your own, learn how to
|
more](https://developers.google.com/mediapipe/solutions/tasks).
|
||||||
[install](https://google.github.io/mediapipe/getting_started/install) MediaPipe and
|
* **MediaPipe models**: Pre-trained, ready-to-run models for use with each
|
||||||
start building example applications in
|
solution.
|
||||||
[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).
|
|
||||||
|
|
||||||
The source code is hosted in the
|
These tools let you customize and evaluate solutions:
|
||||||
[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).
|
|
||||||
|
|
||||||
## Publications
|
* **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).
|
||||||
|
|
||||||
|
### Legacy solutions
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
For more on the legacy solutions, see the [documentation](https://github.com/google/mediapipe/tree/master/docs/solutions).
|
||||||
|
|
||||||
|
## Framework
|
||||||
|
|
||||||
|
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)
|
* [Bringing artworks to life with AR](https://developers.googleblog.com/2021/07/bringing-artworks-to-life-with-ar.html)
|
||||||
in Google Developers Blog
|
in Google Developers Blog
|
||||||
@@ -97,7 +124,8 @@ run code search using
|
|||||||
* [SignAll SDK: Sign language interface using MediaPipe is now available for
|
* [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)
|
developers](https://developers.googleblog.com/2021/04/signall-sdk-sign-language-interface-using-mediapipe-now-available.html)
|
||||||
in Google Developers Blog
|
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
|
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)
|
* [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
|
in Google AI Blog
|
||||||
@@ -125,43 +153,6 @@ run code search using
|
|||||||
in Google AI Blog
|
in Google AI Blog
|
||||||
* [MediaPipe: A Framework for Building Perception Pipelines](https://arxiv.org/abs/1906.08172)
|
* [MediaPipe: A Framework for Building Perception Pipelines](https://arxiv.org/abs/1906.08172)
|
||||||
|
|
||||||
## Videos
|
### Videos
|
||||||
|
|
||||||
* [YouTube Channel](https://www.youtube.com/c/MediaPipe)
|
* [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.
|
|
||||||
|
|||||||
@@ -54,6 +54,76 @@ load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependen
|
|||||||
|
|
||||||
rules_foreign_cc_dependencies()
|
rules_foreign_cc_dependencies()
|
||||||
|
|
||||||
|
http_archive(
|
||||||
|
name = "com_google_protobuf",
|
||||||
|
sha256 = "87407cd28e7a9c95d9f61a098a53cf031109d451a7763e7dd1253abf8b4df422",
|
||||||
|
strip_prefix = "protobuf-3.19.1",
|
||||||
|
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.1.tar.gz"],
|
||||||
|
patches = [
|
||||||
|
"@//third_party:com_google_protobuf_fixes.diff"
|
||||||
|
],
|
||||||
|
patch_args = [
|
||||||
|
"-p1",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
# Load Zlib before initializing TensorFlow and the iOS build rules to guarantee
|
||||||
|
# that the target @zlib//:mini_zlib is available
|
||||||
|
http_archive(
|
||||||
|
name = "zlib",
|
||||||
|
build_file = "@//third_party:zlib.BUILD",
|
||||||
|
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
|
||||||
|
strip_prefix = "zlib-1.2.11",
|
||||||
|
urls = [
|
||||||
|
"http://mirror.bazel.build/zlib.net/fossils/zlib-1.2.11.tar.gz",
|
||||||
|
"http://zlib.net/fossils/zlib-1.2.11.tar.gz", # 2017-01-15
|
||||||
|
],
|
||||||
|
patches = [
|
||||||
|
"@//third_party:zlib.diff",
|
||||||
|
],
|
||||||
|
patch_args = [
|
||||||
|
"-p1",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
# iOS basic build deps.
|
||||||
|
http_archive(
|
||||||
|
name = "build_bazel_rules_apple",
|
||||||
|
sha256 = "3e2c7ae0ddd181c4053b6491dad1d01ae29011bc322ca87eea45957c76d3a0c3",
|
||||||
|
url = "https://github.com/bazelbuild/rules_apple/releases/download/2.1.0/rules_apple.2.1.0.tar.gz",
|
||||||
|
patches = [
|
||||||
|
# Bypass checking ios unit test runner when building MP ios applications.
|
||||||
|
"@//third_party:build_bazel_rules_apple_bypass_test_runner_check.diff"
|
||||||
|
],
|
||||||
|
patch_args = [
|
||||||
|
"-p1",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@build_bazel_rules_apple//apple:repositories.bzl",
|
||||||
|
"apple_rules_dependencies",
|
||||||
|
)
|
||||||
|
apple_rules_dependencies()
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@build_bazel_rules_swift//swift:repositories.bzl",
|
||||||
|
"swift_rules_dependencies",
|
||||||
|
)
|
||||||
|
swift_rules_dependencies()
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@build_bazel_rules_swift//swift:extras.bzl",
|
||||||
|
"swift_rules_extra_dependencies",
|
||||||
|
)
|
||||||
|
swift_rules_extra_dependencies()
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@build_bazel_apple_support//lib:repositories.bzl",
|
||||||
|
"apple_support_dependencies",
|
||||||
|
)
|
||||||
|
apple_support_dependencies()
|
||||||
|
|
||||||
# This is used to select all contents of the archives for CMake-based packages to give CMake access to them.
|
# This is used to select all contents of the archives for CMake-based packages to give CMake access to them.
|
||||||
all_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])"""
|
all_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])"""
|
||||||
|
|
||||||
@@ -133,19 +203,6 @@ http_archive(
|
|||||||
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.1.tar.gz"],
|
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.1.tar.gz"],
|
||||||
)
|
)
|
||||||
|
|
||||||
http_archive(
|
|
||||||
name = "com_google_protobuf",
|
|
||||||
sha256 = "87407cd28e7a9c95d9f61a098a53cf031109d451a7763e7dd1253abf8b4df422",
|
|
||||||
strip_prefix = "protobuf-3.19.1",
|
|
||||||
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.1.tar.gz"],
|
|
||||||
patches = [
|
|
||||||
"@//third_party:com_google_protobuf_fixes.diff"
|
|
||||||
],
|
|
||||||
patch_args = [
|
|
||||||
"-p1",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
load("@//third_party/flatbuffers:workspace.bzl", flatbuffers = "repo")
|
load("@//third_party/flatbuffers:workspace.bzl", flatbuffers = "repo")
|
||||||
flatbuffers()
|
flatbuffers()
|
||||||
|
|
||||||
@@ -155,6 +212,9 @@ http_archive(
|
|||||||
urls = ["https://github.com/google/multichannel-audio-tools/archive/1f6b1319f13282eda6ff1317be13de67f4723860.zip"],
|
urls = ["https://github.com/google/multichannel-audio-tools/archive/1f6b1319f13282eda6ff1317be13de67f4723860.zip"],
|
||||||
sha256 = "fe346e1aee4f5069c4cbccb88706a9a2b2b4cf98aeb91ec1319be77e07dd7435",
|
sha256 = "fe346e1aee4f5069c4cbccb88706a9a2b2b4cf98aeb91ec1319be77e07dd7435",
|
||||||
repo_mapping = {"@com_github_glog_glog" : "@com_github_glog_glog_no_gflags"},
|
repo_mapping = {"@com_github_glog_glog" : "@com_github_glog_glog_no_gflags"},
|
||||||
|
# TODO: Fix this in AudioTools directly
|
||||||
|
patches = ["@//third_party:com_google_audio_tools_fixes.diff"],
|
||||||
|
patch_args = ["-p1"]
|
||||||
)
|
)
|
||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
@@ -179,6 +239,16 @@ http_archive(
|
|||||||
repo_mapping = {"@com_google_glog" : "@com_github_glog_glog_no_gflags"},
|
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(
|
http_archive(
|
||||||
name = "org_tensorflow_text",
|
name = "org_tensorflow_text",
|
||||||
sha256 = "f64647276f7288d1b1fe4c89581d51404d0ce4ae97f2bcc4c19bd667549adca8",
|
sha256 = "f64647276f7288d1b1fe4c89581d51404d0ce4ae97f2bcc4c19bd667549adca8",
|
||||||
@@ -196,10 +266,10 @@ http_archive(
|
|||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "com_googlesource_code_re2",
|
name = "com_googlesource_code_re2",
|
||||||
sha256 = "e06b718c129f4019d6e7aa8b7631bee38d3d450dd980246bfaf493eb7db67868",
|
sha256 = "ef516fb84824a597c4d5d0d6d330daedb18363b5a99eda87d027e6bdd9cba299",
|
||||||
strip_prefix = "re2-fe4a310131c37f9a7e7f7816fa6ce2a8b27d65a8",
|
strip_prefix = "re2-03da4fc0857c285e3a26782f6bc8931c4c950df4",
|
||||||
urls = [
|
urls = [
|
||||||
"https://github.com/google/re2/archive/fe4a310131c37f9a7e7f7816fa6ce2a8b27d65a8.tar.gz",
|
"https://github.com/google/re2/archive/03da4fc0857c285e3a26782f6bc8931c4c950df4.tar.gz",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -270,7 +340,7 @@ new_local_repository(
|
|||||||
# For local MacOS builds, the path should point to an opencv@3 installation.
|
# For local MacOS builds, the path should point to an opencv@3 installation.
|
||||||
# If you edit the path here, you will also need to update the corresponding
|
# If you edit the path here, you will also need to update the corresponding
|
||||||
# prefix in "opencv_macos.BUILD".
|
# prefix in "opencv_macos.BUILD".
|
||||||
path = "/usr/local",
|
path = "/usr/local", # e.g. /usr/local/Cellar for HomeBrew
|
||||||
)
|
)
|
||||||
|
|
||||||
new_local_repository(
|
new_local_repository(
|
||||||
@@ -305,6 +375,22 @@ http_archive(
|
|||||||
url = "https://github.com/opencv/opencv/releases/download/3.2.0/opencv-3.2.0-ios-framework.zip",
|
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(
|
http_archive(
|
||||||
name = "stblib",
|
name = "stblib",
|
||||||
strip_prefix = "stb-b42009b3b9d4ca35bc703f5310eedc74f584be58",
|
strip_prefix = "stb-b42009b3b9d4ca35bc703f5310eedc74f584be58",
|
||||||
@@ -319,63 +405,6 @@ http_archive(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Load Zlib before initializing TensorFlow and the iOS build rules to guarantee
|
|
||||||
# that the target @zlib//:mini_zlib is available
|
|
||||||
http_archive(
|
|
||||||
name = "zlib",
|
|
||||||
build_file = "@//third_party:zlib.BUILD",
|
|
||||||
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
|
|
||||||
strip_prefix = "zlib-1.2.11",
|
|
||||||
urls = [
|
|
||||||
"http://mirror.bazel.build/zlib.net/fossils/zlib-1.2.11.tar.gz",
|
|
||||||
"http://zlib.net/fossils/zlib-1.2.11.tar.gz", # 2017-01-15
|
|
||||||
],
|
|
||||||
patches = [
|
|
||||||
"@//third_party:zlib.diff",
|
|
||||||
],
|
|
||||||
patch_args = [
|
|
||||||
"-p1",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
# iOS basic build deps.
|
|
||||||
http_archive(
|
|
||||||
name = "build_bazel_rules_apple",
|
|
||||||
sha256 = "f94e6dddf74739ef5cb30f000e13a2a613f6ebfa5e63588305a71fce8a8a9911",
|
|
||||||
url = "https://github.com/bazelbuild/rules_apple/releases/download/1.1.3/rules_apple.1.1.3.tar.gz",
|
|
||||||
patches = [
|
|
||||||
# Bypass checking ios unit test runner when building MP ios applications.
|
|
||||||
"@//third_party:build_bazel_rules_apple_bypass_test_runner_check.diff"
|
|
||||||
],
|
|
||||||
patch_args = [
|
|
||||||
"-p1",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
load(
|
|
||||||
"@build_bazel_rules_apple//apple:repositories.bzl",
|
|
||||||
"apple_rules_dependencies",
|
|
||||||
)
|
|
||||||
apple_rules_dependencies()
|
|
||||||
|
|
||||||
load(
|
|
||||||
"@build_bazel_rules_swift//swift:repositories.bzl",
|
|
||||||
"swift_rules_dependencies",
|
|
||||||
)
|
|
||||||
swift_rules_dependencies()
|
|
||||||
|
|
||||||
load(
|
|
||||||
"@build_bazel_rules_swift//swift:extras.bzl",
|
|
||||||
"swift_rules_extra_dependencies",
|
|
||||||
)
|
|
||||||
swift_rules_extra_dependencies()
|
|
||||||
|
|
||||||
load(
|
|
||||||
"@build_bazel_apple_support//lib:repositories.bzl",
|
|
||||||
"apple_support_dependencies",
|
|
||||||
)
|
|
||||||
apple_support_dependencies()
|
|
||||||
|
|
||||||
# More iOS deps.
|
# More iOS deps.
|
||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
@@ -455,9 +484,9 @@ http_archive(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# TensorFlow repo should always go after the other external dependencies.
|
# TensorFlow repo should always go after the other external dependencies.
|
||||||
# TF on 2023-03-08.
|
# TF on 2023-05-26.
|
||||||
_TENSORFLOW_GIT_COMMIT = "24f7ee636d62e1f8d8330357f8bbd65956dfb84d"
|
_TENSORFLOW_GIT_COMMIT = "67d5c561981edc45daf3f9d73ddd1a77963733ca"
|
||||||
_TENSORFLOW_SHA256 = "7f8a96dd99215c0cdc77230d3dbce43e60102b64a89203ad04aa09b0a187a4bd"
|
_TENSORFLOW_SHA256 = "0c8326285e9cb695313e194b97d388eea70bf8bf5b13e8f0962ca8eed5179ece"
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "org_tensorflow",
|
name = "org_tensorflow",
|
||||||
urls = [
|
urls = [
|
||||||
@@ -499,8 +528,8 @@ cc_crosstool(name = "crosstool")
|
|||||||
# Node dependencies
|
# Node dependencies
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "build_bazel_rules_nodejs",
|
name = "build_bazel_rules_nodejs",
|
||||||
sha256 = "5aae76dced38f784b58d9776e4ab12278bc156a9ed2b1d9fcd3e39921dc88fda",
|
sha256 = "94070eff79305be05b7699207fbac5d2608054dd53e6109f7d00d923919ff45a",
|
||||||
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.7.1/rules_nodejs-5.7.1.tar.gz"],
|
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-5.8.2.tar.gz"],
|
||||||
)
|
)
|
||||||
|
|
||||||
load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
|
load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
|
||||||
@@ -554,32 +583,32 @@ new_local_repository(
|
|||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "linux_halide",
|
name = "linux_halide",
|
||||||
sha256 = "f62b2914823d6e33d18693f5b74484f274523bf5402ce51988e24393d123b375",
|
sha256 = "d290fadf3f358c94aacf43c883de6468bb98883e26116920afd491ec0e440cd2",
|
||||||
strip_prefix = "Halide-15.0.0-x86-64-linux",
|
strip_prefix = "Halide-15.0.1-x86-64-linux",
|
||||||
urls = ["https://github.com/halide/Halide/releases/download/v15.0.0/Halide-15.0.0-x86-64-linux-d7651f4b32f9dbd764f243134001f7554378d62d.tar.gz"],
|
urls = ["https://github.com/halide/Halide/releases/download/v15.0.1/Halide-15.0.1-x86-64-linux-4c63f1befa1063184c5982b11b6a2cc17d4e5815.tar.gz"],
|
||||||
build_file = "@//third_party:halide.BUILD",
|
build_file = "@//third_party:halide.BUILD",
|
||||||
)
|
)
|
||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "macos_x86_64_halide",
|
name = "macos_x86_64_halide",
|
||||||
sha256 = "3d832aed942080ea89aa832462c68fbb906f3055c440b7b6d35093d7c52f6aab",
|
sha256 = "48ff073ac1aee5c4aca941a4f043cac64b38ba236cdca12567e09d803594a61c",
|
||||||
strip_prefix = "Halide-15.0.0-x86-64-osx",
|
strip_prefix = "Halide-15.0.1-x86-64-osx",
|
||||||
urls = ["https://github.com/halide/Halide/releases/download/v15.0.0/Halide-15.0.0-x86-64-osx-d7651f4b32f9dbd764f243134001f7554378d62d.tar.gz"],
|
urls = ["https://github.com/halide/Halide/releases/download/v15.0.1/Halide-15.0.1-x86-64-osx-4c63f1befa1063184c5982b11b6a2cc17d4e5815.tar.gz"],
|
||||||
build_file = "@//third_party:halide.BUILD",
|
build_file = "@//third_party:halide.BUILD",
|
||||||
)
|
)
|
||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "macos_arm_64_halide",
|
name = "macos_arm_64_halide",
|
||||||
sha256 = "b1fad3c9810122b187303d7031d9e35fb43761f345d18cc4492c00ed5877f641",
|
sha256 = "db5d20d75fa7463490fcbc79c89f0abec9c23991f787c8e3e831fff411d5395c",
|
||||||
strip_prefix = "Halide-15.0.0-arm-64-osx",
|
strip_prefix = "Halide-15.0.1-arm-64-osx",
|
||||||
urls = ["https://github.com/halide/Halide/releases/download/v15.0.0/Halide-15.0.0-arm-64-osx-d7651f4b32f9dbd764f243134001f7554378d62d.tar.gz"],
|
urls = ["https://github.com/halide/Halide/releases/download/v15.0.1/Halide-15.0.1-arm-64-osx-4c63f1befa1063184c5982b11b6a2cc17d4e5815.tar.gz"],
|
||||||
build_file = "@//third_party:halide.BUILD",
|
build_file = "@//third_party:halide.BUILD",
|
||||||
)
|
)
|
||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "windows_halide",
|
name = "windows_halide",
|
||||||
sha256 = "5acf6fe161dd375856a2b43f4bb0a32815ba958b0585ee312c44e008aa7b0b64",
|
sha256 = "61fd049bd75ee918ac6c30d0693aac6048f63f8d1fc4db31001573e58eae8dae",
|
||||||
strip_prefix = "Halide-15.0.0-x86-64-windows",
|
strip_prefix = "Halide-15.0.1-x86-64-windows",
|
||||||
urls = ["https://github.com/halide/Halide/releases/download/v15.0.0/Halide-15.0.0-x86-64-windows-d7651f4b32f9dbd764f243134001f7554378d62d.zip"],
|
urls = ["https://github.com/halide/Halide/releases/download/v15.0.1/Halide-15.0.1-x86-64-windows-4c63f1befa1063184c5982b11b6a2cc17d4e5815.zip"],
|
||||||
build_file = "@//third_party:halide.BUILD",
|
build_file = "@//third_party:halide.BUILD",
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-2
@@ -16,11 +16,11 @@ py_binary(
|
|||||||
srcs = ["build_java_api_docs.py"],
|
srcs = ["build_java_api_docs.py"],
|
||||||
data = [
|
data = [
|
||||||
"//third_party/android/sdk:api/26.txt",
|
"//third_party/android/sdk:api/26.txt",
|
||||||
"//third_party/java/doclava/current:doclava.jar",
|
"//third_party/java/doclava:doclet.jar",
|
||||||
"//third_party/java/jsilver:jsilver_jar",
|
"//third_party/java/jsilver:jsilver_jar",
|
||||||
],
|
],
|
||||||
env = {
|
env = {
|
||||||
"DOCLAVA_JAR": "$(location //third_party/java/doclava/current:doclava.jar)",
|
"DOCLAVA_JAR": "$(location //third_party/java/doclava:doclet.jar)",
|
||||||
"JSILVER_JAR": "$(location //third_party/java/jsilver:jsilver_jar)",
|
"JSILVER_JAR": "$(location //third_party/java/jsilver:jsilver_jar)",
|
||||||
},
|
},
|
||||||
deps = [
|
deps = [
|
||||||
|
|||||||
@@ -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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
"""Generate Java reference docs for MediaPipe."""
|
"""Generate Java reference docs for MediaPipe."""
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import shutil
|
||||||
|
|
||||||
from absl import app
|
from absl import app
|
||||||
from absl import flags
|
from absl import flags
|
||||||
@@ -41,7 +42,9 @@ def main(_) -> None:
|
|||||||
mp_root = pathlib.Path(__file__)
|
mp_root = pathlib.Path(__file__)
|
||||||
while (mp_root := mp_root.parent).name != 'mediapipe':
|
while (mp_root := mp_root.parent).name != 'mediapipe':
|
||||||
# Find the nearest `mediapipe` dir.
|
# 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.
|
# Find the root from which all packages are relative.
|
||||||
root = mp_root.parent
|
root = mp_root.parent
|
||||||
@@ -51,6 +54,14 @@ def main(_) -> None:
|
|||||||
if (mp_root / 'mediapipe').exists():
|
if (mp_root / 'mediapipe').exists():
|
||||||
mp_root = mp_root / 'mediapipe'
|
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(
|
gen_java.gen_java_docs(
|
||||||
package='com.google.mediapipe',
|
package='com.google.mediapipe',
|
||||||
source_path=mp_root / 'tasks/java',
|
source_path=mp_root / 'tasks/java',
|
||||||
|
|||||||
@@ -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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with 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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/framework/framework_concepts/graphs_cpp
|
||||||
title: Building Graphs in C++
|
title: Building Graphs in C++
|
||||||
parent: Graphs
|
parent: Graphs
|
||||||
nav_order: 1
|
nav_order: 1
|
||||||
@@ -12,6 +13,12 @@ nav_order: 1
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
C++ graph builder is a powerful tool for:
|
C++ graph builder is a powerful tool for:
|
||||||
|
|
||||||
* Building complex graphs
|
* Building complex graphs
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 1
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
Each calculator is a node of a graph. We describe how to create a new
|
Each calculator is a node of a graph. We describe how to create a new
|
||||||
calculator, how to initialize a calculator, how to perform its calculations,
|
calculator, how to initialize a calculator, how to perform its calculations,
|
||||||
input and output streams, timestamps, and options. Each node in the graph is
|
input and output streams, timestamps, and options. Each node in the graph is
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ has_toc: false
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## The basics
|
## The basics
|
||||||
|
|
||||||
### Packet
|
### Packet
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 5
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
MediaPipe supports calculator nodes for GPU compute and rendering, and allows combining multiple GPU nodes, as well as mixing them with CPU based calculator nodes. There exist several GPU APIs on mobile platforms (eg, OpenGL ES, Metal and Vulkan). MediaPipe does not attempt to offer a single cross-API GPU abstraction. Individual nodes can be written using different APIs, allowing them to take advantage of platform specific features when needed.
|
MediaPipe supports calculator nodes for GPU compute and rendering, and allows combining multiple GPU nodes, as well as mixing them with CPU based calculator nodes. There exist several GPU APIs on mobile platforms (eg, OpenGL ES, Metal and Vulkan). MediaPipe does not attempt to offer a single cross-API GPU abstraction. Individual nodes can be written using different APIs, allowing them to take advantage of platform specific features when needed.
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 2
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## Graph
|
## Graph
|
||||||
|
|
||||||
A `CalculatorGraphConfig` proto specifies the topology and functionality of a
|
A `CalculatorGraphConfig` proto specifies the topology and functionality of a
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 3
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
Calculators communicate by sending and receiving packets. Typically a single
|
Calculators communicate by sending and receiving packets. Typically a single
|
||||||
packet is sent along each input stream at each input timestamp. A packet can
|
packet is sent along each input stream at each input timestamp. A packet can
|
||||||
contain any kind of data, such as a single frame of video or a single integer
|
contain any kind of data, such as a single frame of video or a single integer
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 6
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## Real-time timestamps
|
## Real-time timestamps
|
||||||
|
|
||||||
MediaPipe calculator graphs are often used to process streams of video or audio
|
MediaPipe calculator graphs are often used to process streams of video or audio
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 4
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## Scheduling mechanics
|
## Scheduling mechanics
|
||||||
|
|
||||||
Data processing in a MediaPipe graph occurs inside processing nodes defined as
|
Data processing in a MediaPipe graph occurs inside processing nodes defined as
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ nav_order: 1
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
Please follow instructions below to build Android example apps in the supported
|
Please follow instructions below to build Android example apps in the supported
|
||||||
MediaPipe [solutions](../solutions/solutions.md). To learn more about these
|
MediaPipe [solutions](../solutions/solutions.md). To learn more about these
|
||||||
example apps, start from [Hello World! on Android](./hello_world_android.md).
|
example apps, start from [Hello World! on Android](./hello_world_android.md).
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ nav_order: 3
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
***Experimental Only***
|
***Experimental Only***
|
||||||
|
|
||||||
The MediaPipe Android Archive (AAR) library is a convenient way to use MediaPipe
|
The MediaPipe Android Archive (AAR) library is a convenient way to use MediaPipe
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/
|
||||||
title: MediaPipe Android Solutions
|
title: MediaPipe Android Solutions
|
||||||
parent: MediaPipe on Android
|
parent: MediaPipe on Android
|
||||||
grand_parent: Getting Started
|
grand_parent: Getting Started
|
||||||
@@ -13,14 +14,9 @@ nav_order: 2
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thanks for your interest in MediaPipe! We are moving to
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
as the primary developer documentation
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
site for MediaPipe starting April 3, 2023. This content will not be moved to
|
|
||||||
the new site, but will remain available in the source code repository on an
|
|
||||||
as-is basis.*
|
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/
|
||||||
title: Building MediaPipe Examples
|
title: Building MediaPipe Examples
|
||||||
parent: Getting Started
|
parent: Getting Started
|
||||||
nav_exclude: true
|
nav_exclude: true
|
||||||
@@ -12,14 +13,9 @@ nav_exclude: true
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thanks for your interest in MediaPipe! We are moving to
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
as the primary developer documentation
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
site for MediaPipe starting April 3, 2023. This content will not be moved to
|
|
||||||
the new site, but will remain available in the source code repository on an
|
|
||||||
as-is basis.*
|
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ nav_order: 5
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
Please follow instructions below to build C++ command-line example apps in the
|
Please follow instructions below to build C++ command-line example apps in the
|
||||||
supported MediaPipe [solutions](../solutions/solutions.md). To learn more about
|
supported MediaPipe [solutions](../solutions/solutions.md). To learn more about
|
||||||
these example apps, start from [Hello World! in C++](./hello_world_cpp.md).
|
these example apps, start from [Hello World! in C++](./hello_world_cpp.md).
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 9
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
### How to convert ImageFrames and GpuBuffers
|
### How to convert ImageFrames and GpuBuffers
|
||||||
|
|
||||||
The Calculators [`ImageFrameToGpuBufferCalculator`] and
|
The Calculators [`ImageFrameToGpuBufferCalculator`] and
|
||||||
@@ -47,7 +53,7 @@ calculators need only to be *thread-compatible* and not *thread-safe*.
|
|||||||
In order to enable one calculator to process multiple inputs in parallel, there
|
In order to enable one calculator to process multiple inputs in parallel, there
|
||||||
are two possible approaches:
|
are two possible approaches:
|
||||||
|
|
||||||
1. Define multiple calulator nodes and dispatch input packets to all nodes.
|
1. Define multiple calculator nodes and dispatch input packets to all nodes.
|
||||||
2. Make the calculator thread-safe and configure its [`max_in_flight`] setting.
|
2. Make the calculator thread-safe and configure its [`max_in_flight`] setting.
|
||||||
|
|
||||||
The first approach can be followed using the calculators designed to distribute
|
The first approach can be followed using the calculators designed to distribute
|
||||||
@@ -89,12 +95,12 @@ while the application is running:
|
|||||||
The first approach has the advantage of leveraging [`CalculatorGraphConfig`]
|
The first approach has the advantage of leveraging [`CalculatorGraphConfig`]
|
||||||
processing tools such as "subgraphs". The second approach has the advantage of
|
processing tools such as "subgraphs". The second approach has the advantage of
|
||||||
allowing active calculators and packets to remain in-flight while settings
|
allowing active calculators and packets to remain in-flight while settings
|
||||||
change. Mediapipe contributors are currently investigating alternative approaches
|
change. MediaPipe contributors are currently investigating alternative approaches
|
||||||
to achieve both of these advantages.
|
to achieve both of these advantages.
|
||||||
|
|
||||||
### How to process realtime input streams
|
### How to process realtime input streams
|
||||||
|
|
||||||
The mediapipe framework can be used to process data streams either online or
|
The MediaPipe framework can be used to process data streams either online or
|
||||||
offline. For offline processing, packets are pushed into the graph as soon as
|
offline. For offline processing, packets are pushed into the graph as soon as
|
||||||
calculators are ready to process those packets. For online processing, one
|
calculators are ready to process those packets. For online processing, one
|
||||||
packet for each frame is pushed into the graph as that frame is recorded.
|
packet for each frame is pushed into the graph as that frame is recorded.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/
|
||||||
title: Getting Started
|
title: Getting Started
|
||||||
nav_order: 2
|
nav_order: 2
|
||||||
has_children: true
|
has_children: true
|
||||||
@@ -12,13 +13,8 @@ has_children: true
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thanks for your interest in MediaPipe! We are moving to
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
as the primary developer documentation
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
site for MediaPipe starting April 3, 2023. This content will not be moved to
|
|
||||||
the new site, but will remain available in the source code repository on an
|
|
||||||
as-is basis.*
|
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 7
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## OpenGL ES Support
|
## OpenGL ES Support
|
||||||
|
|
||||||
MediaPipe supports OpenGL ES up to version 3.2 on Android/Linux and up to ES 3.0
|
MediaPipe supports OpenGL ES up to version 3.2 on Android/Linux and up to ES 3.0
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ nav_order: 1
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
This codelab uses MediaPipe on an Android device.
|
This codelab uses MediaPipe on an Android device.
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ nav_order: 1
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
1. Ensure you have a working version of MediaPipe. See
|
1. Ensure you have a working version of MediaPipe. See
|
||||||
[installation instructions](./install.md).
|
[installation instructions](./install.md).
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ nav_order: 1
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
This codelab uses MediaPipe on an iOS device.
|
This codelab uses MediaPipe on an iOS device.
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 8
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## Technical questions
|
## Technical questions
|
||||||
|
|
||||||
For help with technical or algorithmic questions, visit
|
For help with technical or algorithmic questions, visit
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 6
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
Note: To interoperate with OpenCV, OpenCV 3.x to 4.1 are preferred. OpenCV
|
Note: To interoperate with OpenCV, OpenCV 3.x to 4.1 are preferred. OpenCV
|
||||||
2.x currently works but interoperability support may be deprecated in the
|
2.x currently works but interoperability support may be deprecated in the
|
||||||
future.
|
future.
|
||||||
@@ -577,7 +583,7 @@ next section.
|
|||||||
|
|
||||||
Option 1. Follow
|
Option 1. Follow
|
||||||
[the official Bazel documentation](https://docs.bazel.build/versions/master/install-windows.html)
|
[the official Bazel documentation](https://docs.bazel.build/versions/master/install-windows.html)
|
||||||
to install Bazel 5.2.0 or higher.
|
to install Bazel 6.1.1 or higher.
|
||||||
|
|
||||||
Option 2. Follow the official
|
Option 2. Follow the official
|
||||||
[Bazel documentation](https://docs.bazel.build/versions/master/install-bazelisk.html)
|
[Bazel documentation](https://docs.bazel.build/versions/master/install-bazelisk.html)
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ nav_order: 2
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
Please follow instructions below to build iOS example apps in the supported
|
Please follow instructions below to build iOS example apps in the supported
|
||||||
MediaPipe [solutions](../solutions/solutions.md). To learn more about these
|
MediaPipe [solutions](../solutions/solutions.md). To learn more about these
|
||||||
example apps, start from, start from
|
example apps, start from, start from
|
||||||
@@ -114,8 +120,8 @@ allows you to make use of automatic provisioning (see later section).
|
|||||||
To install applications on an iOS device, you need a provisioning profile. There
|
To install applications on an iOS device, you need a provisioning profile. There
|
||||||
are two options:
|
are two options:
|
||||||
|
|
||||||
1. Automatic provisioning. This allows you to build and install an app to your
|
1. Automatic provisioning. This allows you to build and install an app on your
|
||||||
personal device. The provisining profile is managed by Xcode, and has to be
|
personal device. The provisioning profile is managed by Xcode, and has to be
|
||||||
updated often (it is valid for about a week).
|
updated often (it is valid for about a week).
|
||||||
|
|
||||||
2. Custom provisioning. This uses a provisioning profile associated with an
|
2. Custom provisioning. This uses a provisioning profile associated with an
|
||||||
@@ -180,7 +186,7 @@ Profiles"`. If there are none, generate and download a profile on
|
|||||||
Note: if you had previously set up automatic provisioning, you should remove the
|
Note: if you had previously set up automatic provisioning, you should remove the
|
||||||
`provisioning_profile.mobileprovision` symlink in each example's directory,
|
`provisioning_profile.mobileprovision` symlink in each example's directory,
|
||||||
since it will take precedence over the common one. You can also overwrite it
|
since it will take precedence over the common one. You can also overwrite it
|
||||||
with you own profile if you need a different profile for different apps.
|
with your own profile if you need a different profile for different apps.
|
||||||
|
|
||||||
1. Open `mediapipe/examples/ios/bundle_id.bzl`, and change the
|
1. Open `mediapipe/examples/ios/bundle_id.bzl`, and change the
|
||||||
`BUNDLE_ID_PREFIX` to a prefix associated with your provisioning profile.
|
`BUNDLE_ID_PREFIX` to a prefix associated with your provisioning profile.
|
||||||
@@ -197,7 +203,7 @@ Note: When you ask Xcode to run an app, by default it will use the Debug
|
|||||||
configuration. Some of our demos are computationally heavy; you may want to use
|
configuration. Some of our demos are computationally heavy; you may want to use
|
||||||
the Release configuration for better performance.
|
the Release configuration for better performance.
|
||||||
|
|
||||||
Note: Due to an imcoptibility caused by one of our dependencies, MediaPipe
|
Note: Due to an incompatibility caused by one of our dependencies, MediaPipe
|
||||||
cannot be used for apps running on the iPhone Simulator on Apple Silicon (M1).
|
cannot be used for apps running on the iPhone Simulator on Apple Silicon (M1).
|
||||||
|
|
||||||
Tip: To switch build configuration in Xcode, click on the target menu, choose
|
Tip: To switch build configuration in Xcode, click on the target menu, choose
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/
|
||||||
title: MediaPipe in JavaScript
|
title: MediaPipe in JavaScript
|
||||||
parent: Getting Started
|
parent: Getting Started
|
||||||
nav_order: 4
|
nav_order: 4
|
||||||
@@ -14,12 +15,7 @@ nav_order: 4
|
|||||||
|
|
||||||
**Attention:** *Thanks for your interest in MediaPipe! We are moving to
|
**Attention:** *Thanks for your interest in MediaPipe! We are moving to
|
||||||
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
as the primary developer documentation
|
as the primary developer documentation site for MediaPipe starting April 3, 2023.*
|
||||||
site for MediaPipe starting April 3, 2023. This content will not be moved to
|
|
||||||
the new site, but will remain available in the source code repository on an
|
|
||||||
as-is basis.*
|
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/
|
||||||
title: MediaPipe in Python
|
title: MediaPipe in Python
|
||||||
parent: Getting Started
|
parent: Getting Started
|
||||||
has_children: true
|
has_children: true
|
||||||
@@ -14,6 +15,12 @@ nav_order: 3
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## Ready-to-use Python Solutions
|
## Ready-to-use Python Solutions
|
||||||
|
|
||||||
MediaPipe offers ready-to-use yet customizable Python solutions as a prebuilt
|
MediaPipe offers ready-to-use yet customizable Python solutions as a prebuilt
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ nav_order: 1
|
|||||||
1. TOC
|
1. TOC
|
||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
The MediaPipe Python framework grants direct access to the core components of
|
The MediaPipe Python framework grants direct access to the core components of
|
||||||
the MediaPipe C++ framework such as Timestamp, Packet, and CalculatorGraph,
|
the MediaPipe C++ framework such as Timestamp, Packet, and CalculatorGraph,
|
||||||
@@ -76,7 +81,7 @@ np.ndarray | mp::Matrix | create_ma
|
|||||||
Google Proto Message | Google Proto Message | create_proto(proto) | get_proto(packet)
|
Google Proto Message | Google Proto Message | create_proto(proto) | get_proto(packet)
|
||||||
List\[Proto\] | std::vector\<Proto\> | n/a | get_proto_list(packet)
|
List\[Proto\] | std::vector\<Proto\> | n/a | get_proto_list(packet)
|
||||||
|
|
||||||
It's not uncommon that users create custom C++ classes and and send those into
|
It's not uncommon that users create custom C++ classes and send those into
|
||||||
the graphs and calculators. To allow the custom classes to be used in Python
|
the graphs and calculators. To allow the custom classes to be used in Python
|
||||||
with MediaPipe, you may extend the Packet API for a new data type in the
|
with MediaPipe, you may extend the Packet API for a new data type in the
|
||||||
following steps:
|
following steps:
|
||||||
@@ -229,7 +234,7 @@ three stages: initialization and setup, graph run, and graph shutdown.
|
|||||||
output_packets.append(mp.packet_getter.get_str(packet)))
|
output_packets.append(mp.packet_getter.get_str(packet)))
|
||||||
```
|
```
|
||||||
|
|
||||||
Option 2. Initialize a CalculatorGraph with with a binary protobuf file, and
|
Option 2. Initialize a CalculatorGraph with a binary protobuf file, and
|
||||||
observe the output stream(s).
|
observe the output stream(s).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 10
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## Missing Python binary path
|
## Missing Python binary path
|
||||||
|
|
||||||
The error message:
|
The error message:
|
||||||
|
|||||||
+100
-109
@@ -1,94 +1,121 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe
|
||||||
title: Home
|
title: Home
|
||||||
nav_order: 1
|
nav_order: 1
|
||||||
---
|
---
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
## Live ML anywhere
|
|
||||||
|
|
||||||
[MediaPipe](https://google.github.io/mediapipe/) offers cross-platform, customizable
|
|
||||||
ML solutions for live and streaming media.
|
|
||||||
|
|
||||||
 | 
|
|
||||||
:------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------:
|
|
||||||
***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 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*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
**Attention:** *Thanks for your interest in MediaPipe! We are moving to
|
**Attention:** *We have moved to
|
||||||
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
as the primary developer documentation
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
site for MediaPipe starting April 3, 2023.*
|
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|

|
||||||
|
|
||||||
----
|
**Attention**: MediaPipe Solutions Preview is an early release. [Learn
|
||||||
|
more](https://developers.google.com/mediapipe/solutions/about#notice).
|
||||||
|
|
||||||
## ML solutions in MediaPipe
|
**On-device machine learning for everyone**
|
||||||
|
|
||||||
Face Detection | Face Mesh | Iris | Hands | Pose | Holistic
|
Delight your customers with innovative machine learning features. MediaPipe
|
||||||
:----------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | :------:
|
contains everything that you need to customize and deploy to mobile (Android,
|
||||||
[](https://google.github.io/mediapipe/solutions/face_detection) | [](https://google.github.io/mediapipe/solutions/face_mesh) | [](https://google.github.io/mediapipe/solutions/iris) | [](https://google.github.io/mediapipe/solutions/hands) | [](https://google.github.io/mediapipe/solutions/pose) | [](https://google.github.io/mediapipe/solutions/holistic)
|
iOS), web, desktop, edge devices, and IoT, effortlessly.
|
||||||
|
|
||||||
Hair Segmentation | Object Detection | Box Tracking | Instant Motion Tracking | Objectron | KNIFT
|
* [See demos](https://goo.gle/mediapipe-studio)
|
||||||
:-------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: | :---:
|
* [Learn more](https://developers.google.com/mediapipe/solutions)
|
||||||
[](https://google.github.io/mediapipe/solutions/hair_segmentation) | [](https://google.github.io/mediapipe/solutions/object_detection) | [](https://google.github.io/mediapipe/solutions/box_tracking) | [](https://google.github.io/mediapipe/solutions/instant_motion_tracking) | [](https://google.github.io/mediapipe/solutions/objectron) | [](https://google.github.io/mediapipe/solutions/knift)
|
|
||||||
|
|
||||||
<!-- []() in the first cell is needed to preserve table formatting in GitHub Pages. -->
|
## Get started
|
||||||
<!-- Whenever this table is updated, paste a copy to solutions/solutions.md. -->
|
|
||||||
|
|
||||||
[]() | [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)
|
You can get started with MediaPipe Solutions by by checking out any of the
|
||||||
:---------------------------------------------------------------------------------------- | :-------------------------------------------------------------: | :-----------------------------------------------------: | :-----------------------------------------------------: | :-----------------------------------------------------------: | :-----------------------------------------------------------: | :--------------------------------------------------------------------:
|
developer guides for
|
||||||
[Face Detection](https://google.github.io/mediapipe/solutions/face_detection) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅
|
[vision](https://developers.google.com/mediapipe/solutions/vision/object_detector),
|
||||||
[Face Mesh](https://google.github.io/mediapipe/solutions/face_mesh) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
[text](https://developers.google.com/mediapipe/solutions/text/text_classifier),
|
||||||
[Iris](https://google.github.io/mediapipe/solutions/iris) | ✅ | ✅ | ✅ | | |
|
and
|
||||||
[Hands](https://google.github.io/mediapipe/solutions/hands) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
[audio](https://developers.google.com/mediapipe/solutions/audio/audio_classifier)
|
||||||
[Pose](https://google.github.io/mediapipe/solutions/pose) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
tasks. If you need help setting up a development environment for use with
|
||||||
[Holistic](https://google.github.io/mediapipe/solutions/holistic) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
MediaPipe Tasks, check out the setup guides for
|
||||||
[Selfie Segmentation](https://google.github.io/mediapipe/solutions/selfie_segmentation) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
[Android](https://developers.google.com/mediapipe/solutions/setup_android), [web
|
||||||
[Hair Segmentation](https://google.github.io/mediapipe/solutions/hair_segmentation) | ✅ | | ✅ | | |
|
apps](https://developers.google.com/mediapipe/solutions/setup_web), and
|
||||||
[Object Detection](https://google.github.io/mediapipe/solutions/object_detection) | ✅ | ✅ | ✅ | | | ✅
|
[Python](https://developers.google.com/mediapipe/solutions/setup_python).
|
||||||
[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) | | | ✅ | | |
|
|
||||||
|
|
||||||
See also
|
## Solutions
|
||||||
[MediaPipe Models and Model Cards](https://google.github.io/mediapipe/solutions/models)
|
|
||||||
for ML models released in MediaPipe.
|
|
||||||
|
|
||||||
## Getting started
|
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.
|
||||||
|
|
||||||
To start using MediaPipe
|
These libraries and resources provide the core functionality for each MediaPipe
|
||||||
[solutions](https://google.github.io/mediapipe/solutions/solutions) with only a few
|
Solution:
|
||||||
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).
|
|
||||||
|
|
||||||
To use MediaPipe in C++, Android and iOS, which allow further customization of
|
* **MediaPipe Tasks**: Cross-platform APIs and libraries for deploying
|
||||||
the [solutions](https://google.github.io/mediapipe/solutions/solutions) as well as
|
solutions. [Learn
|
||||||
building your own, learn how to
|
more](https://developers.google.com/mediapipe/solutions/tasks).
|
||||||
[install](https://google.github.io/mediapipe/getting_started/install) MediaPipe and
|
* **MediaPipe models**: Pre-trained, ready-to-run models for use with each
|
||||||
start building example applications in
|
solution.
|
||||||
[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).
|
|
||||||
|
|
||||||
The source code is hosted in the
|
These tools let you customize and evaluate solutions:
|
||||||
[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).
|
|
||||||
|
|
||||||
## Publications
|
* **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).
|
||||||
|
|
||||||
|
### Legacy solutions
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
For more on the legacy solutions, see the [documentation](https://github.com/google/mediapipe/tree/master/docs/solutions).
|
||||||
|
|
||||||
|
## Framework
|
||||||
|
|
||||||
|
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)
|
* [Bringing artworks to life with AR](https://developers.googleblog.com/2021/07/bringing-artworks-to-life-with-ar.html)
|
||||||
in Google Developers Blog
|
in Google Developers Blog
|
||||||
@@ -97,7 +124,8 @@ run code search using
|
|||||||
* [SignAll SDK: Sign language interface using MediaPipe is now available for
|
* [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)
|
developers](https://developers.googleblog.com/2021/04/signall-sdk-sign-language-interface-using-mediapipe-now-available.html)
|
||||||
in Google Developers Blog
|
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
|
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)
|
* [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
|
in Google AI Blog
|
||||||
@@ -125,43 +153,6 @@ run code search using
|
|||||||
in Google AI Blog
|
in Google AI Blog
|
||||||
* [MediaPipe: A Framework for Building Perception Pipelines](https://arxiv.org/abs/1906.08172)
|
* [MediaPipe: A Framework for Building Perception Pipelines](https://arxiv.org/abs/1906.08172)
|
||||||
|
|
||||||
## Videos
|
### Videos
|
||||||
|
|
||||||
* [YouTube Channel](https://www.youtube.com/c/MediaPipe)
|
* [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
-1
@@ -1,3 +1,3 @@
|
|||||||
MediaPipe
|
MediaPipe
|
||||||
=====================================
|
=====================================
|
||||||
Please see https://docs.mediapipe.dev.
|
Please see https://developers.google.com/mediapipe/
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/guide#legacy
|
||||||
title: AutoFlip (Saliency-aware Video Cropping)
|
title: AutoFlip (Saliency-aware Video Cropping)
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 14
|
nav_order: 14
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,12 +21,10 @@ nav_order: 14
|
|||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
||||||
For more information, see the new
|
For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/guide#legacy
|
||||||
title: Box Tracking
|
title: Box Tracking
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 10
|
nav_order: 10
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,12 +21,10 @@ nav_order: 10
|
|||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
||||||
For more information, see the new
|
For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/vision/face_detector/
|
||||||
title: Face Detection
|
title: Face Detection
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 1
|
nav_order: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -19,13 +20,11 @@ nav_order: 1
|
|||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
|
As of May 10, 2023, this solution was upgraded to a new MediaPipe
|
||||||
Solution. For more information, see the new
|
Solution. For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/face_detector)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/vision/face_landmarker/
|
||||||
title: Face Mesh
|
title: Face Mesh
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 2
|
nav_order: 2
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -19,13 +20,11 @@ nav_order: 2
|
|||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
|
As of May 10, 2023, this solution was upgraded to a new MediaPipe
|
||||||
Solution. For more information, see the new
|
Solution. For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/face_landmarker)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/vision/image_segmenter/
|
||||||
title: Hair Segmentation
|
title: Hair Segmentation
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 8
|
nav_order: 8
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -19,13 +20,11 @@ nav_order: 8
|
|||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
|
As of April 4, 2023, this solution was upgraded to a new MediaPipe
|
||||||
Solution. For more information, see the new
|
Solution. For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/image_segmenter/)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/vision/hand_landmarker
|
||||||
title: Hands
|
title: Hands
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 4
|
nav_order: 4
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -19,13 +20,11 @@ nav_order: 4
|
|||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
|
As of March 1, 2023, this solution was upgraded to a new MediaPipe
|
||||||
Solution. For more information, see the new
|
Solution. For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/hand_landmarker)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://github.com/google/mediapipe/blob/master/docs/solutions/holistic.md
|
||||||
title: Holistic
|
title: Holistic
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 6
|
nav_order: 6
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,12 +21,10 @@ nav_order: 6
|
|||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
|
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
|
||||||
Solution. For more information, see the new
|
Solution. For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
@@ -76,7 +75,7 @@ previous frame as a guide to the object region on the current one. However,
|
|||||||
during fast movements, the tracker can lose the target, which requires the
|
during fast movements, the tracker can lose the target, which requires the
|
||||||
detector to re-localize it in the image. MediaPipe Holistic uses
|
detector to re-localize it in the image. MediaPipe Holistic uses
|
||||||
[pose](./pose.md) prediction (on every frame) as an additional ROI prior to
|
[pose](./pose.md) prediction (on every frame) as an additional ROI prior to
|
||||||
reduce the response time of the pipeline when reacting to fast movements. This
|
reducing the response time of the pipeline when reacting to fast movements. This
|
||||||
also enables the model to retain semantic consistency across the body and its
|
also enables the model to retain semantic consistency across the body and its
|
||||||
parts by preventing a mixup between left and right hands or body parts of one
|
parts by preventing a mixup between left and right hands or body parts of one
|
||||||
person in the frame with another.
|
person in the frame with another.
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/guide#legacy
|
||||||
title: Instant Motion Tracking
|
title: Instant Motion Tracking
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 11
|
nav_order: 11
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,12 +21,10 @@ nav_order: 11
|
|||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
||||||
For more information, see the new
|
For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/vision/face_landmarker/
|
||||||
title: Iris
|
title: Iris
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 3
|
nav_order: 3
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -19,13 +20,11 @@ nav_order: 3
|
|||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
|
As of May 10, 2023, this solution was upgraded to a new MediaPipe
|
||||||
Solution. For more information, see the new
|
Solution. For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/face_landmarker)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/guide#legacy
|
||||||
title: KNIFT (Template-based Feature Matching)
|
title: KNIFT (Template-based Feature Matching)
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 13
|
nav_order: 13
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,12 +21,10 @@ nav_order: 13
|
|||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
||||||
For more information, see the new
|
For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/guide#legacy
|
||||||
title: Dataset Preparation with MediaSequence
|
title: Dataset Preparation with MediaSequence
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 15
|
nav_order: 15
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -24,8 +25,6 @@ For more information, see the new
|
|||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/guide#legacy
|
||||||
title: Models and Model Cards
|
title: Models and Model Cards
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 30
|
nav_order: 30
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -22,8 +23,6 @@ MediaPipe Legacy Solutions will continue to be provided on an as-is basis.
|
|||||||
We encourage you to check out the new MediaPipe Solutions at:
|
We encourage you to check out the new MediaPipe Solutions at:
|
||||||
[https://developers.google.com/mediapipe/solutions](https://developers.google.com/mediapipe/solutions)*
|
[https://developers.google.com/mediapipe/solutions](https://developers.google.com/mediapipe/solutions)*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
### [Face Detection](https://google.github.io/mediapipe/solutions/face_detection)
|
### [Face Detection](https://google.github.io/mediapipe/solutions/face_detection)
|
||||||
@@ -108,6 +107,8 @@ one over the other.
|
|||||||
|
|
||||||
* [TFLite model](https://storage.googleapis.com/mediapipe-assets/ssdlite_object_detection.tflite)
|
* [TFLite model](https://storage.googleapis.com/mediapipe-assets/ssdlite_object_detection.tflite)
|
||||||
* [TFLite model quantized for EdgeTPU/Coral](https://github.com/google/mediapipe/tree/master/mediapipe/examples/coral/models/object-detector-quantized_edgetpu.tflite)
|
* [TFLite model quantized for EdgeTPU/Coral](https://github.com/google/mediapipe/tree/master/mediapipe/examples/coral/models/object-detector-quantized_edgetpu.tflite)
|
||||||
|
* [TensorFlow model](https://storage.googleapis.com/mediapipe-assets/object_detection_saved_model/archive.zip)
|
||||||
|
* [Model information](https://storage.googleapis.com/mediapipe-assets/object_detection_saved_model/README.md)
|
||||||
|
|
||||||
### [Objectron](https://google.github.io/mediapipe/solutions/objectron)
|
### [Objectron](https://google.github.io/mediapipe/solutions/objectron)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/vision/object_detector/
|
||||||
title: Object Detection
|
title: Object Detection
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 9
|
nav_order: 9
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -19,13 +20,11 @@ nav_order: 9
|
|||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
|
As of March 1, 2023, this solution was upgraded to a new MediaPipe
|
||||||
Solution. For more information, see the new
|
Solution. For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/object_detector/)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||

|

|
||||||
@@ -118,9 +117,9 @@ on how to build MediaPipe examples.
|
|||||||
* With a TensorFlow Model
|
* With a TensorFlow Model
|
||||||
|
|
||||||
This uses the
|
This uses the
|
||||||
[TensorFlow model](https://github.com/google/mediapipe/tree/master/mediapipe/models/object_detection_saved_model)
|
[TensorFlow model](https://storage.googleapis.com/mediapipe-assets/object_detection_saved_model/archive.zip)
|
||||||
( see also
|
( see also
|
||||||
[model info](https://github.com/google/mediapipe/tree/master/mediapipe/models/object_detection_saved_model/README.md)),
|
[model info](https://storage.googleapis.com/mediapipe-assets/object_detection_saved_model/README.md)),
|
||||||
and the pipeline is implemented in this
|
and the pipeline is implemented in this
|
||||||
[graph](https://github.com/google/mediapipe/tree/master/mediapipe/graphs/object_detection/object_detection_mobile_cpu.pbtxt).
|
[graph](https://github.com/google/mediapipe/tree/master/mediapipe/graphs/object_detection/object_detection_mobile_cpu.pbtxt).
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
---
|
||||||
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/vision/object_detector
|
||||||
|
title: Object Detection
|
||||||
|
parent: MediaPipe Legacy Solutions
|
||||||
|
nav_order: 9
|
||||||
|
---
|
||||||
|
|
||||||
|
# MediaPipe Object Detection
|
||||||
|
{: .no_toc }
|
||||||
|
|
||||||
|
<details close markdown="block">
|
||||||
|
<summary>
|
||||||
|
Table of contents
|
||||||
|
</summary>
|
||||||
|
{: .text-delta }
|
||||||
|
1. TOC
|
||||||
|
{:toc}
|
||||||
|
</details>
|
||||||
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
|
As of March 1, 2023, this solution was upgraded to a new MediaPipe
|
||||||
|
Solution. For more information, see the
|
||||||
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/object_detector)
|
||||||
|
site.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
### TensorFlow model
|
||||||
|
|
||||||
|
The model is trained on [MSCOCO 2014](http://cocodataset.org) dataset using [TensorFlow Object Detection API](https://github.com/tensorflow/models/tree/master/research/object_detection). It is a MobileNetV2-based SSD model with 0.5 depth multiplier. Detailed training configuration is in the provided `pipeline.config`. The model is a relatively compact model which has `0.171 mAP` to achieve real-time performance on mobile devices. You can compare it with other models from the [TensorFlow detection model zoo](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1_detection_zoo.md).
|
||||||
|
|
||||||
|
|
||||||
|
### TFLite model
|
||||||
|
|
||||||
|
The TFLite model is converted from the TensorFlow above. The steps needed to convert the model are similar to [this tutorial](https://medium.com/tensorflow/training-and-serving-a-realtime-mobile-object-detector-in-30-minutes-with-cloud-tpus-b78971cf1193) with minor modifications. Assuming now we have a trained TensorFlow model which includes the checkpoint files and the training configuration file, for example the files provided in this repo:
|
||||||
|
|
||||||
|
* `model.ckpt.index`
|
||||||
|
* `model.ckpt.meta`
|
||||||
|
* `model.ckpt.data-00000-of-00001`
|
||||||
|
* `pipeline.config`
|
||||||
|
|
||||||
|
Make sure you have installed these [python libraries](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1.md). Then to get the frozen graph, run the `export_tflite_ssd_graph.py` script from the `models/research` directory with this command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ PATH_TO_MODEL=path/to/the/model
|
||||||
|
$ bazel run object_detection:export_tflite_ssd_graph -- \
|
||||||
|
--pipeline_config_path ${PATH_TO_MODEL}/pipeline.config \
|
||||||
|
--trained_checkpoint_prefix ${PATH_TO_MODEL}/model.ckpt \
|
||||||
|
--output_directory ${PATH_TO_MODEL} \
|
||||||
|
--add_postprocessing_op=False
|
||||||
|
```
|
||||||
|
|
||||||
|
The exported model contains two files:
|
||||||
|
|
||||||
|
* `tflite_graph.pb`
|
||||||
|
* `tflite_graph.pbtxt`
|
||||||
|
|
||||||
|
The difference between this step and the one in [the tutorial](https://medium.com/tensorflow/training-and-serving-a-realtime-mobile-object-detector-in-30-minutes-with-cloud-tpus-b78971cf1193) is that we set `add_postprocessing_op` to False. In MediaPipe, we have provided all the calculators needed for post-processing such that we can exclude the custom TFLite ops for post-processing in the original graph, e.g., non-maximum suppression. This enables the flexibility to integrate with different post-processing algorithms and implementations.
|
||||||
|
|
||||||
|
Optional: You can install and use the [graph tool](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/graph_transforms) to inspect the input/output of the exported model:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ bazel run graph_transforms:summarize_graph -- \
|
||||||
|
--in_graph=${PATH_TO_MODEL}/tflite_graph.pb
|
||||||
|
```
|
||||||
|
|
||||||
|
You should be able to see the input image size of the model is 320x320 and the outputs of the model are:
|
||||||
|
|
||||||
|
* `raw_outputs/box_encodings`
|
||||||
|
* `raw_outputs/class_predictions`
|
||||||
|
|
||||||
|
The last step is to convert the model to TFLite. You can look at [this guide](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/r1/convert/cmdline_examples.md) for more detail. For this example, you just need to run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ tflite_convert -- \
|
||||||
|
--graph_def_file=${PATH_TO_MODEL}/tflite_graph.pb \
|
||||||
|
--output_file=${PATH_TO_MODEL}/model.tflite \
|
||||||
|
--input_format=TENSORFLOW_GRAPHDEF \
|
||||||
|
--output_format=TFLITE \
|
||||||
|
--inference_type=FLOAT \
|
||||||
|
--input_shapes=1,320,320,3 \
|
||||||
|
--input_arrays=normalized_input_image_tensor \
|
||||||
|
--output_arrays=raw_outputs/box_encodings,raw_outputs/class_predictions
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you have the TFLite model `model.tflite` ready to use with MediaPipe Object Detection graphs. Please see the examples for more detail.
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/guide#legacy
|
||||||
title: Objectron (3D Object Detection)
|
title: Objectron (3D Object Detection)
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 12
|
nav_order: 12
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,12 +21,10 @@ nav_order: 12
|
|||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
||||||
For more information, see the new
|
For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/vision/pose_landmarker/
|
||||||
title: Pose
|
title: Pose
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
has_children: true
|
has_children: true
|
||||||
has_toc: false
|
has_toc: false
|
||||||
nav_order: 5
|
nav_order: 5
|
||||||
@@ -21,13 +22,11 @@ nav_order: 5
|
|||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
|
As of May 10, 2023, this solution was upgraded to a new MediaPipe
|
||||||
Solution. For more information, see the new
|
Solution. For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/pose_landmarker)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
@@ -144,7 +143,7 @@ The landmark model in MediaPipe Pose predicts the location of 33 pose landmarks
|
|||||||
:----------------------------------------------------------------------------------------------: |
|
:----------------------------------------------------------------------------------------------: |
|
||||||
*Fig 4. 33 pose landmarks.* |
|
*Fig 4. 33 pose landmarks.* |
|
||||||
|
|
||||||
Optionally, MediaPipe Pose can predicts a full-body
|
Optionally, MediaPipe Pose can predict a full-body
|
||||||
[segmentation mask](#segmentation_mask) represented as a two-class segmentation
|
[segmentation mask](#segmentation_mask) represented as a two-class segmentation
|
||||||
(human or background).
|
(human or background).
|
||||||
|
|
||||||
@@ -269,6 +268,7 @@ Supported configuration options:
|
|||||||
```python
|
```python
|
||||||
import cv2
|
import cv2
|
||||||
import mediapipe as mp
|
import mediapipe as mp
|
||||||
|
import numpy as np
|
||||||
mp_drawing = mp.solutions.drawing_utils
|
mp_drawing = mp.solutions.drawing_utils
|
||||||
mp_drawing_styles = mp.solutions.drawing_styles
|
mp_drawing_styles = mp.solutions.drawing_styles
|
||||||
mp_pose = mp.solutions.pose
|
mp_pose = mp.solutions.pose
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/vision/pose_landmarker/
|
||||||
title: Pose Classification
|
title: Pose Classification
|
||||||
parent: Pose
|
parent: Pose
|
||||||
grand_parent: Solutions
|
grand_parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 1
|
nav_order: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,13 +21,11 @@ nav_order: 1
|
|||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
|
As of May 10, 2023, this solution was upgraded to a new MediaPipe
|
||||||
Solution. For more information, see the new
|
Solution. For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/pose_landmarker/)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/vision/image_segmenter/
|
||||||
title: Selfie Segmentation
|
title: Selfie Segmentation
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 7
|
nav_order: 7
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -19,13 +20,11 @@ nav_order: 7
|
|||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
As of March 1, 2023, this solution is planned to be upgraded to a new MediaPipe
|
As of April 4, 2023, this solution was upgraded to a new MediaPipe
|
||||||
Solution. For more information, see the new
|
Solution. For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/vision/image_segmenter/)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
title: Solutions
|
target: https://developers.google.com/mediapipe/solutions/guide#legacy
|
||||||
|
title: MediaPipe Legacy Solutions
|
||||||
nav_order: 3
|
nav_order: 3
|
||||||
has_children: true
|
has_children: true
|
||||||
has_toc: false
|
has_toc: false
|
||||||
---
|
---
|
||||||
|
|
||||||
# Solutions
|
# MediaPipe Legacy Solutions
|
||||||
{: .no_toc }
|
{: .no_toc }
|
||||||
|
|
||||||
1. TOC
|
1. TOC
|
||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions. We have
|
**Attention:** *We have ended support for
|
||||||
ended support for
|
|
||||||
[these MediaPipe Legacy Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[these MediaPipe Legacy Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
||||||
as of March 1, 2023. All other
|
as of March 1, 2023. All other
|
||||||
[MediaPipe Legacy Solutions will be upgraded](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Legacy Solutions will be upgraded](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
||||||
@@ -25,8 +25,6 @@ be provided on an as-is basis. We encourage you to check out the new MediaPipe
|
|||||||
Solutions at:
|
Solutions at:
|
||||||
[https://developers.google.com/mediapipe/solutions](https://developers.google.com/mediapipe/solutions)*
|
[https://developers.google.com/mediapipe/solutions](https://developers.google.com/mediapipe/solutions)*
|
||||||
|
|
||||||
*This notice and web page will be removed on June 1, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
MediaPipe offers open source cross-platform, customizable ML solutions for live
|
MediaPipe offers open source cross-platform, customizable ML solutions for live
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/solutions/guide#legacy
|
||||||
title: YouTube-8M Feature Extraction and Model Inference
|
title: YouTube-8M Feature Extraction and Model Inference
|
||||||
parent: Solutions
|
parent: MediaPipe Legacy Solutions
|
||||||
nav_order: 16
|
nav_order: 16
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,12 +21,10 @@ nav_order: 16
|
|||||||
|
|
||||||
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
**Attention:** *Thank you for your interest in MediaPipe Solutions.
|
||||||
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
We have ended support for this MediaPipe Legacy Solution as of March 1, 2023.
|
||||||
For more information, see the new
|
For more information, see the
|
||||||
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
[MediaPipe Solutions](https://developers.google.com/mediapipe/solutions/guide#legacy)
|
||||||
site.*
|
site.*
|
||||||
|
|
||||||
*This notice and web page will be removed on April 3, 2023.*
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
MediaPipe is a useful and general framework for media processing that can assist
|
MediaPipe is a useful and general framework for media processing that can assist
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/
|
||||||
title: Performance Benchmarking
|
title: Performance Benchmarking
|
||||||
parent: Tools
|
parent: Tools
|
||||||
nav_order: 3
|
nav_order: 3
|
||||||
@@ -12,6 +13,12 @@ nav_order: 3
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
*Coming soon.*
|
*Coming soon.*
|
||||||
|
|
||||||
Future mediapipe releases will include tools for visualizing and analysing the
|
Future mediapipe releases will include tools for visualizing and analysing the
|
||||||
|
|||||||
+8
-1
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/
|
||||||
title: Tools
|
title: Tools
|
||||||
nav_order: 4
|
nav_order: 4
|
||||||
has_children: true
|
has_children: true
|
||||||
@@ -11,3 +12,9 @@ has_children: true
|
|||||||
1. TOC
|
1. TOC
|
||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: forward
|
||||||
|
target: https://developers.google.com/mediapipe/
|
||||||
title: Tracing and Profiling
|
title: Tracing and Profiling
|
||||||
parent: Tools
|
parent: Tools
|
||||||
nav_order: 2
|
nav_order: 2
|
||||||
@@ -12,6 +13,12 @@ nav_order: 2
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
The MediaPipe framework includes a built-in tracer and profiler. The tracer
|
The MediaPipe framework includes a built-in tracer and profiler. The tracer
|
||||||
records various timing events related to packet processing, including the start
|
records various timing events related to packet processing, including the start
|
||||||
and end time of each Calculator::Process call. The tracer writes trace log files
|
and end time of each Calculator::Process call. The tracer writes trace log files
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ nav_order: 1
|
|||||||
{:toc}
|
{:toc}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Attention:** *Thanks for your interest in MediaPipe! We have moved to
|
||||||
|
[https://developers.google.com/mediapipe](https://developers.google.com/mediapipe)
|
||||||
|
as the primary developer documentation site for MediaPipe as of April 3, 2023.*
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
To help users understand the structure of their calculator graphs and to
|
To help users understand the structure of their calculator graphs and to
|
||||||
understand the overall behavior of their machine learning inference pipelines,
|
understand the overall behavior of their machine learning inference pipelines,
|
||||||
we have built the [MediaPipe Visualizer](https://viz.mediapipe.dev/)
|
we have built the [MediaPipe Visualizer](https://viz.mediapipe.dev/)
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ config_setting(
|
|||||||
"ios_armv7",
|
"ios_armv7",
|
||||||
"ios_arm64",
|
"ios_arm64",
|
||||||
"ios_arm64e",
|
"ios_arm64e",
|
||||||
|
"ios_sim_arm64",
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -26,10 +26,11 @@
|
|||||||
namespace mediapipe {
|
namespace mediapipe {
|
||||||
namespace {
|
namespace {
|
||||||
static bool SafeMultiply(int x, int y, int* result) {
|
static bool SafeMultiply(int x, int y, int* result) {
|
||||||
static_assert(sizeof(int64) >= 2 * sizeof(int),
|
static_assert(sizeof(int64_t) >= 2 * sizeof(int),
|
||||||
"Unable to detect overflow after multiplication");
|
"Unable to detect overflow after multiplication");
|
||||||
const int64 big = static_cast<int64>(x) * static_cast<int64>(y);
|
const int64_t big = static_cast<int64_t>(x) * static_cast<int64_t>(y);
|
||||||
if (big > static_cast<int64>(INT_MIN) && big < static_cast<int64>(INT_MAX)) {
|
if (big > static_cast<int64_t>(INT_MIN) &&
|
||||||
|
big < static_cast<int64_t>(INT_MAX)) {
|
||||||
if (result != nullptr) *result = static_cast<int>(big);
|
if (result != nullptr) *result = static_cast<int>(big);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -182,12 +182,12 @@ class SpectrogramCalculator : public CalculatorBase {
|
|||||||
int frame_duration_samples_;
|
int frame_duration_samples_;
|
||||||
int frame_overlap_samples_;
|
int frame_overlap_samples_;
|
||||||
// How many samples we've been passed, used for checking input time stamps.
|
// How many samples we've been passed, used for checking input time stamps.
|
||||||
int64 cumulative_input_samples_;
|
int64_t cumulative_input_samples_;
|
||||||
// How many frames we've emitted, used for calculating output time stamps.
|
// How many frames we've emitted, used for calculating output time stamps.
|
||||||
int64 cumulative_completed_frames_;
|
int64_t cumulative_completed_frames_;
|
||||||
// How many frames were emitted last, used for estimating the timestamp on
|
// How many frames were emitted last, used for estimating the timestamp on
|
||||||
// Close when use_local_timestamp_ is true;
|
// Close when use_local_timestamp_ is true;
|
||||||
int64 last_completed_frames_;
|
int64_t last_completed_frames_;
|
||||||
Timestamp initial_input_timestamp_;
|
Timestamp initial_input_timestamp_;
|
||||||
int num_input_channels_;
|
int num_input_channels_;
|
||||||
// How many frequency bins we emit (=N_FFT/2 + 1).
|
// How many frequency bins we emit (=N_FFT/2 + 1).
|
||||||
@@ -433,9 +433,9 @@ absl::Status SpectrogramCalculator::ProcessVectorToOutput(
|
|||||||
absl::Status SpectrogramCalculator::ProcessVector(const Matrix& input_stream,
|
absl::Status SpectrogramCalculator::ProcessVector(const Matrix& input_stream,
|
||||||
CalculatorContext* cc) {
|
CalculatorContext* cc) {
|
||||||
switch (output_type_) {
|
switch (output_type_) {
|
||||||
// These blocks deliberately ignore clang-format to preserve the
|
// These blocks deliberately ignore clang-format to preserve the
|
||||||
// "silhouette" of the different cases.
|
// "silhouette" of the different cases.
|
||||||
// clang-format off
|
// clang-format off
|
||||||
case SpectrogramCalculatorOptions::COMPLEX: {
|
case SpectrogramCalculatorOptions::COMPLEX: {
|
||||||
return ProcessVectorToOutput(
|
return ProcessVectorToOutput(
|
||||||
input_stream,
|
input_stream,
|
||||||
|
|||||||
@@ -92,8 +92,8 @@ class SpectrogramCalculatorTest
|
|||||||
.cos()
|
.cos()
|
||||||
.transpose();
|
.transpose();
|
||||||
}
|
}
|
||||||
int64 input_timestamp = round(packet_start_time_seconds *
|
int64_t input_timestamp = round(packet_start_time_seconds *
|
||||||
Timestamp::kTimestampUnitsPerSecond);
|
Timestamp::kTimestampUnitsPerSecond);
|
||||||
AppendInputPacket(packet_data, input_timestamp);
|
AppendInputPacket(packet_data, input_timestamp);
|
||||||
total_num_input_samples += packet_size_samples;
|
total_num_input_samples += packet_size_samples;
|
||||||
}
|
}
|
||||||
@@ -116,8 +116,8 @@ class SpectrogramCalculatorTest
|
|||||||
double packet_start_time_seconds =
|
double packet_start_time_seconds =
|
||||||
kInitialTimestampOffsetMicroseconds * 1e-6 +
|
kInitialTimestampOffsetMicroseconds * 1e-6 +
|
||||||
total_num_input_samples / input_sample_rate_;
|
total_num_input_samples / input_sample_rate_;
|
||||||
int64 input_timestamp = round(packet_start_time_seconds *
|
int64_t input_timestamp = round(packet_start_time_seconds *
|
||||||
Timestamp::kTimestampUnitsPerSecond);
|
Timestamp::kTimestampUnitsPerSecond);
|
||||||
std::unique_ptr<Matrix> impulse(
|
std::unique_ptr<Matrix> impulse(
|
||||||
new Matrix(Matrix::Zero(1, packet_sizes_samples[i])));
|
new Matrix(Matrix::Zero(1, packet_sizes_samples[i])));
|
||||||
(*impulse)(0, impulse_offsets_samples[i]) = 1.0;
|
(*impulse)(0, impulse_offsets_samples[i]) = 1.0;
|
||||||
@@ -157,8 +157,8 @@ class SpectrogramCalculatorTest
|
|||||||
.cos()
|
.cos()
|
||||||
.transpose();
|
.transpose();
|
||||||
}
|
}
|
||||||
int64 input_timestamp = round(packet_start_time_seconds *
|
int64_t input_timestamp = round(packet_start_time_seconds *
|
||||||
Timestamp::kTimestampUnitsPerSecond);
|
Timestamp::kTimestampUnitsPerSecond);
|
||||||
AppendInputPacket(packet_data, input_timestamp);
|
AppendInputPacket(packet_data, input_timestamp);
|
||||||
total_num_input_samples += packet_size_samples;
|
total_num_input_samples += packet_size_samples;
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ class SpectrogramCalculatorTest
|
|||||||
const double expected_timestamp_seconds =
|
const double expected_timestamp_seconds =
|
||||||
packet_timestamp_offset_seconds +
|
packet_timestamp_offset_seconds +
|
||||||
cumulative_output_frames * frame_step_seconds;
|
cumulative_output_frames * frame_step_seconds;
|
||||||
const int64 expected_timestamp_ticks =
|
const int64_t expected_timestamp_ticks =
|
||||||
expected_timestamp_seconds * Timestamp::kTimestampUnitsPerSecond;
|
expected_timestamp_seconds * Timestamp::kTimestampUnitsPerSecond;
|
||||||
EXPECT_EQ(expected_timestamp_ticks, packet.Timestamp().Value());
|
EXPECT_EQ(expected_timestamp_ticks, packet.Timestamp().Value());
|
||||||
// Accept the timestamp of the first packet as the baseline for checking
|
// Accept the timestamp of the first packet as the baseline for checking
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ TEST_F(StabilizedLogCalculatorTest, BasicOperation) {
|
|||||||
|
|
||||||
std::vector<Matrix> input_data_matrices;
|
std::vector<Matrix> input_data_matrices;
|
||||||
for (int input_packet = 0; input_packet < kNumPackets; ++input_packet) {
|
for (int input_packet = 0; input_packet < kNumPackets; ++input_packet) {
|
||||||
const int64 timestamp = input_packet * Timestamp::kTimestampUnitsPerSecond;
|
const int64_t timestamp =
|
||||||
|
input_packet * Timestamp::kTimestampUnitsPerSecond;
|
||||||
Matrix input_data_matrix =
|
Matrix input_data_matrix =
|
||||||
Matrix::Random(kNumChannels, kNumSamples).array().abs();
|
Matrix::Random(kNumChannels, kNumSamples).array().abs();
|
||||||
input_data_matrices.push_back(input_data_matrix);
|
input_data_matrices.push_back(input_data_matrix);
|
||||||
@@ -80,7 +81,8 @@ TEST_F(StabilizedLogCalculatorTest, OutputScaleWorks) {
|
|||||||
|
|
||||||
std::vector<Matrix> input_data_matrices;
|
std::vector<Matrix> input_data_matrices;
|
||||||
for (int input_packet = 0; input_packet < kNumPackets; ++input_packet) {
|
for (int input_packet = 0; input_packet < kNumPackets; ++input_packet) {
|
||||||
const int64 timestamp = input_packet * Timestamp::kTimestampUnitsPerSecond;
|
const int64_t timestamp =
|
||||||
|
input_packet * Timestamp::kTimestampUnitsPerSecond;
|
||||||
Matrix input_data_matrix =
|
Matrix input_data_matrix =
|
||||||
Matrix::Random(kNumChannels, kNumSamples).array().abs();
|
Matrix::Random(kNumChannels, kNumSamples).array().abs();
|
||||||
input_data_matrices.push_back(input_data_matrix);
|
input_data_matrices.push_back(input_data_matrix);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class TimeSeriesFramerCalculator : public CalculatorBase {
|
|||||||
// Returns the timestamp of a sample on a base, which is usually the time
|
// Returns the timestamp of a sample on a base, which is usually the time
|
||||||
// stamp of a packet.
|
// stamp of a packet.
|
||||||
Timestamp CurrentSampleTimestamp(const Timestamp& timestamp_base,
|
Timestamp CurrentSampleTimestamp(const Timestamp& timestamp_base,
|
||||||
int64 number_of_samples) {
|
int64_t number_of_samples) {
|
||||||
return timestamp_base + round(number_of_samples / sample_rate_ *
|
return timestamp_base + round(number_of_samples / sample_rate_ *
|
||||||
Timestamp::kTimestampUnitsPerSecond);
|
Timestamp::kTimestampUnitsPerSecond);
|
||||||
}
|
}
|
||||||
@@ -118,10 +118,10 @@ class TimeSeriesFramerCalculator : public CalculatorBase {
|
|||||||
// emitted.
|
// emitted.
|
||||||
int next_frame_step_samples() const {
|
int next_frame_step_samples() const {
|
||||||
// All numbers are in input samples.
|
// All numbers are in input samples.
|
||||||
const int64 current_output_frame_start = static_cast<int64>(
|
const int64_t current_output_frame_start = static_cast<int64_t>(
|
||||||
round(cumulative_output_frames_ * average_frame_step_samples_));
|
round(cumulative_output_frames_ * average_frame_step_samples_));
|
||||||
CHECK_EQ(current_output_frame_start, cumulative_completed_samples_);
|
CHECK_EQ(current_output_frame_start, cumulative_completed_samples_);
|
||||||
const int64 next_output_frame_start = static_cast<int64>(
|
const int64_t next_output_frame_start = static_cast<int64_t>(
|
||||||
round((cumulative_output_frames_ + 1) * average_frame_step_samples_));
|
round((cumulative_output_frames_ + 1) * average_frame_step_samples_));
|
||||||
return next_output_frame_start - current_output_frame_start;
|
return next_output_frame_start - current_output_frame_start;
|
||||||
}
|
}
|
||||||
@@ -134,11 +134,11 @@ class TimeSeriesFramerCalculator : public CalculatorBase {
|
|||||||
// emulate_fractional_frame_overlap is true.
|
// emulate_fractional_frame_overlap is true.
|
||||||
double average_frame_step_samples_;
|
double average_frame_step_samples_;
|
||||||
int samples_still_to_drop_;
|
int samples_still_to_drop_;
|
||||||
int64 cumulative_output_frames_;
|
int64_t cumulative_output_frames_;
|
||||||
// "Completed" samples are samples that are no longer needed because
|
// "Completed" samples are samples that are no longer needed because
|
||||||
// the framer has completely stepped past them (taking into account
|
// the framer has completely stepped past them (taking into account
|
||||||
// any overlap).
|
// any overlap).
|
||||||
int64 cumulative_completed_samples_;
|
int64_t cumulative_completed_samples_;
|
||||||
Timestamp initial_input_timestamp_;
|
Timestamp initial_input_timestamp_;
|
||||||
// The current timestamp is updated along with the incoming packets.
|
// The current timestamp is updated along with the incoming packets.
|
||||||
Timestamp current_timestamp_;
|
Timestamp current_timestamp_;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class TimeSeriesFramerCalculatorTest
|
|||||||
|
|
||||||
// Returns a float value with the channel and timestamp separated by
|
// Returns a float value with the channel and timestamp separated by
|
||||||
// an order of magnitude, for easy parsing by humans.
|
// an order of magnitude, for easy parsing by humans.
|
||||||
float TestValue(int64 timestamp_in_microseconds, int channel) {
|
float TestValue(int64_t timestamp_in_microseconds, int channel) {
|
||||||
return timestamp_in_microseconds + channel / 10.0;
|
return timestamp_in_microseconds + channel / 10.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ class TimeSeriesFramerCalculatorTest
|
|||||||
auto matrix = new Matrix(num_channels, num_samples);
|
auto matrix = new Matrix(num_channels, num_samples);
|
||||||
for (int c = 0; c < num_channels; ++c) {
|
for (int c = 0; c < num_channels; ++c) {
|
||||||
for (int i = 0; i < num_samples; ++i) {
|
for (int i = 0; i < num_samples; ++i) {
|
||||||
int64 timestamp = time_series_util::SecondsToSamples(
|
int64_t timestamp = time_series_util::SecondsToSamples(
|
||||||
starting_timestamp_seconds + i / input_sample_rate_,
|
starting_timestamp_seconds + i / input_sample_rate_,
|
||||||
Timestamp::kTimestampUnitsPerSecond);
|
Timestamp::kTimestampUnitsPerSecond);
|
||||||
(*matrix)(c, i) = TestValue(timestamp, c);
|
(*matrix)(c, i) = TestValue(timestamp, c);
|
||||||
@@ -429,7 +429,7 @@ class TimeSeriesFramerCalculatorTimestampingTest
|
|||||||
num_full_packets -= 1;
|
num_full_packets -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64 num_samples = 0;
|
int64_t num_samples = 0;
|
||||||
for (int packet_num = 0; packet_num < num_full_packets; ++packet_num) {
|
for (int packet_num = 0; packet_num < num_full_packets; ++packet_num) {
|
||||||
const Packet& packet = output().packets[packet_num];
|
const Packet& packet = output().packets[packet_num];
|
||||||
num_samples += FrameDurationSamples();
|
num_samples += FrameDurationSamples();
|
||||||
|
|||||||
@@ -192,17 +192,19 @@ cc_library(
|
|||||||
"//mediapipe/framework:calculator_context",
|
"//mediapipe/framework:calculator_context",
|
||||||
"//mediapipe/framework:calculator_contract",
|
"//mediapipe/framework:calculator_contract",
|
||||||
"//mediapipe/framework:calculator_framework",
|
"//mediapipe/framework:calculator_framework",
|
||||||
"//mediapipe/framework:collection_item_id",
|
|
||||||
"//mediapipe/framework:packet",
|
"//mediapipe/framework:packet",
|
||||||
"//mediapipe/framework/formats:detection_cc_proto",
|
"//mediapipe/framework/formats:detection_cc_proto",
|
||||||
|
"//mediapipe/framework/formats:image",
|
||||||
|
"//mediapipe/framework/formats:image_frame",
|
||||||
"//mediapipe/framework/formats:landmark_cc_proto",
|
"//mediapipe/framework/formats:landmark_cc_proto",
|
||||||
"//mediapipe/framework/formats:matrix",
|
"//mediapipe/framework/formats:matrix",
|
||||||
"//mediapipe/framework/formats:rect_cc_proto",
|
"//mediapipe/framework/formats:rect_cc_proto",
|
||||||
"//mediapipe/framework/formats:tensor",
|
"//mediapipe/framework/formats:tensor",
|
||||||
"//mediapipe/framework/port:integral_types",
|
|
||||||
"//mediapipe/framework/port:ret_check",
|
"//mediapipe/framework/port:ret_check",
|
||||||
"//mediapipe/framework/port:status",
|
"//mediapipe/framework/port:status",
|
||||||
|
"//mediapipe/gpu:gpu_buffer",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
|
"@com_google_absl//absl/status",
|
||||||
],
|
],
|
||||||
alwayslink = 1,
|
alwayslink = 1,
|
||||||
)
|
)
|
||||||
@@ -215,17 +217,18 @@ cc_library(
|
|||||||
"//mediapipe/framework:calculator_context",
|
"//mediapipe/framework:calculator_context",
|
||||||
"//mediapipe/framework:calculator_contract",
|
"//mediapipe/framework:calculator_contract",
|
||||||
"//mediapipe/framework:calculator_framework",
|
"//mediapipe/framework:calculator_framework",
|
||||||
"//mediapipe/framework:collection_item_id",
|
|
||||||
"//mediapipe/framework/formats:classification_cc_proto",
|
"//mediapipe/framework/formats:classification_cc_proto",
|
||||||
"//mediapipe/framework/formats:detection_cc_proto",
|
"//mediapipe/framework/formats:detection_cc_proto",
|
||||||
|
"//mediapipe/framework/formats:image",
|
||||||
|
"//mediapipe/framework/formats:image_frame",
|
||||||
"//mediapipe/framework/formats:landmark_cc_proto",
|
"//mediapipe/framework/formats:landmark_cc_proto",
|
||||||
"//mediapipe/framework/formats:matrix",
|
"//mediapipe/framework/formats:matrix",
|
||||||
"//mediapipe/framework/formats:rect_cc_proto",
|
"//mediapipe/framework/formats:rect_cc_proto",
|
||||||
"//mediapipe/framework/formats:tensor",
|
"//mediapipe/framework/formats:tensor",
|
||||||
"//mediapipe/framework/port:integral_types",
|
|
||||||
"//mediapipe/framework/port:ret_check",
|
"//mediapipe/framework/port:ret_check",
|
||||||
"//mediapipe/framework/port:status",
|
"//mediapipe/gpu:gpu_buffer",
|
||||||
"//mediapipe/util:render_data_cc_proto",
|
"//mediapipe/util:render_data_cc_proto",
|
||||||
|
"@com_google_absl//absl/status",
|
||||||
"@org_tensorflow//tensorflow/lite:framework",
|
"@org_tensorflow//tensorflow/lite:framework",
|
||||||
],
|
],
|
||||||
alwayslink = 1,
|
alwayslink = 1,
|
||||||
@@ -282,6 +285,7 @@ cc_library(
|
|||||||
}),
|
}),
|
||||||
deps = [
|
deps = [
|
||||||
":concatenate_vector_calculator_cc_proto",
|
":concatenate_vector_calculator_cc_proto",
|
||||||
|
"//mediapipe/framework:calculator_framework",
|
||||||
"//mediapipe/framework/api2:node",
|
"//mediapipe/framework/api2:node",
|
||||||
"//mediapipe/framework/api2:port",
|
"//mediapipe/framework/api2:port",
|
||||||
"//mediapipe/framework/formats:classification_cc_proto",
|
"//mediapipe/framework/formats:classification_cc_proto",
|
||||||
@@ -290,12 +294,10 @@ cc_library(
|
|||||||
"//mediapipe/framework/port:integral_types",
|
"//mediapipe/framework/port:integral_types",
|
||||||
"//mediapipe/framework/port:ret_check",
|
"//mediapipe/framework/port:ret_check",
|
||||||
"//mediapipe/framework/port:status",
|
"//mediapipe/framework/port:status",
|
||||||
"//mediapipe/framework:calculator_framework",
|
|
||||||
"//mediapipe/util:render_data_cc_proto",
|
"//mediapipe/util:render_data_cc_proto",
|
||||||
"@org_tensorflow//tensorflow/lite:framework",
|
"@org_tensorflow//tensorflow/lite:framework",
|
||||||
] + select({
|
] + select({
|
||||||
"//mediapipe/gpu:disable_gpu": [],
|
":ios_or_disable_gpu": [],
|
||||||
"//mediapipe:ios": [],
|
|
||||||
"//conditions:default": [
|
"//conditions:default": [
|
||||||
"@org_tensorflow//tensorflow/lite/delegates/gpu/gl:gl_buffer",
|
"@org_tensorflow//tensorflow/lite/delegates/gpu/gl:gl_buffer",
|
||||||
],
|
],
|
||||||
@@ -900,12 +902,13 @@ cc_library(
|
|||||||
}),
|
}),
|
||||||
deps = [
|
deps = [
|
||||||
":split_vector_calculator_cc_proto",
|
":split_vector_calculator_cc_proto",
|
||||||
"//mediapipe/framework/formats:detection_cc_proto",
|
|
||||||
"//mediapipe/framework/formats:classification_cc_proto",
|
|
||||||
"//mediapipe/framework/formats:landmark_cc_proto",
|
|
||||||
"//mediapipe/framework/formats:rect_cc_proto",
|
|
||||||
"//mediapipe/framework:calculator_framework",
|
"//mediapipe/framework:calculator_framework",
|
||||||
|
"//mediapipe/framework/formats:classification_cc_proto",
|
||||||
|
"//mediapipe/framework/formats:detection_cc_proto",
|
||||||
|
"//mediapipe/framework/formats:image",
|
||||||
|
"//mediapipe/framework/formats:landmark_cc_proto",
|
||||||
"//mediapipe/framework/formats:matrix",
|
"//mediapipe/framework/formats:matrix",
|
||||||
|
"//mediapipe/framework/formats:rect_cc_proto",
|
||||||
"//mediapipe/framework/formats:tensor",
|
"//mediapipe/framework/formats:tensor",
|
||||||
"//mediapipe/framework/port:ret_check",
|
"//mediapipe/framework/port:ret_check",
|
||||||
"//mediapipe/framework/port:status",
|
"//mediapipe/framework/port:status",
|
||||||
@@ -1237,6 +1240,7 @@ cc_library(
|
|||||||
"//mediapipe/framework/formats:classification_cc_proto",
|
"//mediapipe/framework/formats:classification_cc_proto",
|
||||||
"//mediapipe/framework/formats:detection_cc_proto",
|
"//mediapipe/framework/formats:detection_cc_proto",
|
||||||
"//mediapipe/framework/formats:landmark_cc_proto",
|
"//mediapipe/framework/formats:landmark_cc_proto",
|
||||||
|
"//mediapipe/framework/formats:rect_cc_proto",
|
||||||
"//mediapipe/framework/port:ret_check",
|
"//mediapipe/framework/port:ret_check",
|
||||||
"//mediapipe/framework/port:status",
|
"//mediapipe/framework/port:status",
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -17,10 +17,13 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "mediapipe/framework/formats/detection.pb.h"
|
#include "mediapipe/framework/formats/detection.pb.h"
|
||||||
|
#include "mediapipe/framework/formats/image.h"
|
||||||
|
#include "mediapipe/framework/formats/image_frame.h"
|
||||||
#include "mediapipe/framework/formats/landmark.pb.h"
|
#include "mediapipe/framework/formats/landmark.pb.h"
|
||||||
#include "mediapipe/framework/formats/matrix.h"
|
#include "mediapipe/framework/formats/matrix.h"
|
||||||
#include "mediapipe/framework/formats/rect.pb.h"
|
#include "mediapipe/framework/formats/rect.pb.h"
|
||||||
#include "mediapipe/framework/formats/tensor.h"
|
#include "mediapipe/framework/formats/tensor.h"
|
||||||
|
#include "mediapipe/gpu/gpu_buffer.h"
|
||||||
|
|
||||||
namespace mediapipe {
|
namespace mediapipe {
|
||||||
|
|
||||||
@@ -60,4 +63,17 @@ REGISTER_CALCULATOR(BeginLoopUint64tCalculator);
|
|||||||
typedef BeginLoopCalculator<std::vector<Tensor>> BeginLoopTensorCalculator;
|
typedef BeginLoopCalculator<std::vector<Tensor>> BeginLoopTensorCalculator;
|
||||||
REGISTER_CALCULATOR(BeginLoopTensorCalculator);
|
REGISTER_CALCULATOR(BeginLoopTensorCalculator);
|
||||||
|
|
||||||
|
// A calculator to process std::vector<mediapipe::ImageFrame>.
|
||||||
|
typedef BeginLoopCalculator<std::vector<ImageFrame>>
|
||||||
|
BeginLoopImageFrameCalculator;
|
||||||
|
REGISTER_CALCULATOR(BeginLoopImageFrameCalculator);
|
||||||
|
|
||||||
|
// A calculator to process std::vector<mediapipe::GpuBuffer>.
|
||||||
|
typedef BeginLoopCalculator<std::vector<GpuBuffer>>
|
||||||
|
BeginLoopGpuBufferCalculator;
|
||||||
|
REGISTER_CALCULATOR(BeginLoopGpuBufferCalculator);
|
||||||
|
|
||||||
|
// A calculator to process std::vector<mediapipe::Image>.
|
||||||
|
typedef BeginLoopCalculator<std::vector<Image>> BeginLoopImageCalculator;
|
||||||
|
REGISTER_CALCULATOR(BeginLoopImageCalculator);
|
||||||
} // namespace mediapipe
|
} // namespace mediapipe
|
||||||
|
|||||||
@@ -15,47 +15,57 @@
|
|||||||
#ifndef MEDIAPIPE_CALCULATORS_CORE_BEGIN_LOOP_CALCULATOR_H_
|
#ifndef MEDIAPIPE_CALCULATORS_CORE_BEGIN_LOOP_CALCULATOR_H_
|
||||||
#define MEDIAPIPE_CALCULATORS_CORE_BEGIN_LOOP_CALCULATOR_H_
|
#define MEDIAPIPE_CALCULATORS_CORE_BEGIN_LOOP_CALCULATOR_H_
|
||||||
|
|
||||||
|
#include "absl/status/status.h"
|
||||||
#include "mediapipe/framework/calculator_context.h"
|
#include "mediapipe/framework/calculator_context.h"
|
||||||
#include "mediapipe/framework/calculator_contract.h"
|
#include "mediapipe/framework/calculator_contract.h"
|
||||||
#include "mediapipe/framework/calculator_framework.h"
|
#include "mediapipe/framework/calculator_framework.h"
|
||||||
#include "mediapipe/framework/collection_item_id.h"
|
|
||||||
#include "mediapipe/framework/packet.h"
|
#include "mediapipe/framework/packet.h"
|
||||||
#include "mediapipe/framework/port/integral_types.h"
|
|
||||||
#include "mediapipe/framework/port/ret_check.h"
|
#include "mediapipe/framework/port/ret_check.h"
|
||||||
#include "mediapipe/framework/port/status.h"
|
|
||||||
#include "mediapipe/framework/port/status_macros.h"
|
|
||||||
|
|
||||||
namespace mediapipe {
|
namespace mediapipe {
|
||||||
|
|
||||||
// Calculator for implementing loops on iterable collections inside a MediaPipe
|
// Calculator for implementing loops on iterable collections inside a MediaPipe
|
||||||
// graph.
|
// graph. Assume InputIterT is an iterable for type InputT, and OutputIterT is
|
||||||
|
// an iterable for type OutputT, e.g. vector<InputT> and vector<OutputT>.
|
||||||
|
// First, instantiate specializations in the loop calculators' implementations
|
||||||
|
// if missing:
|
||||||
|
// BeginLoopInputTCalculator = BeginLoopCalculator<InputIterT>
|
||||||
|
// EndLoopOutputTCalculator = EndLoopCalculator<OutputIterT>
|
||||||
|
// Then, the following graph transforms an item of type InputIterT to an
|
||||||
|
// OutputIterT by applying InputToOutputConverter to every element:
|
||||||
//
|
//
|
||||||
// It is designed to be used like:
|
// node { # Type @timestamp
|
||||||
//
|
// calculator: "BeginLoopInputTCalculator"
|
||||||
// node {
|
// input_stream: "ITERABLE:input_iterable" # InputIterT @iterable_ts
|
||||||
// calculator: "BeginLoopWithIterableCalculator"
|
// input_stream: "CLONE:extra_input" # ExtraT @extra_ts
|
||||||
// input_stream: "ITERABLE:input_iterable" # IterableT @ext_ts
|
// output_stream: "ITEM:input_iterator" # InputT @loop_internal_ts
|
||||||
// output_stream: "ITEM:input_element" # ItemT @loop_internal_ts
|
// output_stream: "CLONE:cloned_extra_input" # ExtraT @loop_internal_ts
|
||||||
// output_stream: "BATCH_END:ext_ts" # Timestamp @loop_internal_ts
|
// output_stream: "BATCH_END:iterable_ts" # Timestamp @loop_internal_ts
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// node {
|
// node {
|
||||||
// calculator: "ElementToBlaConverterSubgraph"
|
// calculator: "InputToOutputConverter"
|
||||||
// input_stream: "ITEM:input_to_loop_body" # ItemT @loop_internal_ts
|
// input_stream: "INPUT:input_iterator" # InputT @loop_internal_ts
|
||||||
// output_stream: "BLA:output_of_loop_body" # ItemU @loop_internal_ts
|
// input_stream: "EXTRA:cloned_extra_input" # ExtraT @loop_internal_ts
|
||||||
|
// output_stream: "OUTPUT:output_iterator" # OutputT @loop_internal_ts
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// node {
|
// node {
|
||||||
// calculator: "EndLoopWithOutputCalculator"
|
// calculator: "EndLoopOutputTCalculator"
|
||||||
// input_stream: "ITEM:output_of_loop_body" # ItemU @loop_internal_ts
|
// input_stream: "ITEM:output_iterator" # OutputT @loop_internal_ts
|
||||||
// input_stream: "BATCH_END:ext_ts" # Timestamp @loop_internal_ts
|
// input_stream: "BATCH_END:iterable_ts" # Timestamp @loop_internal_ts
|
||||||
// output_stream: "ITERABLE:aggregated_result" # IterableU @ext_ts
|
// output_stream: "ITERABLE:output_iterable" # OutputIterT @iterable_ts
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// The resulting 'output_iterable' has the same timestamp as 'input_iterable'.
|
||||||
|
// The output packets of this calculator are part of the loop body and have
|
||||||
|
// loop-internal timestamps that are unrelated to the input iterator timestamp.
|
||||||
|
//
|
||||||
// Input streams tagged with "CLONE" are cloned to the corresponding output
|
// Input streams tagged with "CLONE" are cloned to the corresponding output
|
||||||
// streams at loop timestamps. This ensures that a MediaPipe graph or sub-graph
|
// streams at loop-internal timestamps. This ensures that a MediaPipe graph or
|
||||||
// can run multiple times, once per element in the "ITERABLE" for each pakcet
|
// sub-graph can run multiple times, once per element in the "ITERABLE" for each
|
||||||
// clone of the packets in the "CLONE" input streams.
|
// packet clone of the packets in the "CLONE" input streams. Think of CLONEd
|
||||||
|
// inputs as loop-wide constants.
|
||||||
template <typename IterableT>
|
template <typename IterableT>
|
||||||
class BeginLoopCalculator : public CalculatorBase {
|
class BeginLoopCalculator : public CalculatorBase {
|
||||||
using ItemT = typename IterableT::value_type;
|
using ItemT = typename IterableT::value_type;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace mediapipe {
|
|||||||
typedef ClipVectorSizeCalculator<int> TestClipIntVectorSizeCalculator;
|
typedef ClipVectorSizeCalculator<int> TestClipIntVectorSizeCalculator;
|
||||||
REGISTER_CALCULATOR(TestClipIntVectorSizeCalculator);
|
REGISTER_CALCULATOR(TestClipIntVectorSizeCalculator);
|
||||||
|
|
||||||
void AddInputVector(const std::vector<int>& input, int64 timestamp,
|
void AddInputVector(const std::vector<int>& input, int64_t timestamp,
|
||||||
CalculatorRunner* runner) {
|
CalculatorRunner* runner) {
|
||||||
runner->MutableInputs()->Index(0).packets.push_back(
|
runner->MutableInputs()->Index(0).packets.push_back(
|
||||||
MakePacket<std::vector<int>>(input).At(Timestamp(timestamp)));
|
MakePacket<std::vector<int>>(input).At(Timestamp(timestamp)));
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ void ValidateCombinedLandmarks(
|
|||||||
|
|
||||||
void AddInputLandmarkLists(
|
void AddInputLandmarkLists(
|
||||||
const std::vector<NormalizedLandmarkList>& input_landmarks_vec,
|
const std::vector<NormalizedLandmarkList>& input_landmarks_vec,
|
||||||
int64 timestamp, CalculatorRunner* runner) {
|
int64_t timestamp, CalculatorRunner* runner) {
|
||||||
for (int i = 0; i < input_landmarks_vec.size(); ++i) {
|
for (int i = 0; i < input_landmarks_vec.size(); ++i) {
|
||||||
runner->MutableInputs()->Index(i).packets.push_back(
|
runner->MutableInputs()->Index(i).packets.push_back(
|
||||||
MakePacket<NormalizedLandmarkList>(input_landmarks_vec[i])
|
MakePacket<NormalizedLandmarkList>(input_landmarks_vec[i])
|
||||||
@@ -73,7 +73,7 @@ void AddInputLandmarkLists(
|
|||||||
|
|
||||||
void AddInputClassificationLists(
|
void AddInputClassificationLists(
|
||||||
const std::vector<ClassificationList>& input_classifications_vec,
|
const std::vector<ClassificationList>& input_classifications_vec,
|
||||||
int64 timestamp, CalculatorRunner* runner) {
|
int64_t timestamp, CalculatorRunner* runner) {
|
||||||
for (int i = 0; i < input_classifications_vec.size(); ++i) {
|
for (int i = 0; i < input_classifications_vec.size(); ++i) {
|
||||||
runner->MutableInputs()->Index(i).packets.push_back(
|
runner->MutableInputs()->Index(i).packets.push_back(
|
||||||
MakePacket<ClassificationList>(input_classifications_vec[i])
|
MakePacket<ClassificationList>(input_classifications_vec[i])
|
||||||
|
|||||||
@@ -46,15 +46,19 @@ MEDIAPIPE_REGISTER_NODE(ConcatenateFloatVectorCalculator);
|
|||||||
// input_stream: "int32_vector_2"
|
// input_stream: "int32_vector_2"
|
||||||
// output_stream: "concatenated_int32_vector"
|
// output_stream: "concatenated_int32_vector"
|
||||||
// }
|
// }
|
||||||
typedef ConcatenateVectorCalculator<int32> ConcatenateInt32VectorCalculator;
|
typedef ConcatenateVectorCalculator<int32_t> ConcatenateInt32VectorCalculator;
|
||||||
MEDIAPIPE_REGISTER_NODE(ConcatenateInt32VectorCalculator);
|
MEDIAPIPE_REGISTER_NODE(ConcatenateInt32VectorCalculator);
|
||||||
|
|
||||||
typedef ConcatenateVectorCalculator<uint64> ConcatenateUInt64VectorCalculator;
|
typedef ConcatenateVectorCalculator<uint64_t> ConcatenateUInt64VectorCalculator;
|
||||||
MEDIAPIPE_REGISTER_NODE(ConcatenateUInt64VectorCalculator);
|
MEDIAPIPE_REGISTER_NODE(ConcatenateUInt64VectorCalculator);
|
||||||
|
|
||||||
typedef ConcatenateVectorCalculator<bool> ConcatenateBoolVectorCalculator;
|
typedef ConcatenateVectorCalculator<bool> ConcatenateBoolVectorCalculator;
|
||||||
MEDIAPIPE_REGISTER_NODE(ConcatenateBoolVectorCalculator);
|
MEDIAPIPE_REGISTER_NODE(ConcatenateBoolVectorCalculator);
|
||||||
|
|
||||||
|
typedef ConcatenateVectorCalculator<std::string>
|
||||||
|
ConcatenateStringVectorCalculator;
|
||||||
|
MEDIAPIPE_REGISTER_NODE(ConcatenateStringVectorCalculator);
|
||||||
|
|
||||||
// Example config:
|
// Example config:
|
||||||
// node {
|
// node {
|
||||||
// calculator: "ConcatenateTfLiteTensorVectorCalculator"
|
// calculator: "ConcatenateTfLiteTensorVectorCalculator"
|
||||||
|
|||||||
@@ -30,26 +30,28 @@ namespace mediapipe {
|
|||||||
typedef ConcatenateVectorCalculator<int> TestConcatenateIntVectorCalculator;
|
typedef ConcatenateVectorCalculator<int> TestConcatenateIntVectorCalculator;
|
||||||
MEDIAPIPE_REGISTER_NODE(TestConcatenateIntVectorCalculator);
|
MEDIAPIPE_REGISTER_NODE(TestConcatenateIntVectorCalculator);
|
||||||
|
|
||||||
void AddInputVector(int index, const std::vector<int>& input, int64 timestamp,
|
template <typename T>
|
||||||
|
void AddInputVector(int index, const std::vector<T>& input, int64_t timestamp,
|
||||||
CalculatorRunner* runner) {
|
CalculatorRunner* runner) {
|
||||||
runner->MutableInputs()->Index(index).packets.push_back(
|
runner->MutableInputs()->Index(index).packets.push_back(
|
||||||
MakePacket<std::vector<int>>(input).At(Timestamp(timestamp)));
|
MakePacket<std::vector<T>>(input).At(Timestamp(timestamp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddInputVectors(const std::vector<std::vector<int>>& inputs,
|
template <typename T>
|
||||||
int64 timestamp, CalculatorRunner* runner) {
|
void AddInputVectors(const std::vector<std::vector<T>>& inputs,
|
||||||
|
int64_t timestamp, CalculatorRunner* runner) {
|
||||||
for (int i = 0; i < inputs.size(); ++i) {
|
for (int i = 0; i < inputs.size(); ++i) {
|
||||||
AddInputVector(i, inputs[i], timestamp, runner);
|
AddInputVector(i, inputs[i], timestamp, runner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddInputItem(int index, int input, int64 timestamp,
|
void AddInputItem(int index, int input, int64_t timestamp,
|
||||||
CalculatorRunner* runner) {
|
CalculatorRunner* runner) {
|
||||||
runner->MutableInputs()->Index(index).packets.push_back(
|
runner->MutableInputs()->Index(index).packets.push_back(
|
||||||
MakePacket<int>(input).At(Timestamp(timestamp)));
|
MakePacket<int>(input).At(Timestamp(timestamp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddInputItems(const std::vector<int>& inputs, int64 timestamp,
|
void AddInputItems(const std::vector<int>& inputs, int64_t timestamp,
|
||||||
CalculatorRunner* runner) {
|
CalculatorRunner* runner) {
|
||||||
for (int i = 0; i < inputs.size(); ++i) {
|
for (int i = 0; i < inputs.size(); ++i) {
|
||||||
AddInputItem(i, inputs[i], timestamp, runner);
|
AddInputItem(i, inputs[i], timestamp, runner);
|
||||||
@@ -279,7 +281,7 @@ TEST(TestConcatenateIntVectorCalculatorTest, MixedVectorsAndItemsAnother) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AddInputVectors(const std::vector<std::vector<float>>& inputs,
|
void AddInputVectors(const std::vector<std::vector<float>>& inputs,
|
||||||
int64 timestamp, CalculatorRunner* runner) {
|
int64_t timestamp, CalculatorRunner* runner) {
|
||||||
for (int i = 0; i < inputs.size(); ++i) {
|
for (int i = 0; i < inputs.size(); ++i) {
|
||||||
runner->MutableInputs()->Index(i).packets.push_back(
|
runner->MutableInputs()->Index(i).packets.push_back(
|
||||||
MakePacket<std::vector<float>>(inputs[i]).At(Timestamp(timestamp)));
|
MakePacket<std::vector<float>>(inputs[i]).At(Timestamp(timestamp)));
|
||||||
@@ -382,6 +384,23 @@ TEST(ConcatenateFloatVectorCalculatorTest, OneEmptyStreamNoOutput) {
|
|||||||
EXPECT_EQ(0, outputs.size());
|
EXPECT_EQ(0, outputs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(ConcatenateStringVectorCalculatorTest, OneTimestamp) {
|
||||||
|
CalculatorRunner runner("ConcatenateStringVectorCalculator",
|
||||||
|
/*options_string=*/"", /*num_inputs=*/3,
|
||||||
|
/*num_outputs=*/1, /*num_side_packets=*/0);
|
||||||
|
|
||||||
|
std::vector<std::vector<std::string>> inputs = {
|
||||||
|
{"a", "b"}, {"c"}, {"d", "e", "f"}};
|
||||||
|
AddInputVectors(inputs, /*timestamp=*/1, &runner);
|
||||||
|
MP_ASSERT_OK(runner.Run());
|
||||||
|
|
||||||
|
const std::vector<Packet>& outputs = runner.Outputs().Index(0).packets;
|
||||||
|
EXPECT_EQ(1, outputs.size());
|
||||||
|
EXPECT_EQ(Timestamp(1), outputs[0].Timestamp());
|
||||||
|
std::vector<std::string> expected_vector = {"a", "b", "c", "d", "e", "f"};
|
||||||
|
EXPECT_EQ(expected_vector, outputs[0].Get<std::vector<std::string>>());
|
||||||
|
}
|
||||||
|
|
||||||
typedef ConcatenateVectorCalculator<std::unique_ptr<int>>
|
typedef ConcatenateVectorCalculator<std::unique_ptr<int>>
|
||||||
TestConcatenateUniqueIntPtrCalculator;
|
TestConcatenateUniqueIntPtrCalculator;
|
||||||
MEDIAPIPE_REGISTER_NODE(TestConcatenateUniqueIntPtrCalculator);
|
MEDIAPIPE_REGISTER_NODE(TestConcatenateUniqueIntPtrCalculator);
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class ConstantSidePacketCalculator : public CalculatorBase {
|
|||||||
} else if (packet_options.has_string_value()) {
|
} else if (packet_options.has_string_value()) {
|
||||||
packet.Set<std::string>();
|
packet.Set<std::string>();
|
||||||
} else if (packet_options.has_uint64_value()) {
|
} else if (packet_options.has_uint64_value()) {
|
||||||
packet.Set<uint64>();
|
packet.Set<uint64_t>();
|
||||||
} else if (packet_options.has_classification_list_value()) {
|
} else if (packet_options.has_classification_list_value()) {
|
||||||
packet.Set<ClassificationList>();
|
packet.Set<ClassificationList>();
|
||||||
} else if (packet_options.has_landmark_list_value()) {
|
} else if (packet_options.has_landmark_list_value()) {
|
||||||
@@ -112,7 +112,7 @@ class ConstantSidePacketCalculator : public CalculatorBase {
|
|||||||
} else if (packet_options.has_string_value()) {
|
} else if (packet_options.has_string_value()) {
|
||||||
packet.Set(MakePacket<std::string>(packet_options.string_value()));
|
packet.Set(MakePacket<std::string>(packet_options.string_value()));
|
||||||
} else if (packet_options.has_uint64_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()) {
|
} else if (packet_options.has_classification_list_value()) {
|
||||||
packet.Set(MakePacket<ClassificationList>(
|
packet.Set(MakePacket<ClassificationList>(
|
||||||
packet_options.classification_list_value()));
|
packet_options.classification_list_value()));
|
||||||
|
|||||||
@@ -18,10 +18,13 @@
|
|||||||
|
|
||||||
#include "mediapipe/framework/formats/classification.pb.h"
|
#include "mediapipe/framework/formats/classification.pb.h"
|
||||||
#include "mediapipe/framework/formats/detection.pb.h"
|
#include "mediapipe/framework/formats/detection.pb.h"
|
||||||
|
#include "mediapipe/framework/formats/image.h"
|
||||||
|
#include "mediapipe/framework/formats/image_frame.h"
|
||||||
#include "mediapipe/framework/formats/landmark.pb.h"
|
#include "mediapipe/framework/formats/landmark.pb.h"
|
||||||
#include "mediapipe/framework/formats/matrix.h"
|
#include "mediapipe/framework/formats/matrix.h"
|
||||||
#include "mediapipe/framework/formats/rect.pb.h"
|
#include "mediapipe/framework/formats/rect.pb.h"
|
||||||
#include "mediapipe/framework/formats/tensor.h"
|
#include "mediapipe/framework/formats/tensor.h"
|
||||||
|
#include "mediapipe/gpu/gpu_buffer.h"
|
||||||
#include "mediapipe/util/render_data.pb.h"
|
#include "mediapipe/util/render_data.pb.h"
|
||||||
#include "tensorflow/lite/interpreter.h"
|
#include "tensorflow/lite/interpreter.h"
|
||||||
|
|
||||||
@@ -67,4 +70,18 @@ REGISTER_CALCULATOR(EndLoopMatrixCalculator);
|
|||||||
typedef EndLoopCalculator<std::vector<Tensor>> EndLoopTensorCalculator;
|
typedef EndLoopCalculator<std::vector<Tensor>> EndLoopTensorCalculator;
|
||||||
REGISTER_CALCULATOR(EndLoopTensorCalculator);
|
REGISTER_CALCULATOR(EndLoopTensorCalculator);
|
||||||
|
|
||||||
|
typedef EndLoopCalculator<std::vector<ImageFrame>> EndLoopImageFrameCalculator;
|
||||||
|
REGISTER_CALCULATOR(EndLoopImageFrameCalculator);
|
||||||
|
|
||||||
|
typedef EndLoopCalculator<std::vector<GpuBuffer>> EndLoopGpuBufferCalculator;
|
||||||
|
REGISTER_CALCULATOR(EndLoopGpuBufferCalculator);
|
||||||
|
|
||||||
|
typedef EndLoopCalculator<std::vector<::mediapipe::Image>>
|
||||||
|
EndLoopImageCalculator;
|
||||||
|
REGISTER_CALCULATOR(EndLoopImageCalculator);
|
||||||
|
|
||||||
|
typedef EndLoopCalculator<std::vector<std::array<float, 16>>>
|
||||||
|
EndLoopAffineMatrixCalculator;
|
||||||
|
REGISTER_CALCULATOR(EndLoopAffineMatrixCalculator);
|
||||||
|
|
||||||
} // namespace mediapipe
|
} // namespace mediapipe
|
||||||
|
|||||||
@@ -17,13 +17,11 @@
|
|||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "absl/status/status.h"
|
||||||
#include "mediapipe/framework/calculator_context.h"
|
#include "mediapipe/framework/calculator_context.h"
|
||||||
#include "mediapipe/framework/calculator_contract.h"
|
#include "mediapipe/framework/calculator_contract.h"
|
||||||
#include "mediapipe/framework/calculator_framework.h"
|
#include "mediapipe/framework/calculator_framework.h"
|
||||||
#include "mediapipe/framework/collection_item_id.h"
|
|
||||||
#include "mediapipe/framework/port/integral_types.h"
|
|
||||||
#include "mediapipe/framework/port/ret_check.h"
|
#include "mediapipe/framework/port/ret_check.h"
|
||||||
#include "mediapipe/framework/port/status.h"
|
|
||||||
|
|
||||||
namespace mediapipe {
|
namespace mediapipe {
|
||||||
|
|
||||||
@@ -33,27 +31,7 @@ namespace mediapipe {
|
|||||||
// from the "BATCH_END" tagged input stream, it emits the aggregated results
|
// from the "BATCH_END" tagged input stream, it emits the aggregated results
|
||||||
// at the original timestamp contained in the "BATCH_END" input stream.
|
// at the original timestamp contained in the "BATCH_END" input stream.
|
||||||
//
|
//
|
||||||
// It is designed to be used like:
|
// See BeginLoopCalculator for a usage example.
|
||||||
//
|
|
||||||
// node {
|
|
||||||
// calculator: "BeginLoopWithIterableCalculator"
|
|
||||||
// input_stream: "ITERABLE:input_iterable" # IterableT @ext_ts
|
|
||||||
// output_stream: "ITEM:input_element" # ItemT @loop_internal_ts
|
|
||||||
// output_stream: "BATCH_END:ext_ts" # Timestamp @loop_internal_ts
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// node {
|
|
||||||
// calculator: "ElementToBlaConverterSubgraph"
|
|
||||||
// input_stream: "ITEM:input_to_loop_body" # ItemT @loop_internal_ts
|
|
||||||
// output_stream: "BLA:output_of_loop_body" # ItemU @loop_internal_ts
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// node {
|
|
||||||
// calculator: "EndLoopWithOutputCalculator"
|
|
||||||
// input_stream: "ITEM:output_of_loop_body" # ItemU @loop_internal_ts
|
|
||||||
// input_stream: "BATCH_END:ext_ts" # Timestamp @loop_internal_ts
|
|
||||||
// output_stream: "ITERABLE:aggregated_result" # IterableU @ext_ts
|
|
||||||
// }
|
|
||||||
template <typename IterableT>
|
template <typename IterableT>
|
||||||
class EndLoopCalculator : public CalculatorBase {
|
class EndLoopCalculator : public CalculatorBase {
|
||||||
using ItemT = typename IterableT::value_type;
|
using ItemT = typename IterableT::value_type;
|
||||||
@@ -79,7 +57,7 @@ class EndLoopCalculator : public CalculatorBase {
|
|||||||
}
|
}
|
||||||
// Try to consume the item and move it into the collection. If the items
|
// Try to consume the item and move it into the collection. If the items
|
||||||
// are not consumable, then try to copy them instead. If the items are
|
// are not consumable, then try to copy them instead. If the items are
|
||||||
// not copiable, then an error will be returned.
|
// not copyable, then an error will be returned.
|
||||||
auto item_ptr_or = cc->Inputs().Tag("ITEM").Value().Consume<ItemT>();
|
auto item_ptr_or = cc->Inputs().Tag("ITEM").Value().Consume<ItemT>();
|
||||||
if (item_ptr_or.ok()) {
|
if (item_ptr_or.ok()) {
|
||||||
input_stream_collection_->push_back(std::move(*item_ptr_or.value()));
|
input_stream_collection_->push_back(std::move(*item_ptr_or.value()));
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ constexpr char kOptionsTag[] = "OPTIONS";
|
|||||||
//
|
//
|
||||||
// Increasing `max_in_flight` to 2 or more can yield the better throughput
|
// Increasing `max_in_flight` to 2 or more can yield the better throughput
|
||||||
// when the graph exhibits a high degree of pipeline parallelism. Decreasing
|
// 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
|
// lower throughput (lower framerate) due to the time during which the graph
|
||||||
// is idle awaiting the next input frame.
|
// is idle awaiting the next input frame.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ class AtomicSemaphore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Returns the timestamp values for a vector of Packets.
|
// Returns the timestamp values for a vector of Packets.
|
||||||
std::vector<int64> TimestampValues(const std::vector<Packet>& packets) {
|
std::vector<int64_t> TimestampValues(const std::vector<Packet>& packets) {
|
||||||
std::vector<int64> result;
|
std::vector<int64_t> result;
|
||||||
for (const Packet& packet : packets) {
|
for (const Packet& packet : packets) {
|
||||||
result.push_back(packet.Timestamp().Value());
|
result.push_back(packet.Timestamp().Value());
|
||||||
}
|
}
|
||||||
@@ -180,9 +180,9 @@ TEST_F(FlowLimiterCalculatorSemaphoreTest, FramesDropped) {
|
|||||||
InitializeGraph(1);
|
InitializeGraph(1);
|
||||||
MP_ASSERT_OK(graph_.StartRun({}));
|
MP_ASSERT_OK(graph_.StartRun({}));
|
||||||
|
|
||||||
auto send_packet = [this](const std::string& input_name, int64 n) {
|
auto send_packet = [this](const std::string& input_name, int64_t n) {
|
||||||
MP_EXPECT_OK(graph_.AddPacketToInputStream(
|
MP_EXPECT_OK(graph_.AddPacketToInputStream(
|
||||||
input_name, MakePacket<int64>(n).At(Timestamp(n))));
|
input_name, MakePacket<int64_t>(n).At(Timestamp(n))));
|
||||||
};
|
};
|
||||||
|
|
||||||
Packet allow_packet;
|
Packet allow_packet;
|
||||||
@@ -207,12 +207,12 @@ TEST_F(FlowLimiterCalculatorSemaphoreTest, FramesDropped) {
|
|||||||
EXPECT_EQ(10, out_1_packets_.size());
|
EXPECT_EQ(10, out_1_packets_.size());
|
||||||
|
|
||||||
// Timestamps have not been altered.
|
// Timestamps have not been altered.
|
||||||
EXPECT_EQ(PacketValues<int64>(out_1_packets_),
|
EXPECT_EQ(PacketValues<int64_t>(out_1_packets_),
|
||||||
TimestampValues(out_1_packets_));
|
TimestampValues(out_1_packets_));
|
||||||
|
|
||||||
// Extra inputs on in_1 have been dropped.
|
// Extra inputs on in_1 have been dropped.
|
||||||
EXPECT_EQ(TimestampValues(out_1_packets_),
|
EXPECT_EQ(TimestampValues(out_1_packets_),
|
||||||
(std::vector<int64>{0, 10, 20, 30, 40, 50, 60, 70, 80, 90}));
|
(std::vector<int64_t>{0, 10, 20, 30, 40, 50, 60, 70, 80, 90}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// A calculator that sleeps during Process.
|
// A calculator that sleeps during Process.
|
||||||
@@ -221,8 +221,8 @@ class SleepCalculator : public CalculatorBase {
|
|||||||
static absl::Status GetContract(CalculatorContract* cc) {
|
static absl::Status GetContract(CalculatorContract* cc) {
|
||||||
cc->Inputs().Tag(kPacketTag).SetAny();
|
cc->Inputs().Tag(kPacketTag).SetAny();
|
||||||
cc->Outputs().Tag(kPacketTag).SetSameAs(&cc->Inputs().Tag(kPacketTag));
|
cc->Outputs().Tag(kPacketTag).SetSameAs(&cc->Inputs().Tag(kPacketTag));
|
||||||
cc->InputSidePackets().Tag(kSleepTimeTag).Set<int64>();
|
cc->InputSidePackets().Tag(kSleepTimeTag).Set<int64_t>();
|
||||||
cc->InputSidePackets().Tag(kWarmupTimeTag).Set<int64>();
|
cc->InputSidePackets().Tag(kWarmupTimeTag).Set<int64_t>();
|
||||||
cc->InputSidePackets().Tag(kClockTag).Set<mediapipe::Clock*>();
|
cc->InputSidePackets().Tag(kClockTag).Set<mediapipe::Clock*>();
|
||||||
cc->SetTimestampOffset(0);
|
cc->SetTimestampOffset(0);
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
@@ -237,8 +237,8 @@ class SleepCalculator : public CalculatorBase {
|
|||||||
++packet_count;
|
++packet_count;
|
||||||
absl::Duration sleep_time = absl::Microseconds(
|
absl::Duration sleep_time = absl::Microseconds(
|
||||||
packet_count == 1
|
packet_count == 1
|
||||||
? cc->InputSidePackets().Tag(kWarmupTimeTag).Get<int64>()
|
? cc->InputSidePackets().Tag(kWarmupTimeTag).Get<int64_t>()
|
||||||
: cc->InputSidePackets().Tag(kSleepTimeTag).Get<int64>());
|
: cc->InputSidePackets().Tag(kSleepTimeTag).Get<int64_t>());
|
||||||
clock_->Sleep(sleep_time);
|
clock_->Sleep(sleep_time);
|
||||||
cc->Outputs()
|
cc->Outputs()
|
||||||
.Tag(kPacketTag)
|
.Tag(kPacketTag)
|
||||||
@@ -375,8 +375,8 @@ TEST_F(FlowLimiterCalculatorTest, FinishedTimestamps) {
|
|||||||
std::map<std::string, Packet> side_packets = {
|
std::map<std::string, Packet> side_packets = {
|
||||||
{"limiter_options",
|
{"limiter_options",
|
||||||
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
||||||
{"warmup_time", MakePacket<int64>(22000)},
|
{"warmup_time", MakePacket<int64_t>(22000)},
|
||||||
{"sleep_time", MakePacket<int64>(22000)},
|
{"sleep_time", MakePacket<int64_t>(22000)},
|
||||||
{"drop_timesamps", MakePacket<bool>(false)},
|
{"drop_timesamps", MakePacket<bool>(false)},
|
||||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||||
};
|
};
|
||||||
@@ -447,8 +447,8 @@ TEST_F(FlowLimiterCalculatorTest, FinishedLost) {
|
|||||||
std::map<std::string, Packet> side_packets = {
|
std::map<std::string, Packet> side_packets = {
|
||||||
{"limiter_options",
|
{"limiter_options",
|
||||||
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
||||||
{"warmup_time", MakePacket<int64>(22000)},
|
{"warmup_time", MakePacket<int64_t>(22000)},
|
||||||
{"sleep_time", MakePacket<int64>(22000)},
|
{"sleep_time", MakePacket<int64_t>(22000)},
|
||||||
{"drop_timesamps", MakePacket<bool>(true)},
|
{"drop_timesamps", MakePacket<bool>(true)},
|
||||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||||
};
|
};
|
||||||
@@ -511,8 +511,8 @@ TEST_F(FlowLimiterCalculatorTest, FinishedDelayed) {
|
|||||||
std::map<std::string, Packet> side_packets = {
|
std::map<std::string, Packet> side_packets = {
|
||||||
{"limiter_options",
|
{"limiter_options",
|
||||||
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
||||||
{"warmup_time", MakePacket<int64>(500000)},
|
{"warmup_time", MakePacket<int64_t>(500000)},
|
||||||
{"sleep_time", MakePacket<int64>(22000)},
|
{"sleep_time", MakePacket<int64_t>(22000)},
|
||||||
{"drop_timesamps", MakePacket<bool>(false)},
|
{"drop_timesamps", MakePacket<bool>(false)},
|
||||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||||
};
|
};
|
||||||
@@ -606,8 +606,8 @@ TEST_F(FlowLimiterCalculatorTest, TwoInputStreams) {
|
|||||||
std::map<std::string, Packet> side_packets = {
|
std::map<std::string, Packet> side_packets = {
|
||||||
{"limiter_options",
|
{"limiter_options",
|
||||||
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
||||||
{"warmup_time", MakePacket<int64>(22000)},
|
{"warmup_time", MakePacket<int64_t>(22000)},
|
||||||
{"sleep_time", MakePacket<int64>(22000)},
|
{"sleep_time", MakePacket<int64_t>(22000)},
|
||||||
{"drop_timesamps", MakePacket<bool>(true)},
|
{"drop_timesamps", MakePacket<bool>(true)},
|
||||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||||
};
|
};
|
||||||
@@ -715,8 +715,8 @@ TEST_F(FlowLimiterCalculatorTest, ZeroQueue) {
|
|||||||
std::map<std::string, Packet> side_packets = {
|
std::map<std::string, Packet> side_packets = {
|
||||||
{"limiter_options",
|
{"limiter_options",
|
||||||
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
MakePacket<FlowLimiterCalculatorOptions>(limiter_options)},
|
||||||
{"warmup_time", MakePacket<int64>(12000)},
|
{"warmup_time", MakePacket<int64_t>(12000)},
|
||||||
{"sleep_time", MakePacket<int64>(12000)},
|
{"sleep_time", MakePacket<int64_t>(12000)},
|
||||||
{"drop_timesamps", MakePacket<bool>(true)},
|
{"drop_timesamps", MakePacket<bool>(true)},
|
||||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||||
};
|
};
|
||||||
@@ -862,9 +862,9 @@ TEST_F(FlowLimiterCalculatorTest, AuxiliaryInputs) {
|
|||||||
|
|
||||||
std::map<std::string, Packet> side_packets = {
|
std::map<std::string, Packet> side_packets = {
|
||||||
// Fake processing lazy initialization time in microseconds.
|
// Fake processing lazy initialization time in microseconds.
|
||||||
{"warmup_time", MakePacket<int64>(22000)},
|
{"warmup_time", MakePacket<int64_t>(22000)},
|
||||||
// Fake processing duration in microseconds.
|
// Fake processing duration in microseconds.
|
||||||
{"sleep_time", MakePacket<int64>(22000)},
|
{"sleep_time", MakePacket<int64_t>(22000)},
|
||||||
// The SimulationClock to count virtual elapsed time.
|
// The SimulationClock to count virtual elapsed time.
|
||||||
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
{"clock", MakePacket<mediapipe::Clock*>(clock_)},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,19 +26,15 @@ constexpr char kStateChangeTag[] = "STATE_CHANGE";
|
|||||||
constexpr char kDisallowTag[] = "DISALLOW";
|
constexpr char kDisallowTag[] = "DISALLOW";
|
||||||
constexpr char kAllowTag[] = "ALLOW";
|
constexpr char kAllowTag[] = "ALLOW";
|
||||||
|
|
||||||
enum GateState {
|
std::string ToString(GateCalculatorOptions::GateState state) {
|
||||||
GATE_UNINITIALIZED,
|
|
||||||
GATE_ALLOW,
|
|
||||||
GATE_DISALLOW,
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string ToString(GateState state) {
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case GATE_UNINITIALIZED:
|
case GateCalculatorOptions::UNSPECIFIED:
|
||||||
|
return "UNSPECIFIED";
|
||||||
|
case GateCalculatorOptions::GATE_UNINITIALIZED:
|
||||||
return "UNINITIALIZED";
|
return "UNINITIALIZED";
|
||||||
case GATE_ALLOW:
|
case GateCalculatorOptions::GATE_ALLOW:
|
||||||
return "ALLOW";
|
return "ALLOW";
|
||||||
case GATE_DISALLOW:
|
case GateCalculatorOptions::GATE_DISALLOW:
|
||||||
return "DISALLOW";
|
return "DISALLOW";
|
||||||
}
|
}
|
||||||
DLOG(FATAL) << "Unknown GateState";
|
DLOG(FATAL) << "Unknown GateState";
|
||||||
@@ -125,7 +121,6 @@ class GateCalculator : public CalculatorBase {
|
|||||||
RET_CHECK_OK(CheckAndInitAllowDisallowInputs(cc));
|
RET_CHECK_OK(CheckAndInitAllowDisallowInputs(cc));
|
||||||
|
|
||||||
const int num_data_streams = cc->Inputs().NumEntries("");
|
const int num_data_streams = cc->Inputs().NumEntries("");
|
||||||
RET_CHECK_GE(num_data_streams, 1);
|
|
||||||
RET_CHECK_EQ(cc->Outputs().NumEntries(""), num_data_streams)
|
RET_CHECK_EQ(cc->Outputs().NumEntries(""), num_data_streams)
|
||||||
<< "Number of data output streams must match with data input streams.";
|
<< "Number of data output streams must match with data input streams.";
|
||||||
|
|
||||||
@@ -154,10 +149,12 @@ class GateCalculator : public CalculatorBase {
|
|||||||
|
|
||||||
cc->SetOffset(TimestampDiff(0));
|
cc->SetOffset(TimestampDiff(0));
|
||||||
num_data_streams_ = cc->Inputs().NumEntries("");
|
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>();
|
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();
|
empty_packets_as_allow_ = options.empty_packets_as_allow();
|
||||||
|
|
||||||
if (!use_side_packet_for_allow_disallow_ &&
|
if (!use_side_packet_for_allow_disallow_ &&
|
||||||
@@ -185,10 +182,12 @@ class GateCalculator : public CalculatorBase {
|
|||||||
allow = !cc->Inputs().Tag(kDisallowTag).Get<bool>();
|
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 (cc->Outputs().HasTag(kStateChangeTag)) {
|
||||||
if (last_gate_state_ != GATE_UNINITIALIZED &&
|
if (last_gate_state_ != GateCalculatorOptions::GATE_UNINITIALIZED &&
|
||||||
last_gate_state_ != new_gate_state) {
|
last_gate_state_ != new_gate_state) {
|
||||||
VLOG(2) << "State transition in " << cc->NodeName() << " @ "
|
VLOG(2) << "State transition in " << cc->NodeName() << " @ "
|
||||||
<< cc->InputTimestamp().Value() << " from "
|
<< cc->InputTimestamp().Value() << " from "
|
||||||
@@ -224,7 +223,8 @@ class GateCalculator : public CalculatorBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GateState last_gate_state_ = GATE_UNINITIALIZED;
|
GateCalculatorOptions::GateState last_gate_state_ =
|
||||||
|
GateCalculatorOptions::GATE_UNINITIALIZED;
|
||||||
int num_data_streams_;
|
int num_data_streams_;
|
||||||
bool empty_packets_as_allow_;
|
bool empty_packets_as_allow_;
|
||||||
bool use_side_packet_for_allow_disallow_ = false;
|
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
|
// Whether to allow or disallow the input streams to pass when no
|
||||||
// ALLOW/DISALLOW input or side input is specified.
|
// ALLOW/DISALLOW input or side input is specified.
|
||||||
optional bool allow = 2 [default = false];
|
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.
|
// 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(
|
runner_->MutableInputs()->Get("", 0).packets.push_back(
|
||||||
MakePacket<bool>(stream_payload).At(Timestamp(timestamp)));
|
MakePacket<bool>(stream_payload).At(Timestamp(timestamp)));
|
||||||
MP_ASSERT_OK(runner_->Run()) << "Calculator execution failed.";
|
MP_ASSERT_OK(runner_->Run()) << "Calculator execution failed.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use this when ALLOW/DISALLOW input is provided as an input stream.
|
// 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) {
|
bool control) {
|
||||||
runner_->MutableInputs()->Get("", 0).packets.push_back(
|
runner_->MutableInputs()->Get("", 0).packets.push_back(
|
||||||
MakePacket<bool>(true).At(Timestamp(timestamp)));
|
MakePacket<bool>(true).At(Timestamp(timestamp)));
|
||||||
@@ -52,6 +52,15 @@ class GateCalculatorTest : public ::testing::Test {
|
|||||||
MP_ASSERT_OK(runner_->Run()) << "Calculator execution failed.";
|
MP_ASSERT_OK(runner_->Run()) << "Calculator execution failed.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunTimeStepWithoutDataStream(int64_t timestamp,
|
||||||
|
const std::string& control_tag,
|
||||||
|
bool control) {
|
||||||
|
runner_->MutableInputs()
|
||||||
|
->Tag(control_tag)
|
||||||
|
.packets.push_back(MakePacket<bool>(control).At(Timestamp(timestamp)));
|
||||||
|
MP_ASSERT_OK(runner_->Run()) << "Calculator execution failed.";
|
||||||
|
}
|
||||||
|
|
||||||
void SetRunner(const std::string& proto) {
|
void SetRunner(const std::string& proto) {
|
||||||
runner_ = absl::make_unique<CalculatorRunner>(
|
runner_ = absl::make_unique<CalculatorRunner>(
|
||||||
ParseTextProtoOrDie<CalculatorGraphConfig::Node>(proto));
|
ParseTextProtoOrDie<CalculatorGraphConfig::Node>(proto));
|
||||||
@@ -125,9 +134,9 @@ TEST_F(GateCalculatorTest, AllowByALLOWOptionToTrue) {
|
|||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, true);
|
RunTimeStep(kTimestampValue0, true);
|
||||||
constexpr int64 kTimestampValue1 = 43;
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
RunTimeStep(kTimestampValue1, false);
|
RunTimeStep(kTimestampValue1, false);
|
||||||
|
|
||||||
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
||||||
@@ -150,9 +159,9 @@ TEST_F(GateCalculatorTest, DisallowByALLOWOptionSetToFalse) {
|
|||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, true);
|
RunTimeStep(kTimestampValue0, true);
|
||||||
constexpr int64 kTimestampValue1 = 43;
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
RunTimeStep(kTimestampValue1, false);
|
RunTimeStep(kTimestampValue1, false);
|
||||||
|
|
||||||
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
||||||
@@ -166,9 +175,9 @@ TEST_F(GateCalculatorTest, DisallowByALLOWOptionNotSet) {
|
|||||||
output_stream: "test_output"
|
output_stream: "test_output"
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, true);
|
RunTimeStep(kTimestampValue0, true);
|
||||||
constexpr int64 kTimestampValue1 = 43;
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
RunTimeStep(kTimestampValue1, false);
|
RunTimeStep(kTimestampValue1, false);
|
||||||
|
|
||||||
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
||||||
@@ -184,9 +193,9 @@ TEST_F(GateCalculatorTest, AllowByALLOWSidePacketSetToTrue) {
|
|||||||
)");
|
)");
|
||||||
runner()->MutableSidePackets()->Tag(kAllowTag) = Adopt(new bool(true));
|
runner()->MutableSidePackets()->Tag(kAllowTag) = Adopt(new bool(true));
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, true);
|
RunTimeStep(kTimestampValue0, true);
|
||||||
constexpr int64 kTimestampValue1 = 43;
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
RunTimeStep(kTimestampValue1, false);
|
RunTimeStep(kTimestampValue1, false);
|
||||||
|
|
||||||
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
||||||
@@ -206,9 +215,9 @@ TEST_F(GateCalculatorTest, AllowByDisallowSidePacketSetToFalse) {
|
|||||||
)");
|
)");
|
||||||
runner()->MutableSidePackets()->Tag(kDisallowTag) = Adopt(new bool(false));
|
runner()->MutableSidePackets()->Tag(kDisallowTag) = Adopt(new bool(false));
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, true);
|
RunTimeStep(kTimestampValue0, true);
|
||||||
constexpr int64 kTimestampValue1 = 43;
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
RunTimeStep(kTimestampValue1, false);
|
RunTimeStep(kTimestampValue1, false);
|
||||||
|
|
||||||
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
||||||
@@ -228,9 +237,9 @@ TEST_F(GateCalculatorTest, DisallowByALLOWSidePacketSetToFalse) {
|
|||||||
)");
|
)");
|
||||||
runner()->MutableSidePackets()->Tag(kAllowTag) = Adopt(new bool(false));
|
runner()->MutableSidePackets()->Tag(kAllowTag) = Adopt(new bool(false));
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, true);
|
RunTimeStep(kTimestampValue0, true);
|
||||||
constexpr int64 kTimestampValue1 = 43;
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
RunTimeStep(kTimestampValue1, false);
|
RunTimeStep(kTimestampValue1, false);
|
||||||
|
|
||||||
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
||||||
@@ -246,9 +255,9 @@ TEST_F(GateCalculatorTest, DisallowByDISALLOWSidePacketSetToTrue) {
|
|||||||
)");
|
)");
|
||||||
runner()->MutableSidePackets()->Tag(kDisallowTag) = Adopt(new bool(true));
|
runner()->MutableSidePackets()->Tag(kDisallowTag) = Adopt(new bool(true));
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, true);
|
RunTimeStep(kTimestampValue0, true);
|
||||||
constexpr int64 kTimestampValue1 = 43;
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
RunTimeStep(kTimestampValue1, false);
|
RunTimeStep(kTimestampValue1, false);
|
||||||
|
|
||||||
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
||||||
@@ -263,13 +272,13 @@ TEST_F(GateCalculatorTest, Allow) {
|
|||||||
output_stream: "test_output"
|
output_stream: "test_output"
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, "ALLOW", true);
|
RunTimeStep(kTimestampValue0, "ALLOW", true);
|
||||||
constexpr int64 kTimestampValue1 = 43;
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
RunTimeStep(kTimestampValue1, "ALLOW", false);
|
RunTimeStep(kTimestampValue1, "ALLOW", false);
|
||||||
constexpr int64 kTimestampValue2 = 44;
|
constexpr int64_t kTimestampValue2 = 44;
|
||||||
RunTimeStep(kTimestampValue2, "ALLOW", true);
|
RunTimeStep(kTimestampValue2, "ALLOW", true);
|
||||||
constexpr int64 kTimestampValue3 = 45;
|
constexpr int64_t kTimestampValue3 = 45;
|
||||||
RunTimeStep(kTimestampValue3, "ALLOW", false);
|
RunTimeStep(kTimestampValue3, "ALLOW", false);
|
||||||
|
|
||||||
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
||||||
@@ -288,13 +297,13 @@ TEST_F(GateCalculatorTest, Disallow) {
|
|||||||
output_stream: "test_output"
|
output_stream: "test_output"
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, "DISALLOW", true);
|
RunTimeStep(kTimestampValue0, "DISALLOW", true);
|
||||||
constexpr int64 kTimestampValue1 = 43;
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
RunTimeStep(kTimestampValue1, "DISALLOW", false);
|
RunTimeStep(kTimestampValue1, "DISALLOW", false);
|
||||||
constexpr int64 kTimestampValue2 = 44;
|
constexpr int64_t kTimestampValue2 = 44;
|
||||||
RunTimeStep(kTimestampValue2, "DISALLOW", true);
|
RunTimeStep(kTimestampValue2, "DISALLOW", true);
|
||||||
constexpr int64 kTimestampValue3 = 45;
|
constexpr int64_t kTimestampValue3 = 45;
|
||||||
RunTimeStep(kTimestampValue3, "DISALLOW", false);
|
RunTimeStep(kTimestampValue3, "DISALLOW", false);
|
||||||
|
|
||||||
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
const std::vector<Packet>& output = runner()->Outputs().Get("", 0).packets;
|
||||||
@@ -314,13 +323,13 @@ TEST_F(GateCalculatorTest, AllowWithStateChange) {
|
|||||||
output_stream: "STATE_CHANGE:state_changed"
|
output_stream: "STATE_CHANGE:state_changed"
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, "ALLOW", false);
|
RunTimeStep(kTimestampValue0, "ALLOW", false);
|
||||||
constexpr int64 kTimestampValue1 = 43;
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
RunTimeStep(kTimestampValue1, "ALLOW", true);
|
RunTimeStep(kTimestampValue1, "ALLOW", true);
|
||||||
constexpr int64 kTimestampValue2 = 44;
|
constexpr int64_t kTimestampValue2 = 44;
|
||||||
RunTimeStep(kTimestampValue2, "ALLOW", true);
|
RunTimeStep(kTimestampValue2, "ALLOW", true);
|
||||||
constexpr int64 kTimestampValue3 = 45;
|
constexpr int64_t kTimestampValue3 = 45;
|
||||||
RunTimeStep(kTimestampValue3, "ALLOW", false);
|
RunTimeStep(kTimestampValue3, "ALLOW", false);
|
||||||
|
|
||||||
const std::vector<Packet>& output =
|
const std::vector<Packet>& output =
|
||||||
@@ -332,6 +341,35 @@ TEST_F(GateCalculatorTest, AllowWithStateChange) {
|
|||||||
EXPECT_EQ(false, output[1].Get<bool>()); // Disallow.
|
EXPECT_EQ(false, output[1].Get<bool>()); // Disallow.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(GateCalculatorTest, AllowWithStateChangeNoDataStreams) {
|
||||||
|
SetRunner(R"(
|
||||||
|
calculator: "GateCalculator"
|
||||||
|
input_stream: "ALLOW:gating_stream"
|
||||||
|
output_stream: "STATE_CHANGE:state_changed"
|
||||||
|
)");
|
||||||
|
|
||||||
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
|
RunTimeStepWithoutDataStream(kTimestampValue0, "ALLOW", false);
|
||||||
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
|
RunTimeStepWithoutDataStream(kTimestampValue1, "ALLOW", true);
|
||||||
|
constexpr int64_t kTimestampValue2 = 44;
|
||||||
|
RunTimeStepWithoutDataStream(kTimestampValue2, "ALLOW", true);
|
||||||
|
constexpr int64_t kTimestampValue3 = 45;
|
||||||
|
RunTimeStepWithoutDataStream(kTimestampValue3, "ALLOW", false);
|
||||||
|
LOG(INFO) << "a";
|
||||||
|
const std::vector<Packet>& output =
|
||||||
|
runner()->Outputs().Get("STATE_CHANGE", 0).packets;
|
||||||
|
LOG(INFO) << "s";
|
||||||
|
ASSERT_EQ(2, output.size());
|
||||||
|
LOG(INFO) << "d";
|
||||||
|
EXPECT_EQ(kTimestampValue1, output[0].Timestamp().Value());
|
||||||
|
EXPECT_EQ(kTimestampValue3, output[1].Timestamp().Value());
|
||||||
|
LOG(INFO) << "f";
|
||||||
|
EXPECT_EQ(true, output[0].Get<bool>()); // Allow.
|
||||||
|
EXPECT_EQ(false, output[1].Get<bool>()); // Disallow.
|
||||||
|
LOG(INFO) << "g";
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(GateCalculatorTest, DisallowWithStateChange) {
|
TEST_F(GateCalculatorTest, DisallowWithStateChange) {
|
||||||
SetRunner(R"(
|
SetRunner(R"(
|
||||||
calculator: "GateCalculator"
|
calculator: "GateCalculator"
|
||||||
@@ -341,13 +379,13 @@ TEST_F(GateCalculatorTest, DisallowWithStateChange) {
|
|||||||
output_stream: "STATE_CHANGE:state_changed"
|
output_stream: "STATE_CHANGE:state_changed"
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, "DISALLOW", true);
|
RunTimeStep(kTimestampValue0, "DISALLOW", true);
|
||||||
constexpr int64 kTimestampValue1 = 43;
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
RunTimeStep(kTimestampValue1, "DISALLOW", false);
|
RunTimeStep(kTimestampValue1, "DISALLOW", false);
|
||||||
constexpr int64 kTimestampValue2 = 44;
|
constexpr int64_t kTimestampValue2 = 44;
|
||||||
RunTimeStep(kTimestampValue2, "DISALLOW", false);
|
RunTimeStep(kTimestampValue2, "DISALLOW", false);
|
||||||
constexpr int64 kTimestampValue3 = 45;
|
constexpr int64_t kTimestampValue3 = 45;
|
||||||
RunTimeStep(kTimestampValue3, "DISALLOW", true);
|
RunTimeStep(kTimestampValue3, "DISALLOW", true);
|
||||||
|
|
||||||
const std::vector<Packet>& output =
|
const std::vector<Packet>& output =
|
||||||
@@ -359,6 +397,31 @@ TEST_F(GateCalculatorTest, DisallowWithStateChange) {
|
|||||||
EXPECT_EQ(false, output[1].Get<bool>()); // Disallow.
|
EXPECT_EQ(false, output[1].Get<bool>()); // Disallow.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(GateCalculatorTest, DisallowWithStateChangeNoDataStreams) {
|
||||||
|
SetRunner(R"(
|
||||||
|
calculator: "GateCalculator"
|
||||||
|
input_stream: "DISALLOW:gating_stream"
|
||||||
|
output_stream: "STATE_CHANGE:state_changed"
|
||||||
|
)");
|
||||||
|
|
||||||
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
|
RunTimeStepWithoutDataStream(kTimestampValue0, "DISALLOW", true);
|
||||||
|
constexpr int64_t kTimestampValue1 = 43;
|
||||||
|
RunTimeStepWithoutDataStream(kTimestampValue1, "DISALLOW", false);
|
||||||
|
constexpr int64_t kTimestampValue2 = 44;
|
||||||
|
RunTimeStepWithoutDataStream(kTimestampValue2, "DISALLOW", false);
|
||||||
|
constexpr int64_t kTimestampValue3 = 45;
|
||||||
|
RunTimeStepWithoutDataStream(kTimestampValue3, "DISALLOW", true);
|
||||||
|
|
||||||
|
const std::vector<Packet>& output =
|
||||||
|
runner()->Outputs().Get("STATE_CHANGE", 0).packets;
|
||||||
|
ASSERT_EQ(2, output.size());
|
||||||
|
EXPECT_EQ(kTimestampValue1, output[0].Timestamp().Value());
|
||||||
|
EXPECT_EQ(kTimestampValue3, output[1].Timestamp().Value());
|
||||||
|
EXPECT_EQ(true, output[0].Get<bool>()); // Allow.
|
||||||
|
EXPECT_EQ(false, output[1].Get<bool>()); // Disallow.
|
||||||
|
}
|
||||||
|
|
||||||
// Must not detect disallow value for first timestamp as a state change.
|
// Must not detect disallow value for first timestamp as a state change.
|
||||||
TEST_F(GateCalculatorTest, DisallowInitialNoStateTransition) {
|
TEST_F(GateCalculatorTest, DisallowInitialNoStateTransition) {
|
||||||
SetRunner(R"(
|
SetRunner(R"(
|
||||||
@@ -369,7 +432,7 @@ TEST_F(GateCalculatorTest, DisallowInitialNoStateTransition) {
|
|||||||
output_stream: "STATE_CHANGE:state_changed"
|
output_stream: "STATE_CHANGE:state_changed"
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, "DISALLOW", false);
|
RunTimeStep(kTimestampValue0, "DISALLOW", false);
|
||||||
|
|
||||||
const std::vector<Packet>& output =
|
const std::vector<Packet>& output =
|
||||||
@@ -387,7 +450,7 @@ TEST_F(GateCalculatorTest, AllowInitialNoStateTransition) {
|
|||||||
output_stream: "STATE_CHANGE:state_changed"
|
output_stream: "STATE_CHANGE:state_changed"
|
||||||
)");
|
)");
|
||||||
|
|
||||||
constexpr int64 kTimestampValue0 = 42;
|
constexpr int64_t kTimestampValue0 = 42;
|
||||||
RunTimeStep(kTimestampValue0, "ALLOW", true);
|
RunTimeStep(kTimestampValue0, "ALLOW", true);
|
||||||
|
|
||||||
const std::vector<Packet>& output =
|
const std::vector<Packet>& output =
|
||||||
@@ -395,5 +458,29 @@ TEST_F(GateCalculatorTest, AllowInitialNoStateTransition) {
|
|||||||
ASSERT_EQ(0, output.size());
|
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
|
||||||
} // namespace mediapipe
|
} // namespace mediapipe
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "mediapipe/framework/formats/classification.pb.h"
|
#include "mediapipe/framework/formats/classification.pb.h"
|
||||||
#include "mediapipe/framework/formats/detection.pb.h"
|
#include "mediapipe/framework/formats/detection.pb.h"
|
||||||
#include "mediapipe/framework/formats/landmark.pb.h"
|
#include "mediapipe/framework/formats/landmark.pb.h"
|
||||||
|
#include "mediapipe/framework/formats/rect.pb.h"
|
||||||
|
|
||||||
namespace mediapipe {
|
namespace mediapipe {
|
||||||
namespace api2 {
|
namespace api2 {
|
||||||
@@ -37,5 +38,12 @@ using GetDetectionVectorItemCalculator =
|
|||||||
GetVectorItemCalculator<mediapipe::Detection>;
|
GetVectorItemCalculator<mediapipe::Detection>;
|
||||||
REGISTER_CALCULATOR(GetDetectionVectorItemCalculator);
|
REGISTER_CALCULATOR(GetDetectionVectorItemCalculator);
|
||||||
|
|
||||||
|
using GetNormalizedRectVectorItemCalculator =
|
||||||
|
GetVectorItemCalculator<NormalizedRect>;
|
||||||
|
REGISTER_CALCULATOR(GetNormalizedRectVectorItemCalculator);
|
||||||
|
|
||||||
|
using GetRectVectorItemCalculator = GetVectorItemCalculator<Rect>;
|
||||||
|
REGISTER_CALCULATOR(GetRectVectorItemCalculator);
|
||||||
|
|
||||||
} // namespace api2
|
} // namespace api2
|
||||||
} // namespace mediapipe
|
} // namespace mediapipe
|
||||||
|
|||||||
@@ -94,17 +94,17 @@ class GraphProfileCalculatorTest : public ::testing::Test {
|
|||||||
&graph_config_));
|
&graph_config_));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Packet PacketAt(int64 ts) {
|
static Packet PacketAt(int64_t ts) {
|
||||||
return Adopt(new int64(999)).At(Timestamp(ts));
|
return Adopt(new int64_t(999)).At(Timestamp(ts));
|
||||||
}
|
}
|
||||||
static Packet None() { return Packet().At(Timestamp::OneOverPostStream()); }
|
static Packet None() { return Packet().At(Timestamp::OneOverPostStream()); }
|
||||||
static bool IsNone(const Packet& packet) {
|
static bool IsNone(const Packet& packet) {
|
||||||
return packet.Timestamp() == Timestamp::OneOverPostStream();
|
return packet.Timestamp() == Timestamp::OneOverPostStream();
|
||||||
}
|
}
|
||||||
// Return the values of the timestamps of a vector of Packets.
|
// Return the values of the timestamps of a vector of Packets.
|
||||||
static std::vector<int64> TimestampValues(
|
static std::vector<int64_t> TimestampValues(
|
||||||
const std::vector<Packet>& packets) {
|
const std::vector<Packet>& packets) {
|
||||||
std::vector<int64> result;
|
std::vector<int64_t> result;
|
||||||
for (const Packet& p : packets) {
|
for (const Packet& p : packets) {
|
||||||
result.push_back(p.Timestamp().Value());
|
result.push_back(p.Timestamp().Value());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,17 +191,17 @@ class ImmediateMuxCalculatorTest : public ::testing::Test {
|
|||||||
&graph_config_));
|
&graph_config_));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Packet PacketAt(int64 ts) {
|
static Packet PacketAt(int64_t ts) {
|
||||||
return Adopt(new int64(999)).At(Timestamp(ts));
|
return Adopt(new int64_t(999)).At(Timestamp(ts));
|
||||||
}
|
}
|
||||||
static Packet None() { return Packet().At(Timestamp::OneOverPostStream()); }
|
static Packet None() { return Packet().At(Timestamp::OneOverPostStream()); }
|
||||||
static bool IsNone(const Packet& packet) {
|
static bool IsNone(const Packet& packet) {
|
||||||
return packet.Timestamp() == Timestamp::OneOverPostStream();
|
return packet.Timestamp() == Timestamp::OneOverPostStream();
|
||||||
}
|
}
|
||||||
// Return the values of the timestamps of a vector of Packets.
|
// Return the values of the timestamps of a vector of Packets.
|
||||||
static std::vector<int64> TimestampValues(
|
static std::vector<int64_t> TimestampValues(
|
||||||
const std::vector<Packet>& packets) {
|
const std::vector<Packet>& packets) {
|
||||||
std::vector<int64> result;
|
std::vector<int64_t> result;
|
||||||
for (const Packet& p : packets) {
|
for (const Packet& p : packets) {
|
||||||
result.push_back(p.Timestamp().Value());
|
result.push_back(p.Timestamp().Value());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class MatrixToVectorCalculatorTest
|
|||||||
void SetUp() override { calculator_name_ = "MatrixToVectorCalculator"; }
|
void SetUp() override { calculator_name_ = "MatrixToVectorCalculator"; }
|
||||||
|
|
||||||
void AppendInput(const std::vector<float>& column_major_data,
|
void AppendInput(const std::vector<float>& column_major_data,
|
||||||
int64 timestamp) {
|
int64_t timestamp) {
|
||||||
ASSERT_EQ(num_input_samples_ * num_input_channels_,
|
ASSERT_EQ(num_input_samples_ * num_input_channels_,
|
||||||
column_major_data.size());
|
column_major_data.size());
|
||||||
Eigen::Map<const Matrix> data_map(&column_major_data[0],
|
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");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user