10.4. Tengine_cnn

Overview

Tengine 采用了轻量级模块化的高性能神经网络推理引擎,便于扩展和裁剪,最小体积程序可以做到 300KB,在 MCU 上甚至能够做到 20KB。而且,它专门针对 Arm 嵌入式设备优化,无需依赖第三方库,可跨平台使用支持 Android、Linux、RTOS。

10.4.1. 使用流程

示例演示:

  • 1.在服务器上新建文件夹把Tengine的源码拉取下来: git clone https://gitee.com/OAL/Tengine.git ,ubuntu环境即可。

  • 2.进入到Tengine中切换分支, 去到lite-v1.5-nvdla分支 git checkout lite-v1.5-nvdla

  • 3.复制补丁到Tengine目录下使用命令 patch -p1 < te-1.5.patch 打入补丁 te-1.5.patch , 补丁在 apps\common\example\third_party\tengine\common 中。

  • 4.在Tengine目录下用 mkdir build 创建 build 文件。

  • 5.进入在build文件, 使用 cmake ../ 命令生成makefile文件,之后使用 make 编译文件。

  • 6.然后使用命令 make install 生成文件Tengine其中lib里面放着.a 和include里面放着 .h

  • 7.打开工程在工程的 cpu\wl82\liba 中将.a添加,在 apps\common\example\third_party\tengine 中添加.h。

  • 8.添加测试文件 tm_yolofastest1.c , 例子在 apps\common\example\third_party\tengine 其余测试例子中自行添加编写。

  • 9.添加相关联文件 tengine_operations.c ,在 apps\common\example\third_party\tengine\common

  • 10.sd卡存入在 apps\common\example\third_party\tengine\common 中的 dog.jpgyolo.txt ,

  • 11.在app_main中调用函数

    extern int yolofastest(int argc, char* argv[]);
    
    thread_fork("yolofastest",15,1024*128,512,NULL,yolofastest,NULL);
    

具体相关内容可以打开 OPEN AILAB ,进行查看。