TFLite: 代码组成结构

2024-06-03 15:08
文章标签 代码 结构 组成 tflite

本文主要是介绍TFLite: 代码组成结构,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

编译命令

bazel build --cxxopt=--std=c++11 //tensorflow/contrib/lite/java/demo/app/src/main:TfLiteCameraDemo
编译目标从WORKSPACE所在的路径开始到package路径(BUILD文件所在路径) : target(name)

编译输出结果

Target //tensorflow/contrib/lite/java/demo/app/src/main:TfLiteCameraDemo up-to-date:
  bazel-bin/tensorflow/contrib/lite/java/demo/app/src/main/TfLiteCameraDemo_deploy.jar
  bazel-bin/tensorflow/contrib/lite/java/demo/app/src/main/TfLiteCameraDemo_unsigned.apk
  bazel-bin/tensorflow/contrib/lite/java/demo/app/src/main/TfLiteCameraDemo.apk
INFO: Elapsed time: 108.586s, Critical Path: 31.76s
INFO: 305 processes: 279 local, 26 worker.
INFO: Build completed successfully, 351 total actions

编译输出结果
bazel-bin ->         /home/mi/.cache/bazel/_bazel_mi/xxx/execroot/org_tensorflow/bazel-out/k8-opt/bin
bazel-out ->         /home/mi/.cache/bazel/_bazel_mi/xxx/execroot/org_tensorflow/bazel-out
bazel-genfiles ->     /home/mi/.cache/bazel/_bazel_mi/xxx/execroot/org_tensorflow/bazel-out/k8-opt/genfiles
bazel-tensorflow ->     /home/mi/.cache/bazel/_bazel_mi/xxx/execroot/org_tensorflow
bazel-testlogs ->     /home/mi/.cache/bazel/_bazel_mi/xxx/execroot/org_tensorflow/bazel-out/k8-opt/testlogs

分析编译生成的文件,看代码结构

execroot/org_tensorflow/bazel-out/android-armeabi-v7a-opt/bin/tensorflow/contrib/lite

find ./ -name "*.o"

1. framework

./_objs/framework/stderr_reporter.o
./_objs/framework/interpreter.o
./_objs/framework/mutable_op_resolver.o
./_objs/framework/nnapi_delegate.o
./_objs/framework/optional_debug_tools.o
./_objs/framework/model.o
./_objs/framework/graph_info.o
./_objs/framework/mmap_allocation.o
./_objs/framework/allocation.o

2. buildin_op_kernels

