pfnet-research / menoh

Menoh: fast DNN inference library with multiple programming language support
MIT License
279 stars 34 forks source link
deep-learning mkl-dnn neural-network

Notice: Menoh is no longer maintained. Part of its functionality is inherited by chainer-compiler.

Menoh

travis Build status Coverity Scan Build Status

Menoh is DNN inference library with C API.

Menoh is released under MIT License.

DISCLAIMER: Menoh is still experimental. Use it at your own risk. In particular not all operators in ONNX are supported, so please check whether the operators used in your model are supported. We have checked that VGG16 and ResNet50 models converted by onnx-chainer work fine.

Document

This codebase contains C API and C++ API.

Goal

Related Projects

Installation using package manager or binary packages

Installation from source

Requirements

Build

Execute following commands in root directory.

python scripts/retrieve_data.py
mkdir build && cd build
cmake ..
make

See BUILDING.md for details.

Installation

Execute following command in build directory created at Build section.

make install

Run VGG16 example (it can run ResNet-50 as well)

Execute following command in root directory.

./example/vgg16_example_in_cpp

Result is here

vgg16 example
-18.1883 -26.5022 -20.0474 13.5325 -0.107129 0.76102 -23.9688 -24.218 -21.6314 14.2164 
top 5 categories are
8 0.885836 n01514859 hen
7 0.104591 n01514668 cock
86 0.00313584 n01807496 partridge
82 0.000934658 n01797886 ruffed grouse, partridge, Bonasa umbellus
97 0.000839487 n01847000 drake

You can also run ResNet-50

./example/vgg16_example_in_cpp -m ../data/resnet50.onnx

Please give --help option for details

./example/vgg16_example_in_cpp --help

Run test

Setup chainer

Then, execute following commands in root directory.

python scripts/gen_test_data.py
cd build
cmake -DENABLE_TEST=ON ..
make
./test/menoh_test.out

Current supported operators

Activation functions

Array manipulations

Neural network connections

Mathematical functions

Normalization functions

Spatial pooling

License

Menoh is released under MIT License. Please see the LICENSE file for details.

Pre-trained models downloaded via retrieve_data.py were converted by onnx-chainer. The original models were downloaded via ChainerCV. Check scripts/generate_vgg16_onnx.py and scripts/generate_resnet50_onnx.py and see the LICENSE of ChainerCV about each terms of use of the pre-trained models.