TFLite: 编译(rpi)

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/g3doc/rpi.md

安装交叉编译工具链

sudo apt-get install crossbuild-essential-armhf

下载依赖
./tensorflow/contrib/lite/tools/make/download_dependencies.sh

download_and_extract "${EIGEN_URL}" "${DOWNLOADS_DIR}/eigen"  

https://bitbucket.org/eigen/eigen/overview
Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.
Eigen是用于线性代数,矩阵和向量运算,几何变换,数值求解器和相关算法的模板头的高级C ++库。

download_and_extract "${GEMMLOWP_URL}" "${DOWNLOADS_DIR}/gemmlowp"  

https://github.com/google/gemmlowp/blob/master/doc/design.md
低精度的矩阵乘法
gemmlowp: a small self-contained low-precision GEMM library
This is not a full linear algebra library, only a GEMM library: it only does general matrix multiplication ("GEMM").

download_and_extract "${GOOGLETEST_URL}" "${DOWNLOADS_DIR}/googletest"  

 download_and_extract "${ABSL_URL}" "${DOWNLOADS_DIR}/absl"

https://github.com/abseil/abseil-cpp
Abseil is an open-source collection of C++ library code designed to augment the C++ standard library. 
The Abseil library code is collected from Google's own C++ code base, 
has been extensively tested and used in production, and is the same code we depend on in our daily coding lives.

https://abseil.io/about/philosophy
Why the world has room for another collection of C++ utility libraries

There are a few main reasons we recommend Abseil as your first choice for utility code when starting a new C++ project:

1.Compatibility with current and future C++ standards, and planned evolution over time
2.Compatibility with Google OSS projects - these are the foundational types for things like Protocol Buffers, gRPC, and TensorFlow
3.Upgrade Support - make it easy to live at head

download_and_extract "${NEON_2_SSE_URL}" "${DOWNLOADS_DIR}/neon_2_sse"

https://github.com/intel/ARM_NEON_2_x86_SSE/
SSE stands for Streaming SIMD Extensions. It is essentially the floating-point equivalent of the MMX instructions. 
The SSE registers are 128 bits, and can be used to perform operations on a variety of data sizes and types. 
Unlike MMX, the SSE registers do not overlap with the floating point stack.

ARM NEON 是适用于ARM Cortex-A和Cortex-R52系列处理器的一种128位SIMD(single instruction multiple data, 单指令多数据)扩展结构。
ARM CPU最开始只有普通的寄存器,可以进行基本数据类型的基本运算。自ARMv5开始引入了VFP(Vector Floating Point)指令,该指令用于向量化加速浮点运算。自ARMv7开始正式引入NEON指令,NEON性能远超VFP,因此VFP指令被废弃。类似于Intel CPU下的MMX/SSE/AVX/FMA指令,ARM CPU的NEON指令同样是通过向量化来进行速度优化。

扫描二维码关注公众号,回复: 3652919 查看本文章

download_and_extract "${FARMHASH_URL}" "${DOWNLOADS_DIR}/farmhash"

https://github.com/google/farmhash
FarmHash, a family of hash functions.

download_and_extract "${FLATBUFFERS_URL}" "${DOWNLOADS_DIR}/flatbuffers"  

FlatBuffers is a cross platform serialization library architected for maximum memory efficiency. 
It allows you to directly access serialized data without parsing/unpacking it first, 
while still having great forwards/backwards compatibility.

download_and_extract "${FFT2D_URL}" "${DOWNLOADS_DIR}/fft2d"

FFT (Fast Fourier/Cosine/Sine Transform)快速傅里叶变换

编译
./tensorflow/contrib/lite/tools/make/build_rpi_lib.sh

CORE_CC_ALL_SRCS := \                                                                                                                                                             $(wildcard tensorflow/contrib/lite/*.cc) \                                                                                                                                         $(wildcard tensorflow/contrib/lite/*.c) \                                                                                                                                             $(wildcard tensorflow/contrib/lite/c/*.c) \                                                                                                                                         $(wildcard tensorflow/contrib/lite/core/api/*.cc)                                                                                                                               ifneq ($(BUILD_TYPE),micro)                                                                                                                                                         CORE_CC_ALL_SRCS += \                                                                                                                                                           $(wildcard tensorflow/contrib/lite/kernels/*.cc) \                                                                                                                               $(wildcard tensorflow/contrib/lite/kernels/internal/*.cc) \                                                                                                                 $(wildcard tensorflow/contrib/lite/kernels/internal/optimized/*.cc) \                                                                                                 $(wildcard tensorflow/contrib/lite/kernels/internal/reference/*.cc) \                                                                                                                                              
$(PROFILER_SRCS) \                                                                                                                                                                   $(wildcard tensorflow/contrib/lite/kernels/*.c) \                                                                                                                                 $(wildcard tensorflow/contrib/lite/kernels/internal/*.c) \                                                                                                                   $(wildcard tensorflow/contrib/lite/kernels/internal/optimized/*.c) \                                                                                                   $(wildcard tensorflow/contrib/lite/kernels/internal/reference/*.c) \                                                                                                   $(wildcard tensorflow/contrib/lite/tools/make/downloads/farmhash/src/farmhash.cc) \                                                                   $(wildcard tensorflow/contrib/lite/tools/make/downloads/fft2d/fftsg.c)

ifeq ($(BUILD_TYPE),micro)                                                                                                                                                           CORE_CC_EXCLUDE_SRCS += \                                                                                                                                                 tensorflow/contrib/lite/mmap_allocation.cc \                                                                                                                                   tensorflow/contrib/lite/nnapi_delegate.cc                                                                                                                                         endif

# This library is the main target for this makefile. It will contain a minimal                                                                                     # runtime that can be linked in to other programs.                                                                                                                         LIB_NAME := libtensorflow-lite.a

现在没有看明白libtensorflow-lite.a是由那些文件生成的,上面的只是大概率猜猜

猜你喜欢

转载自blog.csdn.net/u011279649/article/details/83067614