./kernels/_objs/builtin_op_kernels/strided_slice.o
./kernels/_objs/builtin_op_kernels/lsh_projection.o
./kernels/_objs/builtin_op_kernels/arg_min_max.o
./kernels/_objs/builtin_op_kernels/gather.o
./kernels/_objs/builtin_op_kernels/unidirectional_sequence_rnn.o
./kernels/_objs/builtin_op_kernels/elementwise.o
./kernels/_objs/builtin_op_kernels/sub.o
./kernels/_objs/builtin_op_kernels/bidirectional_sequence_rnn.o
./kernels/_objs/builtin_op_kernels/resize_bilinear.o
./kernels/_objs/builtin_op_kernels/comparisons.o
./kernels/_objs/builtin_op_kernels/transpose_conv.o
./kernels/_objs/builtin_op_kernels/unidirectional_sequence_lstm.o
./kernels/_objs/builtin_op_kernels/cast.o
./kernels/_objs/builtin_op_kernels/layer_norm_lstm.o
./kernels/_objs/builtin_op_kernels/expand_dims.o
./kernels/_objs/builtin_op_kernels/audio_spectrogram.o
./kernels/_objs/builtin_op_kernels/space_to_depth.o
./kernels/_objs/builtin_op_kernels/space_to_batch_nd.o
./kernels/_objs/builtin_op_kernels/pad.o
./kernels/_objs/builtin_op_kernels/depthwise_conv.o
./kernels/_objs/builtin_op_kernels/div.o
./kernels/_objs/builtin_op_kernels/bidirectional_sequence_lstm.o
./kernels/_objs/builtin_op_kernels/concatenation.o
./kernels/_objs/builtin_op_kernels/exp.o
./kernels/_objs/builtin_op_kernels/add.o
./kernels/_objs/builtin_op_kernels/floor_div.o
./kernels/_objs/builtin_op_kernels/skip_gram.o
./kernels/_objs/builtin_op_kernels/dequantize.o
./kernels/_objs/builtin_op_kernels/l2norm.o
./kernels/_objs/builtin_op_kernels/local_response_norm.o
./kernels/_objs/builtin_op_kernels/select.o
./kernels/_objs/builtin_op_kernels/squeeze.o
./kernels/_objs/builtin_op_kernels/hashtable_lookup.o
./kernels/_objs/builtin_op_kernels/unpack.o
./kernels/_objs/builtin_op_kernels/shape.o
./kernels/_objs/builtin_op_kernels/slice.o
./kernels/_objs/builtin_op_kernels/logical.o
./kernels/_objs/builtin_op_kernels/one_hot.o
./kernels/_objs/builtin_op_kernels/conv.o
./kernels/_objs/builtin_op_kernels/fake_quant.o
./kernels/_objs/builtin_op_kernels/floor.o
./kernels/_objs/builtin_op_kernels/basic_rnn.o
./kernels/_objs/builtin_op_kernels/mfcc.o
./kernels/_objs/builtin_op_kernels/sparse_to_dense.o
./kernels/_objs/builtin_op_kernels/svdf.o
./kernels/_objs/builtin_op_kernels/detection_postprocess.o
./kernels/_objs/builtin_op_kernels/topk_v2.o
./kernels/_objs/builtin_op_kernels/maximum_minimum.o
./kernels/_objs/builtin_op_kernels/lstm.o
./kernels/_objs/builtin_op_kernels/nactivations.o
./kernels/_objs/builtin_op_kernels/transpose.o
./kernels/_objs/builtin_op_kernels/pow.o
./kernels/_objs/builtin_op_kernels/embedding_lookup.o
./kernels/_objs/builtin_op_kernels/embedding_lookup_sparse.o
./kernels/_objs/builtin_op_kernels/pack.o
./kernels/_objs/builtin_op_kernels/zeros_like.o
./kernels/_objs/builtin_op_kernels/reshape.o
./kernels/_objs/builtin_op_kernels/sparse_output_fully_connected.o
./kernels/_objs/builtin_op_kernels/relu1.o
./kernels/_objs/builtin_op_kernels/tile.o
./kernels/_objs/builtin_op_kernels/fully_connected.o
./kernels/_objs/builtin_op_kernels/batch_to_space_nd.o
./kernels/_objs/builtin_op_kernels/split.o
./kernels/_objs/builtin_op_kernels/reduce.o
./kernels/_objs/builtin_op_kernels/mul.o
./kernels/_objs/builtin_op_kernels/neg.o
./kernels/_objs/builtin_op_kernels/pooling.o

3. kernel/internal

./kernels/internal/_objs/kernel_utils/kernel_utils.o
./kernels/internal/_objs/quantization_util/quantization_util.o
./kernels/internal/_objs/audio_utils/mfcc_dct.o
./kernels/internal/_objs/audio_utils/mfcc_mel_filterbank.o
./kernels/internal/_objs/audio_utils/mfcc.o
./kernels/internal/_objs/audio_utils/spectrogram.o
./kernels/internal/_objs/tensor_utils/tensor_utils.o
./kernels/internal/_objs/neon_tensor_utils/portable_tensor_utils.o
./kernels/internal/_objs/neon_tensor_utils/neon_tensor_utils.o

4. kernel 其他

 kernel/gemm_support.cc
   kernel/kernel_util.cc
   kernel/lstm_eval.cc
   kernel/eigen_support.cc
   这几个怎么不是buildin_op_kernels??

5. lite下其他文件

./_objs/arena_planner/arena_planner.o

