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.

Files for blackonnx, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size blackonnx-1.0.0.tar.gz (6.1 kB) File type Source Python version None Upload date Hashes View
Filename, size blackonnx-1.0.0-py3.7.egg (15.7 kB) File type Egg Python version 1.0.0 Upload date Hashes View
Filename, size blackonnx-1.0.0-py3-none-any.whl (9.1 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page