MediaPipe框架- 疑难解答

Troubleshooting

疑难解答

Missing Python binary path

缺少Python二进制路径

The error message:

错误消息:

ERROR: An error occurred during the fetch of repository 'local_execution_config_python':
  Traceback (most recent call last):
       File "/sandbox_path/external/org_tensorflow/third_party/py/python_configure.bzl", line 208
               get_python_bin(repository_ctx)
    ...
Repository command failed

usually indicates that Bazel fails to find the local Python binary. To solve this issue, please first find where the python binary is and then add --action_env PYTHON_BIN_PATH=<path to python binary> to the Bazel command. For example, you can switch to use the system default python3 binary by the following command:

通常表示Bazel无法找到本地Python二进制文件。要解决此问题,请首先找到python二进制文件的位置,然后将--action_env PYTHON_BIN_PATH=<PATH To python binary>添加到Bazel命令中。例如,可以通过以下命令切换为使用系统默认的python3二进制文件:

bazel build -c opt \
  --define MEDIAPIPE_DISABLE_GPU=1 \
  --action_env PYTHON_BIN_PATH=$(which python3) \
  mediapipe/examples/desktop/hello_world

Missing necessary Python packages

缺少必要的Python包

The error message:

错误消息:

ImportError: No module named numpy
Is numpy installed?

usually indicates that certain Python packages are not installed. Please run pip install or pip3 install depending on your Python binary version to install those packages.

通常表示没有安装某些Python包。请根据Python二进制版本运行pip install或pip3 install来安装这些包。

Fail to fetch remote dependency repositories

无法获取远程依赖关系存储库

The error message:

错误消息:

ERROR: An error occurred during the fetch of repository 'org_tensorflow':
   java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/77e9ffb9b2bfb1a4f7056e62d84039626923e328.tar.gz, https://github.com/tensorflow/tensorflow/archive/77e9ffb9b2bfb1a4f7056e62d84039626923e328.tar.gz] to /sandbox_path/external/org_tensorflow/77e9ffb9b2bfb1a4f7056e62d84039626923e328.tar.gz: Tried to reconnect at offset 9,944,151 but server didn't support it

or

WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_swift/releases/download/0.12.1/rules_swift.0.12.1.tar.gz failed: class java.net.ConnectException Connection timed out (Connection timed out)

usually indicates that Bazel fails to download necessary dependency repositories that MediaPipe needs. MedaiPipe has several dependency repositories that are hosted by Google sites. In some regions, you may need to set up a network proxy or use a VPN to access those resources. You may also need to append --host_jvm_args "-DsocksProxyHost=<ip address> -DsocksProxyPort=<port number>" to the Bazel command. See this GitHub issue for more details.

​通常表示Bazel无法下载MediaPipe所需的必要的依赖关系存储库。MedaiPipe有几个由谷歌网站托管的依赖性存储库。在某些地区,可能需要设置网络代理或使用VPN来访问这些资源。可能还需要将--host_jvm_args "-DsocksProxyHost=<ip address> -DsocksProxyPort=<port number>"”附加到Bazel命令。有关更多详细信息,请参阅本期GitHub。

If you believe that it's not a network issue, another possibility is that some resources could be temporarily unavailable, please run bazel clean --expunge and retry it later. If it's still not working, please file a GitHub issue with the detailed error message.

如果认为这不是网络问题,另一种可能性是某些资源可能暂时不可用,请运行bazel clean  --expunge,稍后重试。如果它仍然不起作用,请提交一个GitHub问题,并附上详细的错误消息。

Incorrect MediaPipe OpenCV config

MediaPipe OpenCV配置不正确

The error message:

错误消息:

error: undefined reference to 'cv::String::deallocate()'
error: undefined reference to 'cv::String::allocate(unsigned long)'
error: undefined reference to 'cv::VideoCapture::VideoCapture(cv::String const&)'
...
error: undefined reference to 'cv::putText(cv::InputOutputArray const&, cv::String const&, cv::Point, int, double, cv::Scalar, int, int, bool)'