util.cc    直接在lite目录下
string_util.cc 直接在lite目录下

6. profiling/time, simple_memory_arena

./profiling/time.cc

./_objs/simple_memory_arena/simple_memory_arena.o

7 core/api


./core/api/_objs/api/error_reporter.o
./core/api/_objs/api/op_resolver.o
./core/api/_objs/api/flatbuffer_conversions.o

8. c/c_api_internal


./c/_objs/c_api_internal/c_api_internal.o

9. java_jni

./java/src/main/native/_objs/native/builtin_ops_jni.o
./java/src/main/native/_objs/native_framework_only/nativeinterpreterwrapper_jni.o
./java/src/main/native/_objs/native_framework_only/tensorflow_lite_jni.o
./java/src/main/native/_objs/native_framework_only/tensor_jni.o
./java/src/main/native/_objs/native_framework_only/exception_jni.o

10. external

androidndk  androidsdk  com_google_absl  farmhash_archive  fft2d  flatbuffers  org_checkerframework_qual

10.1 androidndk
./androidndk/_objs/cpufeatures/cpu-features.o
10.2 farmhash
./farmhash_archive/_objs/farmhash/farmhash.o
10.3 absl
./com_google_absl/absl/base/_objs/dynamic_annotations/dynamic_annotations.o
10.4 flatbuffer
./flatbuffers/_objs/flatbuffers/reflection.o
./flatbuffers/_objs/flatbuffers/code_generators.o
./flatbuffers/_objs/flatbuffers/idl_parser.o
./flatbuffers/_objs/flatbuffers/util.o
./flatbuffers/_objs/flatbuffers/idl_gen_general.o
./flatbuffers/_objs/flatbuffers/idl_gen_text.o
./flatbuffers/_objs/flatbuffers/idl_gen_fbs.o
10.5 fft2d
./fft2d/_objs/fft2d/fftsg.o

11.  zipinfo -l jar/ apk

➜  java zipinfo -l libtensorflowlite.jar
Archive:  libtensorflowlite.jar
Zip file size: 14443 bytes, number of entries: 12
-rw----     2.0 fat      752 bl      477 defN 10-Jan-01 00:00 org/tensorflow/lite/DataType$1.class
-rw----     2.0 fat     2676 bl     1382 defN 10-Jan-01 00:00 org/tensorflow/lite/DataType.class
-rw----     2.0 fat      983 bl      488 defN 10-Jan-01 00:00 org/tensorflow/lite/Interpreter$Options.class
-rw----     2.0 fat     5200 bl     2073 defN 10-Jan-01 00:00 org/tensorflow/lite/Interpreter.class
-rw----     2.0 fat     9352 bl     4250 defN 10-Jan-01 00:00 org/tensorflow/lite/NativeInterpreterWrapper.class
-rw----     2.0 fat     6431 bl     3174 defN 10-Jan-01 00:00 org/tensorflow/lite/Tensor.class
-rw----     2.0 fat     1308 bl      751 defN 10-Jan-01 00:00 org/tensorflow/lite/TensorFlowLite.class

