ONNX AI Model Format now supported by the SignalPop AI Designer!

In our latest release, version 0.10.2.309, we have added support for the ONNX AI model format.  The Open Neural Network Exchange (ONNX) AI model format is a generic AI model format supported by many AI vendors that allows sharing AI models between different AI platforms and tools.  Using the SignalPop AI Designer and  MyCaffe AI Platform you can now easily export MyCaffe models to *.onnx files and import from *.onnx files into MyCaffe models.  Alternatively, you can import just the weights within a *.onnx file into your existing SignalPop AI Designer project. 

Importing ONNX Files Into MyCaffe

Selecting the ‘File | Import‘ menu and selecting the ‘Get Public Models‘ button, displays the newly designed ‘Public Models‘ dialog.

Public Models Dialog

Simply, select the ONNX based model, download and import it into your new project.  When importing, weight blobs that have matching sizes to your model are imported directly.

In some cases, your blob sizing’s may not match, or you may only want to import a few weight blobs, which is typically done when performing transfer learning.

To import a subset of weight blobs or verify the size matches, open the new project, right click on the ‘Accuracy‘ icon and select the ‘Import‘ menu.  Select the *.onnx file who’s weights are to be imported and then press the ‘Load Details‘ button to see the weight blob sizing.

Import Weights Dialog

Check the blobs to import , check to ‘Save‘ checkbox to save them in your model and press ‘OK‘ to import the new weights.

Once imported, double click on the ‘Accuracy‘ icon while the project is open so that you can visualize the weights.  Selecting the ‘Run weight visualization‘ () button visually displays all weight blobs allowing you to verify that they are correct.

For example, the following are the first set of weights from the ‘ResNet50’ model imported from ONNX.

ResNet50 Weights
Exporting MyCaffe Projects to ONNX Files

To export a MyCaffe project to an *.onnx file, right click on the project name and select the ‘Export‘ menu item which displays the ‘Export Project‘ dialog.

Export Project Dialog

Select the ‘ONNX‘ format radio button and press the ‘Export‘ button to export your project into a *.onnx file.

Model Notes

The following should be noted on each of the ONNX models currently supported.

AlexNet – All weights except fc6_1 weights (relies on external sizing) import, however fc8 weights and fc8 bias only import when using the same 1000 outputs as the ONNX model.

GoogleNet – All weights import, however loss3/classifier_1 weights and loss3/classifier_1 bias only import when using the same 1000 outputs as the ONNX model.

VGG16 and VGG19 – All weights except vgg0_dense0_fwd_weights (relies on external sizing) import, however vgg0_dense2_fwd_weighs and vgg0_dense2_fwd_bias only import when using the same 1000 outputs as the ONNX model.

ResNet50 – Only external weights are imported and for this reason, weights should be re-imported with ‘Include internal blobs‘ unchecked.  For example, the ONNX model does not have the global_mean, global_variance and var_correction blobs used by the BatchNorm layer.  When unchecking ‘Include internal blobs‘ all weights are imported, however the resnetv17_dense0_fwd_weights and resnetv17_dense0_fwd_bias are only imported when using the same 1000 outputs as the ONNX model.

InceptionV1All weights import, however loss3/classifier_1 weights and loss3/classifier_1 bias only import when using the same 1000 outputs as the ONNX model.

Programming

Under the hood, the SignalPop AI Designer uses the MyCaffe AI Platform’s new MyCaffeConversionControl to both import from and to *.onnx files.

Importing an *.onnx file is performed with just a few lines of C# code.

Importing an ONNX file

And, exporting is just as easy.

Exporting to ONNX file

To see the code and try it out yourself, see the OnnxExamples project on GitHub.

For other examples that show how to use the MyCaffeConversionControl, see the TestPersistOnnx automatic test functions.

New Features

The following new features have been added to this release.

  • Added ONNX AI Model support for importing *.onnx files to MyCaffe.
  • Added ONNX AI Model support for exporting MyCaffe models to *.onnx files.
  • Added model layer counts to the Model Editor.
  • Improved Weight Import dialog usability.
  • Improved Public Model dialog.
  • Added support for very large models such as ResNet152 and Siamese ResNet152.
  • Added MultiBox support to TestAll.
  • Added ability to run Label Impact on any image file.
  • Upgraded to EntityFramework 6.4.4
  • Upgraded to Google.ProtoBuf 3.12.1
  • Added DISABLED snapshot update method type to disable snapshots on a project.
Bug Fixes
  • Fixed bug that limited very large model sizes.
  • Fixed bug related to saving best training solver state and weights.
  • Fixed bugs related to the ResNet56 model.

To try out training various model types just check out our Tutorials for easy step-by-step instructions that will get you started quickly! For cool example videos, including an ATARI Pong video and Cart-Pole balancing video, check out our Examples page.