跳转至

ncnn Support

Introduction

This power pack is provided by partner Tencent nihuihttps://github.com/Tencent/ncnn

ncnn is Tencent's open source neural network inference framework

  • Support for deep learning models caffe/mxnet/keras/pytorch(onnx)/darknet/tensorflow(mlir)
  • Cross-platform :Windows/Linux/MacOS/Android/iOS/WebAssembly/...
  • Compatible with multiple CPU architectures :RISC-V/x86/arm/mips/...
  • Support GPU acceleration:NVIDIA/AMD/Intel/Apple/ARM-Mali/Adreno/...
  • Support various common model structures, such as mobilenet/shufflenet/resnet/LSTM/SSD/yolo...
  • Very strong, please move to QQ group ncnn github README on home page

image-20210517164350502.png


Instructions

Prepare cross-compilation toolchain

Visit T-head Chip Open Community to download Toolchain-900 series:

https://occ.t-head.cn/community/download?id=3913221581316624384

For example, riscv64-linux-x86_64-20210512.tar.gz, unzip after downloading, and set environment variables

tar -xf riscv64-linux-x86_64-20210512.tar.gz
export RISCV_ROOT_PATH=/home/nihui/osd/riscv64-linux-x86_64-20210512


Download and compile ncnn

Cross compile ncnn for D1-H architecture

Because of the compiler bug, release compilation will cause illegal instruction errors at runtime, so you have to use relwithdebinfo to compile.

git clone https://github.com/Tencent/ncnn.git
cd ncnn
mkdir build-c906
cd build-c906
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/c906.toolchain.cmake -DCMAKE_BUILD_TYPE=relwithdebinfo -DNCNN_BUILD_TESTS=ON -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF -DNCNN_RUNTIME_CPU=OFF -DNCNN_RVV=ON ..
make -j32


Test benchncnn

D1-H The default TinaLinux will cause an illegal command error when executing the ncnn program, you have to use the Debian system

Copy ncnn/build-c906/benchmark/benchncnn and ncnn/benchmark/*.param to the D1-H development board

./benchncnn 4 1 0 -1 0


More

For links to the original text and subsequent updates, please refer to: https://gist.github.com/nihui/ff7bfb3e48bb850a9d7bd495c0a6d373