Skip to content

mlpack/onnx-mlpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ONNX-mlpack Translator

The ONNX-mlpack converter can take any ONNX graph and convert it to an mlpack neural network. This is done by matching individual mlpack layers to subgraphs of the ONNX network using a rule matching engine, and then selecting the overall best match of the network.

Setup

  1. Dependencies: make sure that you have, available on your system,
  • mlpack and its dependencies ensmallen, cereal, and Armadillo](https://arma.sourceforge.net); if not installed, these will be autodownloaded during the CMake comnfiguration
  • ONNX (on Debian, libonnx-dev is sufficient)
  • Protobuf (on Debian, libprotobuf-dev is sufficient)
  1. Configuration: create a build directory and use CMake to configure:
mkdir build/
cd build/
cmake ../
  1. Build the converter:
make onnx_mlpack_converter
  1. Run the converter:
src/onnx_mlpack_converter <input_network.onnx> <output_mlpack_network.bin>

Once the converter has been run, you can load the network into mlpack as a DAGNetwork:

#define MLPACK_ENABLE_ANN_SERIALIZATION
#include <mlpack.hpp>

using namespace mlpack;

int main()
{
  DAGNetwork<> network;
  Load("output_mlpack_network.bin", network);

  // now you can use network.Predict(), network.Train(), etc.
}

Notes

This repository is under active development! At this particular moment, support is pretty primitive, but it is actively being expanded. If you have a network that does not match properly, or encounter other problems, please feel free to open a bug report and we will look into the issue.

Releases

No releases published

Packages

 
 
 

Contributors

Languages