树莓派aarch64架构下运行TFLite基准工具遇依赖问题求助
解决树莓派aarch64架构下TensorFlow Lite benchmark_model的库版本缺失问题
问题根源
你遇到的错误是因为下载的预编译benchmark_model工具基于更高版本的GLIBC和libstdc++编译,而树莓派当前系统的库版本低于工具要求,导致兼容性问题。
解决方案
方案1:从源码编译适配树莓派的benchmark_model
这是最稳妥的兼容方案:
- 安装编译依赖:
sudo apt update && sudo apt install -y build-essential cmake git libopencv-dev python3-dev - 克隆指定稳定版本的TensorFlow仓库(以2.15版本为例):
git clone --depth 1 --branch v2.15.0 https://github.com/tensorflow/tensorflow.git cd tensorflow - 配置编译参数:
./configure # 配置过程中大部分选项选默认,确认本地编译(不启用交叉编译) - 编译benchmark_model工具:
bazel build -c opt //tensorflow/lite/tools/benchmark:benchmark_model - 编译完成后,在
bazel-bin/tensorflow/lite/tools/benchmark/目录找到生成的benchmark_model,复制到工作目录即可使用。
方案2:升级系统库(注意风险)
若不想编译,可尝试升级系统库,但可能影响部分旧软件运行:
- 更新系统包列表:
sudo apt update - 升级libstdc++6:
sudo apt install --only-upgrade libstdc++6 - 对于GLIBC,树莓派官方源的版本与系统版本绑定,若当前系统版本较旧,需升级系统:
重启后检查库版本是否满足工具要求。sudo apt full-upgrade sudo reboot
方案3:下载匹配系统版本的预编译工具
在TensorFlow官方发布资源中,筛选针对树莓派aarch64、且编译依赖版本较低的旧版benchmark_model预编译文件,替换当前使用的工具。
内容的提问来源于stack exchange,提问作者krisna Dwi Nurikhsani
相关产品推荐
相关产品推荐

