尧图网站设计 尧图网站设计YAOTU DESIGN
ARTICLE DETAIL

资讯详情

深耕网站设计与一线实操的经验洞察。

MediaPipe排错手册:覆盖装不上来、编译不过、跑起来就崩与日志解读

MediaPipe排错手册:覆盖装不上来、编译不过、跑起来就崩与日志解读 MediaPipe排错手册覆盖装不上来、编译不过、跑起来就崩与日志解读【免费下载链接】mediapipeCross-platform, customizable ML solutions for live and streaming media.项目地址: https://gitcode.com/GitHub_Trending/med/mediapipeERROR: An error occurred during the fetch of repository local_execution_config_python: Traceback (most recent call last): File /your-path/external/org_tensorflow/third_party/py/python_configure.bzl, line 208 get_python_bin(repository_ctx) Repository command failed这是依赖没配对不是你的问题。MediaPipe 的报错基本集中在四类装不上来、编译不过、跑起来就崩、日志看不懂。下面按症状排每类给出看原文 → 判根因 → 敲命令 → 一行验证。装不上来pip、Bazel 拉依赖全卡住ImportError: No module named numpy缺包直接装ImportError: No module named numpy Is numpy installed?Bazel 拉 Python 依赖时用的是当前解释器的环境某个包没装就会原样抛回。仓库根目录的 requirements.txt 列了全部必要依赖pip install -r requirements.txt验证python -c import numpy; print(numpy.__version__)能打印版本号即过。python_configure.bzl get_python_binBazel 找不到解释器报错原文见开头。Bazel 定位不到 Python 二进制路径多半是 shell 里激活的解释器和构建配置不一致。在构建命令里显式指给它bazel build -c opt \ --define MEDIAPIPE_DISABLE_GPU1 \ --action_env PYTHON_BIN_PATH$(which python3) \ mediapipe/examples/desktop/hello_world验证这一步走到Compiling ...而不是ERROR: ... fetch就算通过。Error downloading ... Tried to reconnect依赖仓库拉不下来日志长这样换行截断为示意ERROR: An error occurred during the fetch of repository org_tensorflow: java.io.IOException: Error downloading [.../77e9ffb9b2bfb1a4f7056e62d84039626923e328.tar.gz] to /your-path/external/org_tensorflow/...: Tried to reconnect at offset 9,944,151大概率是网络MediaPipe 的多个依赖仓库托管在海外站点。两条路给 Bazel 加代理参数--host_jvm_args -DsocksProxyHostip -DsocksProxyPort端口确认网络没问题就清缓存重试bazel clean --expunge验证重新构建后日志出现Analyzing: target ... (0 packages loaded)且不再中断。依赖清单定义在 third_party/external_files.bzl排障时可对照检查。编译不过链接失败与标志报错undefined reference to cv::String::deallocate()OpenCV 配置错位error: undefined reference to cv::String::deallocate() error: undefined reference to cv::VideoCapture::VideoCapture(cv::String const) error: undefined reference to cv::putText(cv::InputOutputArray const, ...)这一串undefined reference to cv::全是同一个根因系统里的 OpenCV 版本、路径与 MediaPipe 的 WORKSPACE 声明对不上链接阶段找不到符号。跑仓库自带的 setup_opencv.sh —— 一键从源码装 OpenCV 并改好 WORKSPACE 和 third_party/opencv_linux.BUILDsh ./setup_opencv.sh只想改配置不重装就加参数sh ./setup_opencv.sh config_only。验证bazel build //mediapipe/examples/desktop/hello_world链接阶段通过无undefined reference。完整安装步骤见安装指南的 Install OpenCV and FFmpeg 一节。unsupported: avxvnniint8Clang 18 及更早不支持该标志CPU 后端XNNPACK会下发较新的优化标志老 Clang 直接拒绝编译。在 .bazelrc 里加一行关掉它build --definexnn_enable_avxvnniint8false验证重新构建该报错消失进入正常编译。跑起来就崩import 失败与注册丢失No matching distribution found for mediapipe系统不在预编译包支持范围ERROR: Could not find a version that satisfies the requirement mediapipe ERROR: No matching distribution found for mediapipePyPI 官方 wheel 只覆盖 x86_64 Linux、x86_64 macOS 10.15、amd64 Windows 的 64 位 Python。先确认python -V是 64 位不在支持列表就从源码构建仓库地址https://gitcode.com/GitHub_Trending/med/mediapipe克隆后按python setup.py bdist_wheel出包再装。完整步骤见Python 包构建指南的 Building MediaPipe Python Package。验证python -c import mediapipe无报错。ImportError: DLL load failedWindows 缺 VC 运行库ImportError: DLL load failed: The specified module could not be foundWindows 系统缺 Visual C 可再发行组件包mediapipe 的 DLL 加载不到依赖。补上即可python -m pip install msvc-runtime或从微软官网安装 vc_redist.x64.exe。验证python -c import mediapipe; print(mediapipe.__version__)打印版本号。No registered object with name: xxx计算器没链进去No registered object with name: OurNewCalculator; Unable to find Calculator OurNewCalculator图配置按名字引用计算器但该计算器的库没被链接进最终二进制——REGISTER_CALCULATOR的注册代码被链接器当作没人引用剪掉了。两个动作把你新建的cc_library加进使用方的deps并在该目标里加参数alwayslink True宏定义见 calculator_registry.h。验证重新链接运行图能正常Initialize不再报Unable to find Calculator。日志看不懂图挂起、流状态与数据可视化Graph hangs / 图挂起先开 runtime_info 拍快照图卡住、内存一直涨时先在图配置里打开enable_graph_runtime_info后台线程会周期性把哪些计算器在跑、哪些在等输入打到 LOG(INFO)Running calculators: PacketClonerCalculator Num packets in input queues: 4 GateCalculator_2 waiting on stream(s): :1:norm_start_rect MergeCalculator waiting on stream(s): :0:output_frames_gpu_ao, :1:segmentation_preview_gpu看waiting on stream(s)一行就能定位到卡在哪个流上——等的那个流多半就是断供的那条。Android 上日志可能被节流可改用mp_graph_runtime_info_output_file写文件。开启方式见图运行时监控文档。Missing packets / 输入不同步DebugInputStreamHandler 盯时间戳某个计算器输出异常、包数量对不上时在节点上指定input_stream_handler: DebugInputStreamHandler每个入队和每个时间戳结算都会打日志[INFO] SomeCalculator: Adding packet (ts:2, type:int) to stream INPUT_B:0:input_b [INFO] SomeCalculator: INPUT_A:0:input_a num_packets: 0 min_ts: 2 [INFO] SomeCalculator: INPUT_B:0:input_b num_packets: 1 min_ts: 2看到Filled input set at ts: 1 with MISSING packets in input streams: ...就说明时间戳边界提前了Process 被空包触发——去查缺包那条流的上游。中间数据对不对终端直接画 Tensor推理结果不对时与其猜不如把数据画出来。mediapipe/framework/debug/logging.h 提供debug::LogTensor(tensor)、debug::LogMat(mat)、debug::LogImage(image_frame)纯文本输出SSH 里也能用。终端支持真彩色$COLORTERM truecolor时输出低分辨率像素图否则退化为 ASCII 版。下面这张脸就是 600x600 的 Tensor 数据和上面那行调用对应VLOG 全静默分级打开别全局开MediaPipe 大量用 VLOG 记关键事件默认级别为 0 所以一条都不出。桌面端直接传参bazel run --configopt -- --vmodulecalculator_graph5,packet4Android 这类没法传命令行参数的环境改 mediapipe/framework/vlog_overrides.cc按文件头注释打开MEDIAPIPE_VLOG_V/MEDIAPIPE_VLOG_VMODULE两个宏重编即可不建议在构建命令里加-DMEDIAPIPE_VLOG_VMODULE那会触发全量重编。报错速查表报错关键字常见根因一行修复命令get_python_bin/local_execution_config_pythonBazel 找不到 Python 解释器bazel build ... --action_env PYTHON_BIN_PATH$(which python3)ImportError: No module named numpy当前解释器缺包pip install -r requirements.txtError downloading ... org_tensorflow网络拉不动依赖仓库bazel clean --expunge或加 socks 代理参数undefined reference to cv::OpenCV 配置与版本错位sh ./setup_opencv.shunsupported: avxvnniint8Clang 18 及更早不支持该标志.bazelrc加build --definexnn_enable_avxvnniint8falseNo matching distribution found for mediapipe系统不在 wheel 支持范围源码构建python setup.py bdist_wheelImportError: DLL load failedWindows 缺 VC 运行库python -m pip install msvc-runtimeNo registered object with name: xxx计算器库未链接 / 缺 alwayslink目标加alwayslink True并进使用方 deps图挂起、waiting on stream(s)某输入流断供图配置开enable_graph_runtime_info定位表里覆盖不到的情况去官方 Troubleshooting 文档按报错原文检索那里对每种错误的完整上下文都有记录。【免费下载链接】mediapipeCross-platform, customizable ML solutions for live and streaming media.项目地址: https://gitcode.com/GitHub_Trending/med/mediapipe创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表