当前位置: 首页 > news >正文

免费域名申请地址公司优化是什么意思?

免费域名申请地址,公司优化是什么意思?,自己做的网站如何上传网上,网站项目合同将Freezed 过的pb文件转成tflite文件,并在手机上测试跑分 └── CONTENTS 目录├── 1. 使用Bazel编译转换工具toco├── 2. 用toco转换*.pb模型为*.tflite模型├── 3. [beta] 使用Bazel编译适用于Android的benchmark_model(tflite)工具├── 3. 使用Bazel编…

将Freezed 过的pb文件转成tflite文件,并在手机上测试跑分

└── CONTENTS 目录├── 1. 使用Bazel编译转换工具toco├── 2. 用toco转换*.pb模型为*.tflite模型├── 3. [beta] 使用Bazel编译适用于Android的benchmark_model(tflite)工具├── 3. 使用Bazel编译适用于Android的benchmark_model(tflite)工具├── 4. adb shell + benchmark_model(tflite) 测试tflite模型└── 附录:测试及测试结果
本机环境:Ubuntu 16.04

1. 使用Bazel编译转换工具toco

(a) cd到tensorflow目录下(也即是换到tensorflow的workspace下)

此处依旧以本机环境和目录为例

unaguo@unaguo:~/backends/tensorflow/$ 
(b) Bazel编译toco
unaguo@unaguo:~/backends/tensorflow/$ bazel build tensorflow/contrib/lite/toco:toco

注意:第一个tensorflow是workspace的意思,前面不能加./


2. 用toco转换*.pb模型为*.tflite模型

unaguo@unaguo:~/backends/tensorflow/$ bazel-bin/tensorflow/contrib/lite/toco/toco \--input_file=/YOUR/PATH/TO/PBFILE/source.pb \--input_format=TENSORFLOW_GRAPHDEF \--output_format=TFLITE \--output_file=/YOUR/PATH/TO/TFLITEFILE/destination.tflite \--inference_type=FLOAT \--input_type=FLOAT \--input_arrays="input_1" \--output_arrays="proba/Sigmoid" \--input_shapes=1,512,512,3
注意:上述options中必须要自己修改的如下
OptionsDefinitions
input_file输入的pb文件名称(不需要加“”)
output_file输出的pb文件名称(不需要加“”)
input_arrays输入节点名称(可加可不加“”)
output_arrays输出节点名称(可加可不加“”)
output_arrays输出节点名称(可加可不加“”)(但是注意,名称中带有诸如“:0”的部分要去掉)
input_shapes输入尺寸

3. [beta] 使用Bazel编译适用于Android的benchmark_model(tflite)工具

依旧在tensorflow的workspace下,参照 官方github上的教程 对适用于Android的benchmark_model(tflite)工具
官方上面写的是:
bazel build -c opt \--config=android_arm \--cxxopt='--std=c++11' \tensorflow/contrib/lite/tools/benchmark:benchmark_model
但是很遗憾,我这个版本的tensorflow没有专门在~/lite/tools/下专门摘出来的benchmark的文件夹。所以代码改一下:
unaguo@unaguo:~/backends/tensorflow/$ bazel build -c opt \--config=android_arm \--cxxopt='--std=c++11' \tensorflow/contrib/lite/tools:benchmark_model
把benchmark去掉就行。可以编译
但是很遗憾,报错:
ERROR: /home/unaguo/backends/tensorflow/tensorflow/core/BUILD:2891:1: C++ compilation of rule '//tensorflow/core:gpu_runtime_impl' failed (Exit 1)
tensorflow/core/common_runtime/gpu/gpu_debug_allocator.cc: In member function 'virtual void* tensorflow::GPUNanResetAllocator::AllocateRaw(size_t, size_t)':
tensorflow/core/common_runtime/gpu/gpu_debug_allocator.cc:176:27: error: 'nanf' is not a member of 'std'std::nanf(""));^
tensorflow/core/common_runtime/gpu/gpu_debug_allocator.cc: In member function 'virtual void tensorflow::GPUNanResetAllocator::DeallocateRaw(void*)':
tensorflow/core/common_runtime/gpu/gpu_debug_allocator.cc:191:29: error: 'nanf' is not a member of 'std'std::nanf(""));^
Target //tensorflow/contrib/lite/tools:benchmark_model failed to build
Use --verbose_failures to see the command lines of failed build steps.
那就用 --verbose_failures看一下报错。
ERROR: /home/unaguo/backends/tensorflow/tensorflow/contrib/lite/profiling/BUILD:41:1: C++ compilation of rule '//tensorflow/contrib/lite/profiling:profile_summarizer' failed (Exit 1): arm-linux-androideabi-gcc failed: error executing command
暂时看不懂。

3. 使用Bazel编译适用于Android的benchmark_model(tflite)工具

