Skip to main content

Adapt ONNX models to enable nnoir conversion

Project description


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.


pip3 install blackonnx


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
., "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 


Follow the instructions in examples/ 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blackonnx-1.0.0.tar.gz (6.1 kB view hashes)

Uploaded Source

Built Distributions

blackonnx-1.0.0-py3.7.egg (15.7 kB view hashes)

Uploaded Source

blackonnx-1.0.0-py3-none-any.whl (9.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page