2020-05-19 03:08:36 +00:00
|
|
|
# RKNPU Execution Provider (preview)
|
|
|
|
|
RKNPU DDK is an advanced interface to access Rockchip NPU. RKNPU Execution Provider enables deep learning inference on Rockchip NPU via RKNPU DDK.
|
Initial PR for RKNPU execution provider (#3609)
* Initial RKNPU execution provider
* Init
* Support Ops:
Conv, Relu, Clip, LeakyRelu,
MaxPool, AveragePool, GlobalAveragePool,
Concat, Softmax, BatchNormalization, Gemm,
Add, Mul, Sub,
Reshape, Squeeze, Unsqueeze,
Flatten, Transpose,
QLinearConv, DequantizeLinear
* Add rknpu unittest
* Update BUILD.md and Add RKNPU-ExecutionProvider.md
* misc code update
* fix CLIP accuracy issue.
* fix "Error: Duplicate definition of name".
* move rknpu_ddk out of onnxruntime submodule.
* remove temporary code.
* add rknpu namespace.
* update misc of node_attr_helper
* add const & comment for onnx_converter
* add const & comment for shaper
* unify variable name
Co-authored-by: dkm <dkm@rock-chips.com>
Co-authored-by: George Wu <jywu@microsoft.com>
2020-05-06 03:36:47 +00:00
|
|
|
|
2020-05-19 03:08:36 +00:00
|
|
|
## Supported platforms
|
Initial PR for RKNPU execution provider (#3609)
* Initial RKNPU execution provider
* Init
* Support Ops:
Conv, Relu, Clip, LeakyRelu,
MaxPool, AveragePool, GlobalAveragePool,
Concat, Softmax, BatchNormalization, Gemm,
Add, Mul, Sub,
Reshape, Squeeze, Unsqueeze,
Flatten, Transpose,
QLinearConv, DequantizeLinear
* Add rknpu unittest
* Update BUILD.md and Add RKNPU-ExecutionProvider.md
* misc code update
* fix CLIP accuracy issue.
* fix "Error: Duplicate definition of name".
* move rknpu_ddk out of onnxruntime submodule.
* remove temporary code.
* add rknpu namespace.
* update misc of node_attr_helper
* add const & comment for onnx_converter
* add const & comment for shaper
* unify variable name
Co-authored-by: dkm <dkm@rock-chips.com>
Co-authored-by: George Wu <jywu@microsoft.com>
2020-05-06 03:36:47 +00:00
|
|
|
|
2020-05-19 03:08:36 +00:00
|
|
|
* RK1808 Linux
|
|
|
|
|
|
|
|
|
|
*Note: RK3399Pro platform is not supported.*
|
Initial PR for RKNPU execution provider (#3609)
* Initial RKNPU execution provider
* Init
* Support Ops:
Conv, Relu, Clip, LeakyRelu,
MaxPool, AveragePool, GlobalAveragePool,
Concat, Softmax, BatchNormalization, Gemm,
Add, Mul, Sub,
Reshape, Squeeze, Unsqueeze,
Flatten, Transpose,
QLinearConv, DequantizeLinear
* Add rknpu unittest
* Update BUILD.md and Add RKNPU-ExecutionProvider.md
* misc code update
* fix CLIP accuracy issue.
* fix "Error: Duplicate definition of name".
* move rknpu_ddk out of onnxruntime submodule.
* remove temporary code.
* add rknpu namespace.
* update misc of node_attr_helper
* add const & comment for onnx_converter
* add const & comment for shaper
* unify variable name
Co-authored-by: dkm <dkm@rock-chips.com>
Co-authored-by: George Wu <jywu@microsoft.com>
2020-05-06 03:36:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## Build
|
|
|
|
|
For build instructions, please see the [BUILD page](../../BUILD.md#RKNPU).
|
|
|
|
|
|
2020-05-19 03:08:36 +00:00
|
|
|
## Usage
|
Initial PR for RKNPU execution provider (#3609)
* Initial RKNPU execution provider
* Init
* Support Ops:
Conv, Relu, Clip, LeakyRelu,
MaxPool, AveragePool, GlobalAveragePool,
Concat, Softmax, BatchNormalization, Gemm,
Add, Mul, Sub,
Reshape, Squeeze, Unsqueeze,
Flatten, Transpose,
QLinearConv, DequantizeLinear
* Add rknpu unittest
* Update BUILD.md and Add RKNPU-ExecutionProvider.md
* misc code update
* fix CLIP accuracy issue.
* fix "Error: Duplicate definition of name".
* move rknpu_ddk out of onnxruntime submodule.
* remove temporary code.
* add rknpu namespace.
* update misc of node_attr_helper
* add const & comment for onnx_converter
* add const & comment for shaper
* unify variable name
Co-authored-by: dkm <dkm@rock-chips.com>
Co-authored-by: George Wu <jywu@microsoft.com>
2020-05-06 03:36:47 +00:00
|
|
|
### C/C++
|
|
|
|
|
To use RKNPU as execution provider for inferencing, please register it as below.
|
|
|
|
|
```
|
2020-10-19 19:21:21 +00:00
|
|
|
Ort::Env env = Ort::Env{ORT_LOGGING_LEVEL_ERROR, "Default"};
|
|
|
|
|
Ort::SessionOptions sf;
|
|
|
|
|
Ort::ThrowOnError(OrtSessionOptionsAppendExecutionProvider_RKNPU(sf));
|
|
|
|
|
Ort::Session session(env, model_path, sf);
|
Initial PR for RKNPU execution provider (#3609)
* Initial RKNPU execution provider
* Init
* Support Ops:
Conv, Relu, Clip, LeakyRelu,
MaxPool, AveragePool, GlobalAveragePool,
Concat, Softmax, BatchNormalization, Gemm,
Add, Mul, Sub,
Reshape, Squeeze, Unsqueeze,
Flatten, Transpose,
QLinearConv, DequantizeLinear
* Add rknpu unittest
* Update BUILD.md and Add RKNPU-ExecutionProvider.md
* misc code update
* fix CLIP accuracy issue.
* fix "Error: Duplicate definition of name".
* move rknpu_ddk out of onnxruntime submodule.
* remove temporary code.
* add rknpu namespace.
* update misc of node_attr_helper
* add const & comment for onnx_converter
* add const & comment for shaper
* unify variable name
Co-authored-by: dkm <dkm@rock-chips.com>
Co-authored-by: George Wu <jywu@microsoft.com>
2020-05-06 03:36:47 +00:00
|
|
|
```
|
|
|
|
|
The C API details are [here](../C_API.md#c-api).
|
|
|
|
|
|
|
|
|
|
|
2020-05-19 03:08:36 +00:00
|
|
|
## Supported Operators
|
Initial PR for RKNPU execution provider (#3609)
* Initial RKNPU execution provider
* Init
* Support Ops:
Conv, Relu, Clip, LeakyRelu,
MaxPool, AveragePool, GlobalAveragePool,
Concat, Softmax, BatchNormalization, Gemm,
Add, Mul, Sub,
Reshape, Squeeze, Unsqueeze,
Flatten, Transpose,
QLinearConv, DequantizeLinear
* Add rknpu unittest
* Update BUILD.md and Add RKNPU-ExecutionProvider.md
* misc code update
* fix CLIP accuracy issue.
* fix "Error: Duplicate definition of name".
* move rknpu_ddk out of onnxruntime submodule.
* remove temporary code.
* add rknpu namespace.
* update misc of node_attr_helper
* add const & comment for onnx_converter
* add const & comment for shaper
* unify variable name
Co-authored-by: dkm <dkm@rock-chips.com>
Co-authored-by: George Wu <jywu@microsoft.com>
2020-05-06 03:36:47 +00:00
|
|
|
|
2020-05-19 03:08:36 +00:00
|
|
|
The table below shows the ONNX Ops supported using RKNPU Execution Provider and the mapping between ONNX Ops and RKNPU Ops.
|
Initial PR for RKNPU execution provider (#3609)
* Initial RKNPU execution provider
* Init
* Support Ops:
Conv, Relu, Clip, LeakyRelu,
MaxPool, AveragePool, GlobalAveragePool,
Concat, Softmax, BatchNormalization, Gemm,
Add, Mul, Sub,
Reshape, Squeeze, Unsqueeze,
Flatten, Transpose,
QLinearConv, DequantizeLinear
* Add rknpu unittest
* Update BUILD.md and Add RKNPU-ExecutionProvider.md
* misc code update
* fix CLIP accuracy issue.
* fix "Error: Duplicate definition of name".
* move rknpu_ddk out of onnxruntime submodule.
* remove temporary code.
* add rknpu namespace.
* update misc of node_attr_helper
* add const & comment for onnx_converter
* add const & comment for shaper
* unify variable name
Co-authored-by: dkm <dkm@rock-chips.com>
Co-authored-by: George Wu <jywu@microsoft.com>
2020-05-06 03:36:47 +00:00
|
|
|
|
|
|
|
|
| **ONNX Ops** | **RKNPU Ops** |
|
|
|
|
|
| --- | --- |
|
|
|
|
|
| Add | ADD |
|
|
|
|
|
| Mul | MULTIPLY |
|
|
|
|
|
| Conv | CONV2D |
|
|
|
|
|
| QLinearConv | CONV2D |
|
|
|
|
|
| Gemm | FULLCONNECT |
|
|
|
|
|
| Softmax | SOFTMAX |
|
|
|
|
|
| AveragePool | POOL |
|
|
|
|
|
| GlobalAveragePool | POOL |
|
|
|
|
|
| MaxPool | POOL |
|
|
|
|
|
| GlobalMaxPool | POOL |
|
|
|
|
|
| LeakyRelu | LEAKY_RELU |
|
|
|
|
|
| Concat | CONCAT |
|
|
|
|
|
| BatchNormalization | BATCH_NORM |
|
|
|
|
|
| Reshape | RESHAPE |
|
|
|
|
|
| Flatten | RESHAPE |
|
|
|
|
|
| Squeeze | RESHAPE |
|
|
|
|
|
| Unsqueeze | RESHAPE |
|
|
|
|
|
| Transpose | PERMUTE |
|
|
|
|
|
| Relu | RELU |
|
|
|
|
|
| Sub | SUBTRACT |
|
|
|
|
|
| Clip(0~6)| RELU6 |
|
|
|
|
|
| DequantizeLinear | DATACONVERT |
|
|
|
|
|
| Clip | CLIP |
|
|
|
|
|
|
|
|
|
|
|
2020-05-19 03:08:36 +00:00
|
|
|
## Supported Models
|
Initial PR for RKNPU execution provider (#3609)
* Initial RKNPU execution provider
* Init
* Support Ops:
Conv, Relu, Clip, LeakyRelu,
MaxPool, AveragePool, GlobalAveragePool,
Concat, Softmax, BatchNormalization, Gemm,
Add, Mul, Sub,
Reshape, Squeeze, Unsqueeze,
Flatten, Transpose,
QLinearConv, DequantizeLinear
* Add rknpu unittest
* Update BUILD.md and Add RKNPU-ExecutionProvider.md
* misc code update
* fix CLIP accuracy issue.
* fix "Error: Duplicate definition of name".
* move rknpu_ddk out of onnxruntime submodule.
* remove temporary code.
* add rknpu namespace.
* update misc of node_attr_helper
* add const & comment for onnx_converter
* add const & comment for shaper
* unify variable name
Co-authored-by: dkm <dkm@rock-chips.com>
Co-authored-by: George Wu <jywu@microsoft.com>
2020-05-06 03:36:47 +00:00
|
|
|
|
|
|
|
|
Below Models are supported from ONNX open model zoo using RKNPU Execution Provider
|
|
|
|
|
|
|
|
|
|
### Image Classification
|
|
|
|
|
- squeezenet
|
|
|
|
|
- mobilenetv2-1.0
|
|
|
|
|
- resnet50v1
|
|
|
|
|
- resnet50v2
|
|
|
|
|
- inception_v2
|
|
|
|
|
|
|
|
|
|
### Object Detection
|
|
|
|
|
- ssd
|
|
|
|
|
- yolov3
|