经过一个小时的乱操作,我编成功了,下面记录一下骚操作:
(a) 从github上的master分支上的/lite/tools上手动copy下来benchmark文件夹
上文提到我下的版本中没有benchmark文件夹,所以我考虑是版本不够新,所以决定手动copy下来整个benchmark文件夹。
…1 首先在本地/tensorflow/tensorflow/contrib/lite/tools文件夹下创建叫benchmark的文件夹
…2 然后一个一个拷贝 这个主页下的源码到本地这个benchmark的文件夹下,分别是:
BUILD
benchmark_main.cc
benchmark_model.cc
benchmark_model.h
benchmark_params.cc
benchmark_params.h
benchmark_tflite_model.cc
benchmark_tflite_model.h
command_line_flags.cc
command_line_flags.h
command_line_flags_test.cc
logging.h
因为我们不做IOS的高端产品,所以ios文件夹整个都不拷贝。
…3 README中的那句bazel build代码不求行,我参考了tf版 benchmark_model的bazel build:
unaguo@unaguo:~/backends/tensorflow/$ bazel build -c opt   --crosstool_top=//external:android/crosstool   --cpu=armeabi-v7a  --compiler='clang3.8'   --host_crosstool_top=@bazel_tools//tools/cpp:toolchain  --cxxopt='-std=c++11' --config monolithic   tensorflow/contrib/lite/tools/benchmark:benchmark_model
显示error:
tensorflow/core/platform/default/logging.cc:65: error: undefined reference to '__android_log_write'
找到tensorflow/core/platform/default/logging.cc:65中这第65行,把__android_log_write给他注释掉。 然后再编译:
unaguo@unaguo:~/backends/tensorflow/$ bazel build -c opt   --crosstool_top=//external:android/crosstool   --cpu=armeabi-v7a  --compiler='clang3.8'   --host_crosstool_top=@bazel_tools//tools/cpp:toolchain  --cxxopt='-std=c++11' --config monolithic   tensorflow/contrib/lite/tools/benchmark:benchmark_model
然后success。

4. adb shell + benchmark_model(tflite) 测试tflite模型

(a) 首先把benchmark_model(tflite)扔进手机中
你们知道我的~/tensorflow目录底下有adb的快捷方式的。
unaguo@unaguo:~/backends/tensorflow/$ ./adb push bazel-bin/tensorflow/contrib/lite/tools/benchmark/benchmark_model /data/local/tmp
(b) 进入adb调试
unaguo@unaguo:~/backends/tensorflow/$ ./adb shell
Z91:/ #
© 给/data/local/tmp/benchmark_model开权限
(有些手机不开好像也没什么事)
Z91:/ # chmod 777 /data/local/tmp/benchmark_model
(d) 把tflite模型丢进手机里
unaguo@unaguo:~/backends/tensorflow$ ./adb push /YOUR/PATH/TO/TFLITEFILE/test.tflite /data/local/tmp
(e) 给/data/local/tmp/test.tflite开权限
Z91:/ # chmod 777 /data/local/tmp/test.tflite
(f) 测试tflite模型
Z91:/ # /data/local/tmp/benchmark_model \
--graph=/data/local/tmp/test.tflite \
--input_layer="input_1" \
--input_layer_shape="1,512,512,3" \
--input_layer_type="float" \
--output_layer="proba/Sigmoid:0" \
--show_run_order=false \
--show_time=false \
--show_memory=true \
--show_summary=true \
--show_flops=true \
--max_num_runs=50

output_layer的名称中有没有:0似乎都不会出bug,目前我当它没有太大影响

但是这里的input_1如果加上:0就会报错。

几个一定要修改的options

OptionsDefinitions
--graph模型名称
--input_layer输入节点名称
--input_layer_shape输入值的尺寸
--output_layer输出节点名称

附录:测试及测试结果

Num runs: [50]
Inter-run delay (seconds): [-1]
Num threads: [1]
Benchmark name: []
Output prefix: []
Warmup runs: [1]
Graph: [./MS512_o1.tflite]
Input layers: [input_1]
Input shapes: [1,512,512,3]
Use nnapi : [0]
nnapi error: unable to open library libneuralnetworks.so
Loaded model ./MS512_o1.tflite
resolved reporter
Initialized session in 82.668ms
Running benchmark for 1 iterations 
count=1 curr=1303963Running benchmark for 50 iterations 
count=50 first=1260477 curr=1259469 min=1255535 max=1261653 avg=1.25879e+06 std=1188Average inference timings in us: Warmup: 1.30396e+06, Init: 82668, no stats: 1.25879e+06
结论:TODO
http://www.hkea.cn/news/576799/

相关文章:

  • 免费网站建站工具购买域名的网站
  • 淘宝联盟怎么做网站百度网站提交
  • 前端做用vue做后台多还是做网站多青岛网站快速排名优化
  • 岳阳网站开发公司海淀区seo多少钱
  • 2017年做网站维护总结百度搜索软件
  • 南京网站建设公司点击器原理
  • 网站怎么编辑搜狗网站提交入口
  • 自建网站做外贸的流程广告推广方式
  • 警告欺骗网站模板免费注册
  • 获取网站访客信息seo分析师招聘
  • 制作网页的网站有哪些网站建设
  • 日本真人做爰无遮挡视频免费网站嘉兴关键词优化报价
  • 忻州市中小企业局网站贵州整站优化seo平台
  • 网页怎么制作超链接seo兼职接单平台
  • 网站建设中应注意哪些问题重庆整站seo
  • 贵阳网站建设哪家便宜微商软文范例大全100
  • 怎么在微信上做网站竞价交易
  • wordpress优化版4.7.4网站seo设计
  • 网上课程网站精准客户数据采集软件
  • 专业网站建设报价外呼系统电销
  • 网站建设公司价格差别seo还有哪些方面的优化
  • 哪家公司建造了迪士尼乐园关键词优化推广排名多少钱
  • 做教育的网站有哪些内容吗湖南网站营销推广
  • wordpress 跳过ftp搜索引擎排名优化方案
  • 360做的网站北京营销推广公司
  • 我国政府网站建设的趋势宁波seo公司排名榜
  • 高端网站建设,恩愉科技专业的seo搜索引擎优化培训
  • 跨境网站开发公司网站seo思路
  • 冠县网站建设活动推广方案
  • 鲜花培训网站建设网站推广要点