zipinfo -l bazel-bin/tensorflow/contrib/lite/java/demo/app/src/main/TfLiteCameraDemo.apk
Archive:  bazel-bin/tensorflow/contrib/lite/java/demo/app/src/main/TfLiteCameraDemo.apk
Zip file size: 5537448 bytes, number of entries: 28
-rw----     2.0 fat  1228588 b-   579539 defN 80-Jan-01 00:00 lib/armeabi-v7a/libtensorflowlite_jni.so
-rw----     2.0 fat  1506380 bl   593277 defN 80-Jan-01 00:00 classes.dex
-rw-rw-rw-  2.3 unx     2336 b-      808 defX 80-Jan-01 00:00 AndroidManifest.xml
-rw-rw-rw-  2.3 unx      196 b-      143 defX 80-Jan-01 00:00 assets/BUILD
-rw-rw-rw-  2.3 unx      195 b-      142 defX 80-Jan-01 00:00 assets/BUILD.bazel
-rw-rw-rw-  2.3 unx      116 b-      116 stor 80-Jan-01 00:00 assets/WORKSPACE
-rw-rw-rw-  2.3 unx    10484 b-     5216 defX 80-Jan-01 00:00 assets/labels.txt
-rw-rw-rw-  2.3 unx    10479 b-     5216 defX 80-Jan-01 00:00 assets/labels_imagenet_slim.txt
-rw-rw-rw-  2.3 unx    10484 b-     5216 defX 80-Jan-01 00:00 assets/labels_mobilenet_quant_v1_224.txt
-rw-rw-rw-  2.3 unx  4276100 b-  4276100 stor 80-Jan-01 00:00 assets/mobilenet_quant_v1_224.tflite
-rw-rw-rw-  2.3 unx      583 b-      583 stor 80-Jan-01 00:00 res/drawable-hdpi-v4/ic_action_info.png
-rw-rw-rw-  2.3 unx     3845 b-     3845 stor 80-Jan-01 00:00 res/drawable-hdpi-v4/ic_launcher.png
-rw-rw-rw-  2.3 unx      234 b-      234 stor 80-Jan-01 00:00 res/drawable-hdpi-v4/tile.9.png
-rw-rw-rw-  2.3 unx      395 b-      395 stor 80-Jan-01 00:00 res/drawable-mdpi-v4/ic_action_info.png
-rw-rw-rw-  2.3 unx     2067 b-     2067 stor 80-Jan-01 00:00 res/drawable-mdpi-v4/ic_launcher.png
-rw-rw-rw-  2.3 unx      728 b-      728 stor 80-Jan-01 00:00 res/drawable-xhdpi-v4/ic_action_info.png
-rw-rw-rw-  2.3 unx     5855 b-     5855 stor 80-Jan-01 00:00 res/drawable-xhdpi-v4/ic_launcher.png
-rw-rw-rw-  2.3 unx     1129 b-     1129 stor 80-Jan-01 00:00 res/drawable-xxhdpi-v4/ic_action_info.png
-rw-rw-rw-  2.3 unx    10714 b-    10714 stor 80-Jan-01 00:00 res/drawable-xxhdpi-v4/ic_launcher.png
-rw-rw-rw-  2.3 unx    29110 b-    29110 stor 80-Jan-01 00:00 res/drawable-xxhdpi-v4/logo.png
-rw-rw-rw-  2.3 unx     1736 b-      690 defX 80-Jan-01 00:00 res/layout-land/fragment_camera2_basic.xml
-rw-rw-rw-  2.3 unx     2792 b-     1035 defX 80-Jan-01 00:00 res/layout-v26/fragment_camera2_basic.xml
-rw-rw-rw-  2.3 unx      404 b-      228 defX 80-Jan-01 00:00 res/layout/activity_camera.xml
-rw-rw-rw-  2.3 unx     2776 b-     1025 defX 80-Jan-01 00:00 res/layout/fragment_camera2_basic.xml
-rw-rw-rw-  2.3 unx     5152 b-     5152 stor 80-Jan-01 00:00 resources.arsc
-rw----     2.0 fat     2721 b-     1304 defN 80-Jan-01 00:00 META-INF/CERT.SF
-rw----     2.0 fat     1211 b-     1060 defN 80-Jan-01 00:00 META-INF/CERT.RSA
-rw----     2.0 fat     2620 b-     1207 defN 80-Jan-01 00:00 META-INF/MANIFEST.MF

12. 其他

从TfLiteCameraDemo的BUILD文件可以推导出TFLite包括那些文件

这篇关于TFLite: 代码组成结构的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1027337

相关文章

活用c4d官方开发文档查询代码

当你问AI助手比如豆包,如何用python禁止掉xpresso标签时候,它会提示到 这时候要用到两个东西。https://developers.maxon.net/论坛搜索和开发文档 比如这里我就在官方找到正确的id描述 然后我就把参数标签换过来

usaco 1.3 Mixing Milk (结构体排序 qsort) and hdu 2020(sort)

