# nnoir-onnx
nnoir-onnx is a converter from ONNX model to NNOIR model.
## Install
From [PyPI](https://pypi.org/project/nnoir-onnx/):
```
pip install nnoir-onnx
```
From [Dockerhub](https://hub.docker.com/repository/docker/idein/nnoir-tools):
```
docker pull idein/nnoir-tools:20230720
```
## Example
~~~~bash
wget https://www.cntk.ai/OnnxModels/mnist/opset_7/mnist.tar.gz
tar xvzf mnist.tar.gz
onnx2nnoir -o model.nnoir mnist/model.onnx
~~~~
With docker:
```
docker run --rm -it -u $UID:$GID -v $(pwd):/work idein/nnoir-tools:20230720 onnx2nnoir --graph_name "mobilenet" -o mobilenetv2-1.0.nnoir mobilenetv2-1.0.onnx
```
## Supported ONNX Operators
* [Add](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Add)
* [AveragePool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#AveragePool)
* [BatchNormalization](https://github.com/onnx/onnx/blob/master/docs/Operators.md#BatchNormalization)
* `scale`, `B`, `mean`, and `var` must be `"constant"`
* [Clip](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Clip)
* must be opset version 6 or 11
* if opset version is 11
* `max` must be `"constant"`
* `min` must be 0
* [Concat](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Concat)
* [Conv](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Conv)
* `W` must be [Constant](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Constant) value or have initializer value
* `b` must be [Constant](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Constant) value or have initializer value
* [Cos](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Cos)
* [Div](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Div)
* 1st input must not be `"constant"`
* [Dropout](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Dropout)
* equivalent identity function
* [Elu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Elu)
* [Exp](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Exp)
* [Flatten](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Flatten)
* [Gemm](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Gemm)
* `B` must be [Constant](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Constant) value or have initializer value
* `C` must be [Constant](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Constant) value or have initializer value
* [GlobalAveragePool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#GlobalAveragePool)
* [HardSigmoid](https://github.com/onnx/onnx/blob/main/docs/Operators.md#hardsigmoid)
* [HardSwish](https://github.com/onnx/onnx/blob/main/docs/Operators.md#hardswish)
* [LeakyRelu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LeakyRelu)
* [LRN](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LRN)
* [LSTM](https://github.com/onnx/onnx/blob/master/docs/Operators.md#lstm)
* only `seq_length == 1`
* `direction` must be forward
* Supported `activations` are below
* `Sigmoid`
* `Tanh`
* `Relu`
* Not support `clip` and `input_forget`
* [MatMul](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MatMul)
* [MaxPool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MaxPool)
* `ceil_mode = 1` is not supported
* `dilations` is not supported
* [Mul](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Mul)
* [Pad](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Pad)
* `mode` must be `"constant"`
* [PRelu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#PRelu)
* `slope` must be `"constant"` and a single value tensor
* [ReduceMean](https://github.com/onnx/onnx/blob/master/docs/Operators.md#reducemean)
* [ReduceSum](https://github.com/onnx/onnx/blob/master/docs/Operators.md#reducesum)
* [Relu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Relu)
* [Reshape](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Reshape)
* [Resize](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Resize)
* must be from opset version >= 11
* `mode` must be `"linear"` or `"nearest"`
* `nearest_mode` must be `"floor"`
* `coordinate_transformation_mode` must be either `"pytorch_half_pixel"` or `"align_corners"` for `"linear"` mode
* `coordinate_transformation_mode` must be either `"asymmetric"` for `"nearest"` mode
* [Sigmoid](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sigmoid)
* [Sin](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sin)
* [Softmax](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Softmax)
* [Split](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Split)
* must be from opset version >= 13
* Second optional parameter `split` is not supported
* [Squeeze](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Squeeze)
* [Sub](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sub)
* 1st input must not be `"constant"`
* [Sum](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sum)
* 2 inputs
* [Tan](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Tan)
* [Tanh](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Tanh)
* [Transpose](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Transpose)
* [Unsqueeze](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Unsqueeze)
Raw data
{
"_id": null,
"home_page": "https://github.com/Idein/nnoir/tree/master/nnoir-onnx",
"name": "nnoir-onnx",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "nnoir,onnx,machine learning",
"author": "Idein Inc.",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/5e/7f/0492a1d373f1614569a7ede3ac6e4af02e4290e786ffcc5327d7de729bcc/nnoir_onnx-1.2.1.tar.gz",
"platform": null,
"description": "# nnoir-onnx\n\nnnoir-onnx is a converter from ONNX model to NNOIR model.\n\n## Install\nFrom [PyPI](https://pypi.org/project/nnoir-onnx/):\n\n```\npip install nnoir-onnx\n```\n\nFrom [Dockerhub](https://hub.docker.com/repository/docker/idein/nnoir-tools):\n\n```\ndocker pull idein/nnoir-tools:20230720\n```\n\n## Example\n\n~~~~bash\nwget https://www.cntk.ai/OnnxModels/mnist/opset_7/mnist.tar.gz\ntar xvzf mnist.tar.gz\nonnx2nnoir -o model.nnoir mnist/model.onnx\n~~~~\n\nWith docker:\n\n```\ndocker run --rm -it -u $UID:$GID -v $(pwd):/work idein/nnoir-tools:20230720 onnx2nnoir --graph_name \"mobilenet\" -o mobilenetv2-1.0.nnoir mobilenetv2-1.0.onnx\n```\n\n## Supported ONNX Operators\n\n* [Add](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Add)\n* [AveragePool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#AveragePool)\n* [BatchNormalization](https://github.com/onnx/onnx/blob/master/docs/Operators.md#BatchNormalization)\n * `scale`, `B`, `mean`, and `var` must be `\"constant\"`\n* [Clip](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Clip)\n * must be opset version 6 or 11\n * if opset version is 11\n * `max` must be `\"constant\"`\n * `min` must be 0\n* [Concat](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Concat)\n* [Conv](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Conv)\n * `W` must be [Constant](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Constant) value or have initializer value\n * `b` must be [Constant](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Constant) value or have initializer value\n* [Cos](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Cos)\n* [Div](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Div)\n * 1st input must not be `\"constant\"`\n* [Dropout](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Dropout)\n * equivalent identity function\n* [Elu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Elu)\n* [Exp](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Exp)\n* [Flatten](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Flatten)\n* [Gemm](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Gemm)\n * `B` must be [Constant](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Constant) value or have initializer value\n * `C` must be [Constant](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Constant) value or have initializer value\n* [GlobalAveragePool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#GlobalAveragePool)\n* [HardSigmoid](https://github.com/onnx/onnx/blob/main/docs/Operators.md#hardsigmoid)\n* [HardSwish](https://github.com/onnx/onnx/blob/main/docs/Operators.md#hardswish)\n* [LeakyRelu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LeakyRelu)\n* [LRN](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LRN)\n* [LSTM](https://github.com/onnx/onnx/blob/master/docs/Operators.md#lstm)\n * only `seq_length == 1`\n * `direction` must be forward\n * Supported `activations` are below\n * `Sigmoid`\n * `Tanh`\n * `Relu`\n * Not support `clip` and `input_forget`\n* [MatMul](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MatMul)\n* [MaxPool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MaxPool)\n * `ceil_mode = 1` is not supported\n * `dilations` is not supported\n* [Mul](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Mul)\n* [Pad](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Pad)\n * `mode` must be `\"constant\"`\n* [PRelu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#PRelu)\n * `slope` must be `\"constant\"` and a single value tensor\n* [ReduceMean](https://github.com/onnx/onnx/blob/master/docs/Operators.md#reducemean)\n* [ReduceSum](https://github.com/onnx/onnx/blob/master/docs/Operators.md#reducesum)\n* [Relu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Relu)\n* [Reshape](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Reshape)\n* [Resize](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Resize)\n * must be from opset version >= 11\n * `mode` must be `\"linear\"` or `\"nearest\"`\n * `nearest_mode` must be `\"floor\"`\n * `coordinate_transformation_mode` must be either `\"pytorch_half_pixel\"` or `\"align_corners\"` for `\"linear\"` mode\n * `coordinate_transformation_mode` must be either `\"asymmetric\"` for `\"nearest\"` mode\n* [Sigmoid](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sigmoid)\n* [Sin](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sin)\n* [Softmax](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Softmax)\n* [Split](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Split)\n * must be from opset version >= 13\n * Second optional parameter `split` is not supported\n* [Squeeze](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Squeeze)\n* [Sub](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sub)\n * 1st input must not be `\"constant\"`\n* [Sum](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sum)\n * 2 inputs\n* [Tan](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Tan)\n* [Tanh](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Tanh)\n* [Transpose](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Transpose)\n* [Unsqueeze](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Unsqueeze)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "ONNX to NNOIR Converter",
"version": "1.2.1",
"project_urls": {
"Homepage": "https://github.com/Idein/nnoir/tree/master/nnoir-onnx",
"Repository": "https://github.com/Idein/nnoir/tree/master/nnoir-onnx"
},
"split_keywords": [
"nnoir",
"onnx",
"machine learning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "502c3d54a901d57c5b3596c31cdaeb5189773dd347f1675cfaf0724f824c9218",
"md5": "5bd19e09b626150218dec67c955ee7ac",
"sha256": "81a06646304bd2179cda85da0ccdf4ffb83f706939517bfd1998467b2e23af91"
},
"downloads": -1,
"filename": "nnoir_onnx-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5bd19e09b626150218dec67c955ee7ac",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 34556,
"upload_time": "2023-07-20T05:08:19",
"upload_time_iso_8601": "2023-07-20T05:08:19.169954Z",
"url": "https://files.pythonhosted.org/packages/50/2c/3d54a901d57c5b3596c31cdaeb5189773dd347f1675cfaf0724f824c9218/nnoir_onnx-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5e7f0492a1d373f1614569a7ede3ac6e4af02e4290e786ffcc5327d7de729bcc",
"md5": "a5dcf89795f3325076d8c54b9dd3bba5",
"sha256": "00526f15495a9e25dc5c77794b89ea1cebfedafea6f32ea56a4eb375a6bb4b92"
},
"downloads": -1,
"filename": "nnoir_onnx-1.2.1.tar.gz",
"has_sig": false,
"md5_digest": "a5dcf89795f3325076d8c54b9dd3bba5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 19337,
"upload_time": "2023-07-20T05:08:20",
"upload_time_iso_8601": "2023-07-20T05:08:20.151138Z",
"url": "https://files.pythonhosted.org/packages/5e/7f/0492a1d373f1614569a7ede3ac6e4af02e4290e786ffcc5327d7de729bcc/nnoir_onnx-1.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-20 05:08:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Idein",
"github_project": "nnoir",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"circle": true,
"lcname": "nnoir-onnx"
}