usually indicates that OpenCV is not properly configured for MediaPipe. Please take a look at the "Install OpenCV and FFmpeg" sections in Installation to see how to modify MediaPipe's WORKSPACE and linux_opencv/macos_opencv/windows_opencv.BUILD files for your local opencv libraries. This GitHub issue may also help.

​通常表示没有为MediaPipe正确配置OpenCV。请查看安装中的“安装OpenCV和FFmpeg”部分,了解如何修改MediaPipe的WORKSPACE和linux_opencv/macos_opencv/windows_opencv.BUILD为本地opencv库构建文件。这个GitHub问题也可能有所帮助。

Python pip install failure

Python pip安装失败

The error message:

错误消息:

ERROR: Could not find a version that satisfies the requirement mediapipe
ERROR: No matching distribution found for mediapipe

after running pip install mediapipe usually indicates that there is no qualified MediaPipe Python for your system. Please note that MediaPipe Python PyPI officially supports the 64-bit version of Python 3.7 to 3.10 on the following OS:

在运行pip install mediapipe之后,通常表示您的系统没有合格的mediapipe Python。请注意,MediaPipe Python PyPI在以下操作系统上正式支持64位版本的Python 3.7至3.10:

  • x86_64 Linux
  • x86_64 macOS 10.15+
  • amd64 Windows

If the OS is currently supported and you still see this error, please make sure that both the Python and pip binary are for Python 3.7 to 3.10. Otherwise, please consider building the MediaPipe Python package locally by following the instructions here.

​如果当前支持该操作系统,但仍然看到此错误,请确保Python和pip二进制文件都适用于Python 3.7到3.10。否则,请考虑按照此处的说明在本地构建MediaPipe Python包。

Python DLL load failure on Windows

Windows上的Python DLL加载失败

The error message:

错误消息:

ImportError: DLL load failed: The specified module could not be found

usually indicates that the local Windows system is missing Visual C++ redistributable packages and/or Visual C++ runtime DLLs. This can be solved by either installing the official vc_redist.x64.exe or installing the "msvc-runtime" Python package by running

​通常表示本地Windows系统缺少Visual C++可再发行包或Visual C++运行时DLL。这可以通过安装官方的vc_redist.x64.exe或通过运行

$ python -m pip install msvc-runtime

Please note that the "msvc-runtime" Python package is not released or maintained by Microsoft.

请注意,“msvc运行时”Python包不是由Microsoft发布或维护的。

Native method not found

未找到本机方法

The error message:

错误消息:

java.lang.UnsatisfiedLinkError: No implementation found for void com.google.wick.Wick.nativeWick

usually indicates that a needed native library, such as /libwickjni.so has not been loaded or has not been included in the dependencies of the app or cannot be found for some reason. Note that Java requires every native library to be explicitly loaded using the function System.loadLibrary.

通常表示所需的本机库,如/libwickjni.so,尚未加载或未包含在应用程序的依赖项中,或者由于某种原因无法找到。请注意,Java要求使用函数System.loadLibrary显式加载每个本机库。

No registered calculator found

找不到注册的计算器

The error message:

错误消息:

No registered object with name: OurNewCalculator; Unable to find Calculator "OurNewCalculator"

usually indicates that OurNewCalculator is referenced by name in a CalculatorGraphConfig but that the library target for OurNewCalculator has not been linked to the application binary. When a new calculator is added to a calculator graph, that calculator must also be added as a build dependency of the applications using the calculator graph.

​通常表示OurNewCalculator在CalculatorGraphConfig中按名称引用,但OurNewCalculator的库目标尚未链接到应用程序二进制文件。将新计算器添加到计算器图中时,还必须将该计算器添加为使用计算器图的应用程序的构建依赖项。

