windows Docker tengine模型转换工具的安装与使用

windows Docker tengine模型转换工具的安装与使用

最近在开发板上用Tengine做模型推理,遇到了模型不能使用的问题,对模型转换工具安装与使用做一个记录

模型转换工具安装

官网
找一个目录把官网代码clone下来
然后再这个目录

mkdir build && cd build
cmake ..
make -j`nproc` && make install

cmake阶段遇到了如下问题,反正也不用oneflow,就直接加参数了cmake -DBUILD_ONEFLOW_SERIALIZER=OFF ..

root@531776024d67:/home/tengine/build# cmake ..
-- CMAKE_INSTALL_PREFIX = /home/tengine/build/install
-- The CXX compiler identification is GNU 7.5.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:59 (message):
  Please upgrade your cmake (maybe by "pip3 install -U cmake") or disable
  OneFlow serializer by "cmake -DBUILD_ONEFLOW_SERIALIZER=OFF .."


-- Configuring incomplete, errors occurred!
See also "/home/tengine/build/CMakeFiles/CMakeOutput.log".
See also "/home/tengine/build/CMakeFiles/CMakeError.log".

模型转换工具使用

我的需求是pd转tmfile,直接用模型转换工具未能成功,之后采用pd转tflite,tflite转tmfile

pd转tflite

参考

import tensorflow as tf

# Convert the model
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir) # path to the SavedModel directory
tflite_model = converter.convert()

# Save the model.
with open('model.tflite', 'wb') as f:
   f.write(tflite_model)

tflite转tmfile

 ./install/bin/convert_tool -f tflite -m ../model.tflite -o model.tmfile
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值