美文网首页
Ubuntu14.04安装使用ncnn

Ubuntu14.04安装使用ncnn

作者: 大兔子先生 | 来源:发表于2017-09-21 10:32 被阅读0次

ncnn是腾讯开源的一个针对手机端的cnn框架,本文介绍如何在Ubuntu14.04上安装并使用ncnn。

安装protobuf

下载protobuf源代码

sudo apt-get install autoconf automake libtool curl
git clone https://github.com/google/protobuf 
cd protobuf 

然后修改autogen.sh,这里需要注意的是gmock由于网络的原因无法下载,需要我们从别的地方下载好然后放到protobuf文件夹中,并修改autogen.sh中相应的内容,然后运行autogen.sh。
编译与安装protobuf

./configure
make
make check
sudo make install
sudo ldconfig 

默认的安装路径是/usr/local/lib。

编译ncnn

下载并编译ncnn

git clone https://github.com/Tencent/ncnn
cd ncnn
mkdir build && cd build
cmake ..
make -j
make install

这时在build/tools文件夹下有可执行文件caffe2ncnn和ncnn2mem,其作用分别是将caffe模型转成ncnn模型以及对ncnn模型进行加密。

ncnn的demo

先安装OpenCV,这里不详细介绍,可以参考网上已有的opencv安装脚本Install-Opencv-Master。
进入ncnn/examples
自己编写一个Makefile文件

NCNN = /home/jingao/ncnn

OPENCV = /home/jingao/Downloads/opencv-2.4.10

INCPATH =       -I${NCNN}/build/install/include \
                -I${OPENCV}/modules/objdetect/include \
                -I${OPENCV}/modules/highgui/include \
                -I${OPENCV}/modules/imgproc/include \
                -I${OPENCV}/modules/core/include

LIBS = -lopencv_core -lopencv_highgui -lopencv_imgproc  \
                -fopenmp -pthread

LIBPATH = -L${OPENCV}/lib

squeezenet:squeezenet.cpp
    $(CXX) $(INCPATH) $(LIBPATH) $^ ${NCNN}/build/install/lib/libncnn.a $(LIBS) -o $@

然后make,即可得到可执行文件squeezenet,
运行

squeezenet test.jpg

即可得到图像的分类结果。

参考

http://www.linuxidc.com/Linux/2016-01/127505.htm
http://blog.csdn.net/best_coder/article/details/76201275

相关文章

  • Ubuntu14.04安装使用ncnn

    ncnn是腾讯开源的一个针对手机端的cnn框架,本文介绍如何在Ubuntu14.04上安装并使用ncnn。 安装p...

  • 腾讯云上编译安装ncnn

    服务器环境 ubuntu 20.04 更新系统 安装NCNN需要的依赖 下载NCNN 编译NCNN 安装NCNN

  • Ubuntu14.04 EOS编译测试

    我的环境是ubuntu14.04,使用如下指令进行编译安装 1,安装开发工具 2,由于我使用的系统时ubuntu1...

  • ncnn使用

    使用ncnn部署的模型需要满足:模型的输入及其他层的特征图要满足16字节对齐,width x height要能整除...

  • MongoDB|服务器配置

    服务器环境为Ubuntu14.04 一、安装MongoDB 安装最新稳定版 由于公网源版本2.4.9未更新,使用以...

  • Ubuntu安装pymysql报错问题。

    我在使用Ubuntu14.04安装pymysql的时候遇见问题,如下: 1、下载的速度格外的慢。 2、使用whl安...

  • Ubuntu14.04&16.04下的docker安装

    安装步骤 卸载旧版本 安装linux的额外镜像包(仅ubuntu14.04需要) 执行如下操作,允许你使用aufs...

  • Ubuntu14.04的安装和使用记录

    Ubuntu14.04的安装记录 今天安装了下ubuntu14.04.4,首先上官网下载ISO源文件,使用U盘做一...

  • Ubuntu14.04的安装和使用记录

    Ubuntu14.04的安装记录 今天安装了下ubuntu14.04.4,首先上官网下载ISO源文件,使用U盘做一...

  • mxnet_convert_to_ncnn

    下载ncnn 下载ncnn:推荐使用git工具,不建议直接download zip,后续可能会出现.h与.cpp文...

网友评论

      本文标题:Ubuntu14.04安装使用ncnn

      本文链接:https://www.haomeiwen.com/subject/iuhzsxtx.html