标签 tflite 下的文章

Tensorflow-lite

https://tensorflow.google.cn/lite/guide/build_cmake?hl=zh-cn

Download git - tensorflow

cd ~
mkdir tflite-micro
cd tflite-micro

git clone https://github.com/tensorflow/tensorflow

cd tensorflow

Install deps

  • Ubuntu
sudo apt-get update
sudo apt-get install git build-essential cmake python3 python3-pip
  • macos
brew install git cmake python

Download & instal Bazel

  • 安装 Bazelisk(自动管理 Bazel 版本)
curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-amd64 -o /usr/local/bin/bazel
chmod +x /usr/local/bin/bazel
  • [推荐] 手动管理版本

首先进入 tensorflow 目录 查看 .bazelversion

7.4.1

比如 目录配置是 7.4.1 那么,就打开 bazel - git https://github.com/bazelbuild/bazel/releases 找到对应的版本,如

  • macos

https://github.com/bazelbuild/bazel/releases/download/7.4.1/bazel-7.4.1-darwin-arm64

  • linux

https://github.com/bazelbuild/bazel/releases/download/7.4.1/bazel-7.4.1-linux-x86_64


tflite-micro

1. download tflite-micro

git clone https://github.com/tensorflow/tflite-micro
cd tflite-micro

2. download the suitable version of bazel

cat .bazelversion

# result like 7.0.0

go to https://github.com/bazelbuild/bazel/releases

and download the bazel binary package

mkdir ~/tools/bazel/7.0.0
cd ~/tools/bazel/7.0.0

wget https://github.com/bazelbuild/bazel/releases/download/7.0.0/bazel-7.0.0-linux-x86_64

chmod +x bazel-7.0.0-linux-x86_64
# create link
ln -s bazel-7.0.0-linux-x86_64 bazel

set the env

vi ~/.bashrc

or

vi ~/.zshrc # macos
# bazel_env_start
export PATH="~/tools/bazel/7.0.0:$PATH"
# bazel_env_end

flush the rcfile

# bash
source ~/.bashrc

# zsh
source ~/.zshrc

Now the env setting is done.

check the version of cmd bazel

bazel --version

# terminal shows below
bazel 7.0.0