到了这题学会了结构体排序 于是回去修改了 1.2 milking cows 的算法~ 结构体排序核心: 1.结构体定义 struct Milk{int price;int milks;}milk[5000]; 2.自定义的比较函数,若返回值为正,qsort 函数判定a>b ;为负,a<b;为0,a==b; int milkcmp(const void *va,c

poj 1258 Agri-Net(最小生成树模板代码)

感觉用这题来当模板更适合。 题意就是给你邻接矩阵求最小生成树啦。~ prim代码:效率很高。172k...0ms。 #include<stdio.h>#include<algorithm>using namespace std;const int MaxN = 101;const int INF = 0x3f3f3f3f;int g[MaxN][MaxN];int n

计算机毕业设计 大学志愿填报系统 Java+SpringBoot+Vue 前后端分离 文档报告 代码讲解 安装调试

🍊作者:计算机编程-吉哥 🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。 🍊心愿:点赞 👍 收藏 ⭐评论 📝 🍅 文末获取源码联系 👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~Java毕业设计项目~热门选题推荐《1000套》 目录 1.技术选型 2.开发工具 3.功能

自定义类型:结构体(续)

目录 一. 结构体的内存对齐 1.1 为什么存在内存对齐? 1.2 修改默认对齐数 二. 结构体传参 三. 结构体实现位段 一. 结构体的内存对齐 在前面的文章里我们已经讲过一部分的内存对齐的知识,并举出了两个例子,我们再举出两个例子继续说明: struct S3{double a;int b;char c;};int mian(){printf("%zd\n",s

代码随想录冲冲冲 Day39 动态规划Part7

198. 打家劫舍 dp数组的意义是在第i位的时候偷的最大钱数是多少 如果nums的size为0 总价值当然就是0 如果nums的size为1 总价值是nums[0] 遍历顺序就是从小到大遍历 之后是递推公式 对于dp[i]的最大价值来说有两种可能 1.偷第i个 那么最大价值就是dp[i-2]+nums[i] 2.不偷第i个 那么价值就是dp[i-1] 之后取这两个的最大值就是d

pip-tools:打造可重复、可控的 Python 开发环境,解决依赖关系,让代码更稳定

在 Python 开发中,管理依赖关系是一项繁琐且容易出错的任务。手动更新依赖版本、处理冲突、确保一致性等等,都可能让开发者感到头疼。而 pip-tools 为开发者提供了一套稳定可靠的解决方案。 什么是 pip-tools? pip-tools 是一组命令行工具,旨在简化 Python 依赖关系的管理,确保项目环境的稳定性和可重复性。它主要包含两个核心工具:pip-compile 和 pip

D4代码AC集

贪心问题解决的步骤: (局部贪心能导致全局贪心)    1.确定贪心策略    2.验证贪心策略是否正确 排队接水 #include<bits/stdc++.h>using namespace std;int main(){int w,n,a[32000];cin>>w>>n;for(int i=1;i<=n;i++){cin>>a[i];}sort(a+1,a+n+1);int i=1

OpenCV结构分析与形状描述符(11)椭圆拟合函数fitEllipse()的使用

操作系统:ubuntu22.04 OpenCV版本:OpenCV4.9 IDE:Visual Studio Code 编程语言:C++11 算法描述 围绕一组2D点拟合一个椭圆。 该函数计算出一个椭圆,该椭圆在最小二乘意义上最好地拟合一组2D点。它返回一个内切椭圆的旋转矩形。使用了由[90]描述的第一个算法。开发者应该注意,由于数据点靠近包含的 Mat 元素的边界,返回的椭圆/旋转矩形数据

html css jquery选项卡 代码练习小项目

在学习 html 和 css jquery 结合使用的时候 做好是能尝试做一些简单的小功能,来提高自己的 逻辑能力,熟悉代码的编写语法 下面分享一段代码 使用html css jquery选项卡 代码练习 <div class="box"><dl class="tab"><dd class="active">手机</dd><dd>家电</dd><dd>服装</dd><dd>数码</dd><dd