rust-ncnn
ncnn Rust API.
Prequisition
Rust Env
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
CMake >= 3.12
Rust cmake needs --parallel
option thus CMake3.12 is complusory
$ pip install cmake --upgrade --user
Clang >= 3.9
Rust bindgen use clang
to generate bindings.rs
with c_api.h
.
$ sudo apt install clang-3.9 libclang-3.9-dev
Build
build with libncnn.so by default.
$ cd rust-ncnn/
$ cargo run --example get_version
build with prebuild ncnn
$ export NCNN_DIR="/path/to/your/ncnn/lib"
build with libncnn.a (not recommand because of libomp link error)
$ export CARGO_FEATURE_STATIC=""
$ cargo build --example get_version
Run Examples and UnitTest
$ cargo test
$ cargo run --example get_version
$ cargo run --example benchmark --release
...
squeezenet.param 20 ms
squeezenet_int8.param 98 ms
mobilenet.param 35 ms
mobilenet_int8.param 112 ms
mobilenet_v2.param 25 ms
mobilenet_v3.param 20 ms
shufflenet.param 20 ms
shufflenet_v2.param 17 ms
mnasnet.param 23 ms
proxylessnasnet.param 26 ms
efficientnet_b0.param 37 ms
regnety_400m.param 27 ms
blazeface.param 6 ms
googlenet.param 85 ms
googlenet_int8.param 267 ms
resnet18.param 87 ms
resnet18_int8.param 349 ms
alexnet.param 114 ms
vgg16.param 277 ms
vgg16_int8.param 2029 ms
resnet50.param 141 ms
resnet50_int8.param 533 ms
squeezenet_ssd.param 149 ms
squeezenet_ssd_int8.param 252 ms
mobilenet_ssd.param 69 ms
mobilenet_ssd_int8.param 210 ms
mobilenet_yolo.param 160 ms
mobilenetv2_yolov3.param 73 ms
yolov4-tiny.param 103 ms