第三天
nnie移植失败了
暂时先放着吧,既然硬核跑不了,先试一下软核,使用ncnn框架来部署目标检测模型
1、交叉编译opencv
Target Root选择交叉编译工具链的bin目录就行
其余的默认
然后开始编译,肯定会出错
undefined reference to `pthread_mutexattr_destroy`
修改编译目录下的 CMakeCache.txt 文件,找到 CMAKE_EE_LINKER_FLAGS:STRING 项
将
//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING=' '
修改为
//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING= -pthread -lrt -ldl
然后编译就行了
2、交叉编译ncnn
编译ncnn之前需要交叉编译protobuf,所以先下载protobuf
到 https://github.com/google/protobuf/releases/tag/v2.5.0 ,进入下载页面点击protobuf-2.5.0.tar.gz
版本无所谓
sudo apt-get install curl libtool
#编译PC版本
cd protobuf-3.2.0
./autoconf.sh
./configure --prefix=/usr/local/PC/protobuf-3.2.0
#编译arm版本
cd protobuf-3.2.0
./autoconf.sh
./configure --build=i686-pc-linux --host=arm-linux \
--with-protoc=/usr/local/PC/protobuf-3.2.0/bin/protoc \
--prefix=/usr/local/TegraX1/protobuf-3.2.0
编译arm版本的时候需要指定pc上的protoc
在编译ncnn的时候,使用cmake指定protobuf的路径。
3、运行mobileNet-SSD
使用ncnn在cpu平台部署mobileNet-SSD和resnet18-SSD,很明显mobileNet的速度比resnet更快,这也验证了之前写的,depthwise的卷积更加适合cpu平台,因为卷积操作在cpu上都需要进行im2col这样的操作,但是1*1卷积在内存上不需要进行内存重拍,所以速度快。 在gpu上,resnet18-SSD比mobileNet-SSD更快,效果也会更好。
4、在3559a上运行
在3559a上运行速度简直太慢了。。。。
啊。。。。。
单核单线程只有2fps。。。。
看来NNIE是逃不了了。。。。。