树莓派4B安装ncnn

1. 准备工作

  • 一台刷好机的树莓派4B设备

2. 安装相关库

  • g++
  • cmake
  • protobuf

2.1 安装cmake

sudo apt-get install cmake

2.2 安装protobuf

  • 下载protobuf安装包

    git clone https://github.com/protocolbuffers/protobuf.git

  • 安装相关依赖库

    sudo apt-get install autoconf automake libtool curl make g++ unzip libffi-dev -y

  • 安装

    cd protobuf/ ./autogen.sh ./configure make -j4 sudo make install sudo ldconfig

  • 测试

    protoc --version

    3 安装ncnn

    cd 
    mkdir -p build
    cd build
    cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/pi3.toolchain.cmake -DPI3=ON ..
    make -j4
    make install
    

    4 运行bencmark

    ./benchncnn 30 4 0
    loop_count = 30
    num_threads = 4
    powersave = 0
    gpu_device = -1
    cooling_down = 1
              squeezenet  min =  101.82  max =  132.89  avg =  106.49
               mobilenet  min =  154.08  max =  175.61  avg =  158.78
            mobilenet_v2  min =  118.30  max =  125.56  avg =  119.92
            mobilenet_v3  min =  100.13  max =  107.45  avg =  102.00
              shufflenet  min =   64.68  max =  101.47  avg =   67.71
           shufflenet_v2  min =   59.44  max =   64.51  avg =   60.15
                 mnasnet  min =  105.06  max =  145.19  avg =  109.01
         proxylessnasnet  min =  114.78  max =  136.83  avg =  117.45
               googlenet  min =  311.78  max =  337.50  avg =  316.86
                resnet18  min =  332.36  max =  374.42  avg =  338.54
                 alexnet  min =  286.47  max =  338.04  avg =  295.28
                   vgg16  min = 1755.54  max = 1864.11  avg = 1784.11
                resnet50  min =  807.98  max =  865.84  avg =  830.91
          squeezenet_ssd  min =  278.32  max =  307.18  avg =  283.33
           mobilenet_ssd  min =  340.28  max =  378.09  avg =  346.71
          mobilenet_yolo  min =  815.12  max =  892.93  avg =  869.41
      mobilenetv2_yolov3  min =  407.20  max =  460.15  avg =  428.35
    

    5. 参考资料

    [1] https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-raspberry-pi-3.

    [2]https://www.pianshen.com/article/9257166970/

你可能感兴趣的:(ncnn)