ConvNetSharp
ConvNetSharp copied to clipboard
Import ONNX models / models from other frameworks
What is the best way to import a model into ConvNetSharp, assuming all the relevant layers exist? Are there any plans on supporting such conversions in the future? Is it possible to do so "manually" somehow? My models are trained using PyTorch, so I can export them to ONNX format if needed. Thanks for your work
It would be great to load ONNX file. So far this is not implemented. I'm not very familiar with ONNX but I understand data is represented as a computation graph.
So it would go like this:
- Read ONNX file / computation graph (protobuf)
- Create computation graph using ConvNetSharp.Flow
There are only a few ops (computation graph nodes) implemented but that could be enough to run simple models. I think this is completely feasible :)
I gave it a try: You can take a look at the branch Onnx
This class implements basic onnx loading (Conv
/ Relu
and MaxPool
ops).
But some more ops such as Gemm
, Gather
, Concat
, Unsqueeze
, Reshape
, Constant
, Shape
, are needed, even for a simple model such as model.py:
Some of those ops already exist here, others have to be implement (e.g. Gemm).