Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import ONNX models / models from other frameworks #148

Open
idow09 opened this issue Mar 22, 2020 · 2 comments
Open

Import ONNX models / models from other frameworks #148

idow09 opened this issue Mar 22, 2020 · 2 comments

Comments

@idow09
Copy link
Contributor

idow09 commented Mar 22, 2020

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

@cbovar
Copy link
Owner

cbovar commented Mar 23, 2020

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:

  1. Read ONNX file / computation graph (protobuf)
  2. 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 :)

@cbovar
Copy link
Owner

cbovar commented Mar 24, 2020

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:
image
Some of those ops already exist here, others have to be implement (e.g. Gemm).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants