月球基地蒋司令 · 2020年08月13日

Tengine从入门到放弃 第0篇-Tengine X86版本编译

Tengine X86版本编译

环境

  1. System: Ubuntu18.04
  2. CMAKE: 3.15.3

为了确保后续执行没有问题,先执行

sudo apt-get install cmake make g++ git

安装完后,终端中会显示下面内容

make 已经是最新版
cmake 已经是最新版
g++ 已经是最新版
git 已经是最新版

克隆Tengine源码

git clone https://github.com/OAID/Tengine.git

编译

cd Tengine
mkdir build 
cd build
cmake ..

如果输出下面内容,说明没有问题

-- Configuring done
-- Generating done

编译

make -j4 && make install

测试

编译没有问题的话,把 https://github.com/jiangzhong... 中的cat.jpg,squeezenet_caffe.tmfile放到Tengine/build/install/bin目录下,然后执行下面命令

cd Tengine/build/install/bin
./tm_classification -m squeezenet_caffe.tmfile -i ./cat.jpg

输出

Image height not specified, use default 227
Image width not specified, use default  227
Scale value not specified, use default  1.0, 1.0, 1.0
Mean value not specified, use default   104.0, 116.7, 122.7
tengine-lite library version: 0.2-dev

model file : squeezenet_caffe.tmfile
image file : ./cat.jpg
img_h, img_w, scale[3], mean[3] : 227 227 , 1.000 1.000 1.000, 104.0 116.7 122.7
Repeat 1 times, thread 1, avg time 33.31 ms, max_time 33.31 ms, min_time 33.31 ms
--------------------------------------
0.273201, 281
0.267551, 282
0.181003, 278
0.081799, 285
0.072407, 151
--------------------------------------

自此Tengine X86版本编译成功。

自动编译脚本

sudo apt-get install cmake make g++ git -y

git clone https://github.com/OAID/Tengine.git
git clone https://github.com/jiangzhongbo/Tengine_Tutorial
cd Tengine
mkdir build 
cd build
cmake ..
make -j4 && make install

cd ./install/bin
cp ../../../../Tengine_Tutorial/0_Compile/cat.jpg ./
cp ../../../../Tengine_Tutorial/0_Compile/squeezenet_caffe.tmfile ./

./tm_classification -m squeezenet_caffe.tmfile -i ./cat.jpg

你可以直接

wget https://raw.githubusercontent.com/jiangzhongbo/Tengine_Tutorial/master/0_Compile/compile_tengine_x86.sh
sh compile_tengine_x86.sh

参考

https://github.com/OAID/Tengine/wiki/Tengine源码编译

源码

https://github.com/jiangzhongbo/Tengine_Tutorial

知乎

https://zhuanlan.zhihu.com/p/181579203

更多Tengine相关内容请关注Tengine-边缘AI推理框架专栏。
推荐阅读
关注数
3391
内容数
68
Tengine是一款轻量级模块化高性能的神经网络推理引擎 ;欢迎体验Tengine,[链接] 《Tengine开发者入门资料包》[链接]
目录
极术微信服务号
关注极术微信号
实时接收点赞提醒和评论通知
安谋科技学堂公众号
关注安谋科技学堂
实时获取安谋科技及 Arm 教学资源
安谋科技招聘公众号
关注安谋科技招聘
实时获取安谋科技中国职位信息