pb编译生成tflite文件

这篇博客介绍了如何使用TensorFlow将.pb模型文件转换为tflite格式,包括通过冻图生成tflite文件的步骤和通过.ckpt与结构.pb文件的转换方法。同时,博主分享了adb调试过程以及遇到的Bug1及其解决策略,提供了参考资料链接。
摘要由CSDN通过智能技术生成

通过冻图生成tflite文件:

tensorflow-master$> bazel build tensorflow/contrib/lite/toco:toco

tensorflow-master$> bazel-bin/tensorflow/contrib/lite/toco/toco \
	--input_file=/home/tclxa/TCL/tmp/frozen_model.pb  \
	--input_format=TENSORFLOW_GRAPHDEF \
	--output_format=TFLITE \
	--output_file=/home/tclxa/TCL/tmp/mobilenet_quant_v1_224.tflite \
	--inference_type=FLOAT \
	--input_type=FLOAT \
	--input_arrays=input \
	--output_arrays=MobilenetV1/Predictions/Reshape_1 \
	--input_shapes=1,224,224,3

–output_file、–inference_type、–input_type、–input_arrays、–output_arrays、–input_shapes需要根据自己模型说明作相应的修改

通过ckpt和结构pb生成冻图:.ckpt和结构.pb文件

tensorflow-master$> bazel build tensorflow/python/tools:freeze_graph

tensorflow-master$> bazel-bin/tensorflow/python/tools/freeze_graph \
	--input_graph=/home/tclxa/TCL/tmp/mobilenet_v1_224.pb \
	--input
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值