This error is caught at runtime because calculator graphs reference their calculators by name through the field CalculatorGraphConfig::Node:calculator. When the library for a calculator is linked into an application binary, the calculator is automatically registered by name through the REGISTER_CALCULATOR macro using the registration.h library. Note that REGISTER_CALCULATOR can register a calculator with a namespace prefix, identical to its C++ namespace. In this case, the calculator graph must also use the same namespace prefix.

​此错误在运行时被捕获,因为计算器图通过字段CalculatorGraphConfig::Node:calculator按名称引用其计算器。当计算器的库链接到应用程序二进制文件中时,计算器会使用registration.h库通过REGISTER_CALCULATION宏按名称自动注册。请注意,REGISTER_CALCULATION可以使用与其C++命名空间相同的命名空间前缀注册计算器。在这种情况下,计算器图也必须使用相同的名称空间前缀。

Out Of Memory error

内存不足错误

Exhausting memory can be a symptom of too many packets accumulating inside a running MediaPipe graph. This can occur for a number of reasons, such as:

耗尽内存可能是运行中的MediaPipe图中累积了太多数据包的症状。发生这种情况的原因有很多,例如:

1.Some calculators in the graph simply can't keep pace with the arrival of packets from a realtime input stream such as a video camera.

1.图中的一些计算器根本无法跟上来自实时输入流(如摄像机)的数据包的到来。

2.Some calculators are waiting for packets that will never arrive.

2.有些计算器正在等待永远不会到达的数据包。

For problem (1), it may be necessary to drop some old packets in older to process the more recent packets. For some hints, see: How to process realtime input streams.

​对于问题(1),可能有必要丢弃旧包中的一些旧包,以处理最近的包。有关一些提示,请参阅:如何处理实时输入流。

For problem (2), it could be that one input stream is lacking packets for some reason. A device or a calculator may be misconfigured or may produce packets only sporadically. This can cause downstream calculators to wait for many packets that will never arrive, which in turn causes packets to accumulate on some of their input streams. MediaPipe addresses this sort of problem using "timestamp bounds". For some hints see: How to process realtime input streams.

​对于问题(2),可能是由于某种原因,一个输入流缺少分组。设备或计算器可能配置错误,或者可能只是偶尔产生数据包。这可能导致下游计算器等待许多永远不会到达的数据包,这反过来又导致数据包在其一些输入流上积累。MediaPipe使用“时间戳界限”来解决这类问题。有关一些提示,请参阅:如何处理实时输入流。

The MediaPipe setting CalculatorGraphConfig::max_queue_size limits the number of packets enqueued on any input stream by throttling inputs to the graph. For realtime input streams, the number of packets queued at an input stream should almost always be zero or one. If this is not the case, you may see the following warning message:

​MediaPipe设置CalculatorGraphConfig::max_queue_size通过限制图形的输入来限制在任何输入流上排队的数据包数量。对于实时输入流,在输入流处排队的数据包的数量几乎总是零或一。如果不是这样,可能会看到以下警告消息:

Resolved a deadlock by increasing max_queue_size of input stream

Also, the setting CalculatorGraphConfig::report_deadlock can be set to cause graph run to fail and surface the deadlock as an error, such that max_queue_size to acts as a memory usage limit.

​此外,可以将设置CalculatorGraphConfig::report_deadlock设置为导致图运行失败并将死锁显示为错误,从而使max_queue_size作为内存使用限制。

Graph hangs

图挂起

Many applications will call CalculatorGraph::CloseAllPacketSources and CalculatorGraph::WaitUntilDone to finish or suspend execution of a MediaPipe graph. The objective here is to allow any pending calculators or packets to complete processing, and then to shutdown the graph. If all goes well, every stream in the graph will reach Timestamp::Done, and every calculator will reach CalculatorBase::Close, and then CalculatorGraph::WaitUntilDone will complete successfully.

