tensorflow优化
来源:互联网 发布:机房网络改造注意事项 编辑:程序博客网 时间:2024/06/16 09:10
源码位置:
tensorflow/python/tools
tensorflow/tools/quantization
bin位置:
bazel-bin/tensorflow/python/tools
bazel-bin/tensorflow/tools/
例如:
tensorflow/python/tools
tensorflow/tools/quantization
bin位置:
bazel-bin/tensorflow/python/tools
bazel-bin/tensorflow/tools/
输出pb类型graph:
from tensorflow.python.framework import graph_iograph_io.write_graph(self.sess.graph,"./tests/", "input_graph.pb")
固化freeze_graph:
bazel build tensorflow/python/tools:freeze_graph&& \bazel-bin/tensorflow/python/tools/freeze_graph \--input_graph=some_graph_def.pb \--input_checkpoint=model.ckpt-8361242 \--output_graph=/tmp/frozen_graph.pb--output_node_names=softmax
例如:
bazel-bin/tensorflow/python/tools/freeze_graph--input_graph=./input_graph.pb--input_checkpoint=./VGGnet_fast_rcnn_iter_52700.ckpt --output_graph=./froze_graph1.pb --output_node_names=rois/Reshape,rois/PyFunc
优化optimize_for_inference:
bazel build tensorflow/python/tools:optimize_for_inference&& \bazel-bin/tensorflow/python/tools/optimize_for_inference \--input=frozen_inception_graph.pb \--output=optimized_inception_graph.pb \--frozen_graph=True \--input_names=Mul \--output_names=softmax
例如:
bazel-bin/tensorflow/python/tools/optimize_for_inference--input=froze_ctc.pb--output=optimized_ctc.pb--frozen_graph=True --input_names=Placeholder,seq_len--output_names=CTCGreedyDecoder--placeholder_type_enum=13
13的原理如下:
from tensorflow.python.framework import dtypesprint(dtypes.float32.as_datatype_enum)#1print(dtypes.int32.as_datatype_enum)#3
量化quantize_graph:
bazel build tensorflow/tools/quantization:quantize_graph \&&bazel-bin/tensorflow/tools/quantization/quantize_graph \--input=tensorflow_inception_graph.pb--output_node_names="softmax2" --print_nodes--output=/tmp/quantized_graph.pb \--mode=eightbit--logtostderr
例如:
bazel-bin/tensorflow/tools/quantization/quantize_graph--input=./optimized_ctc.pb--output_node_names=CTCGreedyDecoder--print_nodes--output=./quantized_graph.pb--mode=eightbit--logtostderr
Tensorboard查看pb文件:
tensorflow/python/tools /import_pb_to_tensorboard.py
查看节点计算时间profile:
bazel build -c opt tensorflow/tools/benchmark:benchmark_model&& \bazel-bin/tensorflow/tools/benchmark/benchmark_model \--graph=/tmp/tensorflow_inception_graph.pb--input_layer="Mul" \--input_layer_shape="1,299,299,3" --input_layer_type="float" \--output_layer="softmax:0" --show_run_order=false --show_time=false \--show_memory=false --show_summary=true --show_flops=true --logtostderr
阅读全文
1 0
- tensorflow优化
- tensorflow模型优化技巧
- Tensorflow常用优化器
- tensorflow 优化器optimizer
- tensorflow中的优化函数
- TensorFlow 神经网络优化
- TensorFlow神经网络优化策略
- tensorflow常用优化函数
- tensorflow- 优化器
- TensorFlow 优化函数
- Tensorflow 优化器 optimizer
- tensorflow 优化器optimizer
- TensorFlow 优化实践
- TensorFlow 优化实践
- tensorflow(2)-优化函数
- tensorflow的优化器比较
- TensorFlow代码结构优化tips
- Tensorflow基础:神经网络优化算法
- bzoj2738 矩阵乘法(整体二分+二维树状数组)
- P1719最大加权矩阵
- 什么是serialVersionUID?
- 数据备份
- 记录自学人工智能的经历
- tensorflow优化
- 菜鸟入门向jdbc与sqlserve2008
- 贪心专练2 最小字典序排序POJ3617
- mysql新增用户
- 华为LTE ME909s模块AT 命令上网流程
- mvp基类+retrofit封装 请求数据
- 异步编程&事件循环event loops---总结
- 数据结构实验之排序六:希尔排序
- svn