Adapt ONNX models to enable nnoir conversion
Project description
blackonnx
This package purpose is to allow the use of NN models generated by AutoML services (Google Cloud Vision, Azure custom Vision), to an Actcast application.
The format for NN models in Actcast is nnoir, and the tool nnoir-onnx allows conversion from ONNX format to nnoir.
Some ONNX operators used in AutoML-generated models may not be supported by nnoir-onnx, and using this package allows the conversion by modifying an onnx model by replacing unsupported nodes to equivalent supported ones.
See #Examples section for use samples.
Installation
pip3 install blackonnx
Usage
In a python script:
import onnx
from blackonnx import fix
model = onnx.load("path/to/mymodel.onnx") # open onnx model
fix.fix_quantize(model) # apply fixes in-place
.
.
.
onnx.save(model, "mymodel_fixed.onnx") # save fixed model
or using commd line:
user~$ blackonnx -o mymodel_fixed.onnx path/to/mymodel.onnx --fixes fix_quantize
Omitting fixes
argument applies all fixes (in alphabetical order).
For models created with Google Cloud Vision, the recommanded fixes are
... --fixes fix_quantize
And for Azure custom vision models:
... --fixes fix_postprocess
Example
Follow the instructions in examples/tutorial.md
for details.
Origin of the Name
The name blackonnx
comes from black onyx because of the property: artificially colored to black. Our IR is nnoir, which comes from black in french.
We mean this tool adapt onnx models for nnoir.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file blackonnx-1.0.0.tar.gz
.
File metadata
- Download URL: blackonnx-1.0.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d542b0a3f6b882a83a1054bc8c3590bc693d2ad18f6c824678714f4600769f79 |
|
MD5 | 352151c457dfd07508b33663f677d127 |
|
BLAKE2b-256 | a406ae5d2b6b35e3ca6d0980b28b866dd1d686eeb4a5dd012e95f6d92dcd8ef1 |
File details
Details for the file blackonnx-1.0.0-py3.7.egg
.
File metadata
- Download URL: blackonnx-1.0.0-py3.7.egg
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 134a93a0161d4e2a6778991ec597aa389d46cd42d90aa8e7e564d244e892805b |
|
MD5 | a43069a07391fcee5234c5a137074dc9 |
|
BLAKE2b-256 | ac0b9038b578d80ecce1ca27ead5e31011fc8b23a4b74550470e730e2d1215d7 |
File details
Details for the file blackonnx-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: blackonnx-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 324ea249b0deb53d2b92074a2eb73df292e3707271701e8954243286df941876 |
|
MD5 | a5df3ccdbe2136ab9d4fa8f0ef9321df |
|
BLAKE2b-256 | c8d11ad26466cb454c21e8775328ca73938315acd3dfba9a405faf109fd33485 |