​许多应用程序将调用CalculatorGraph::CloseAllPacketSources和CalculatorGraph::WaitUntilDone来完成或挂起MediaPipe图的执行。这里的目标是允许任何挂起的计算器或数据包完成处理,然后关闭图。如果一切顺利,图中的每个流都将达到Timestamp::Done,每个计算器都将达到CalculatorBase::Close,然后CalculatorGraph::WaitUntilDone将成功完成。

If some calculators or streams cannot reach state Timestamp::Done or CalculatorBase::Close, then the method CalculatorGraph::Cancel can be called to terminate the graph run without waiting for all pending calculators and packets to complete.

​如果某些计算器或流无法达到状态Timestamp::Done或CalculatorBase::Close,则可以调用CalculatorGraph::Cancel方法来终止图运行,而无需等待所有挂起的计算器和数据包完成。

Output timing is uneven

输出定时不均匀

Some realtime MediaPipe graphs produce a series of video frames for viewing as a video effect or as a video diagnostic. Sometimes, a MediaPipe graph will produce these frames in clusters, for example when several output frames are extrapolated from the same cluster of input frames. If the outputs are presented as they are produced, some output frames are immediately replaced by later frames in the same cluster, which makes the results hard to see and evaluate visually. In cases like this, the output visualization can be improved by presenting the frames at even intervals in real time.

一些实时MediaPipe图会生成一系列视频帧,以作为视频效果或视频诊断进行查看。有时,MediaPipe图会在集群中生成这些帧,例如,当从同一输入帧集群中外推出几个输出帧时。如果输出是在产生时呈现的,那么一些输出帧会立即被同一集群中的后续帧所取代,这使得结果很难直观地看到和评估。在这种情况下,可以通过以均匀的时间间隔实时呈现帧来改进输出可视化。

MediaPipe addresses this use case by mapping timestamps to points in real time. Each timestamp indicates a time in microseconds, and a calculator such as LiveClockSyncCalculator can delay the output of packets to match their timestamps. This sort of calculator adjusts the timing of outputs such that:

MediaPipe通过将时间戳映射到实时点来解决这个用例。每个时间戳以微秒为单位表示一个时间,LiveClockSyncCalculator等计算器可以延迟数据包的输出以匹配其时间戳。这种计算器调整输出的定时,以便:

1.The time between outputs corresponds to the time between timestamps as closely as possible.

1.输出之间的时间尽可能接近地对应于时间戳之间的时间。

2.Outputs are produced with the smallest delay possible.

2.以尽可能小的延迟产生输出。

CalculatorGraph lags behind inputs

CalculatorGraph落后于输入

For many realtime MediaPipe graphs, low latency is an objective. MediaPipe supports "pipelined" style parallel processing in order to begin processing of each packet as early as possible. Normally the lowest possible latency is the total time required by each calculator along a "critical path" of successive calculators. The latency of the a MediaPipe graph could be worse than the ideal due to delays introduced to display frames a even intervals as described in Output timing is uneven.

​对于许多实时MediaPipe图,低延迟是一个目标。MediaPipe支持“流水线”式的并行处理,以便尽早开始处理每个数据包。通常,最低可能的延迟是每个计算器沿着连续计算器的“关键路径”所需的总时间。MediaPipe图的延迟可能比理想情况更糟,因为延迟是为了显示帧而引入的,如输出定时中所述的均匀间隔是不均匀的。

If some of the calculators in the graph cannot keep pace with the realtime input streams, then latency will continue to increase, and it becomes necessary to drop some input packets. The recommended technique is to use the MediaPipe calculators designed specifically for this purpose such as FlowLimiterCalculator as described in How to process realtime input streams.

​如果图中的一些计算器无法跟上实时输入流的步伐,那么延迟将继续增加,并且有必要丢弃一些输入数据包。建议使用专门为此目的设计的MediaPipe计算器,如“如何处理实时输入流”中所述的FlowLimiterCalculator。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值