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

Windows Machine Learning Code Generator Not Working #290

Closed
Janickvw opened this issue Dec 19, 2019 · 18 comments
Closed

Windows Machine Learning Code Generator Not Working #290

Janickvw opened this issue Dec 19, 2019 · 18 comments

Comments

@Janickvw
Copy link

Janickvw commented Dec 19, 2019

I'm submitting a…

Bug report (I searched for similar issues and did not find one)

Current behavior

When adding an onnx model with right click on assets -> add existing item . No code is generated but onnx model appears in assets folder.

Expected behavior

Interface file to be generated.

Minimal reproduction of the problem with instructions

Repo - Stock MNIST tutorial demo.
Steps:

  1. Open solution
  2. Right click on assets
  3. add from existing file mnist.onnx
  4. Model is added but no code generated

Environment

Windows Build Number: 18362.535

App min and target version: 17763, 18362

OS Version (Server, IoT Core, Desktop, etc): Windows 10 Pro

Graphics Driver version: 25.20.100.6472

DxDiag: 10.00.18362.0387

WinMLTools specific:
- Source training framework: (e.g. CoreML, Scikit-learn, …)
- WinMLTools version

Visual Studio

  • [x ] Microsoft Visual Studio Professional 2019 16.4.2
  • [x ] Microsoft Visual Studio Professional 2017 15.9.18
    tried with both
@LPBourret
Copy link
Contributor

Hi @Janickvw
the tool we call MLGen that generates these interfaces is not installed by default, can you please install the "Windows Machine Learning Code Generator" Visual Studio plugin and give a second try and let us know.

@Janickvw
Copy link
Author

l MLGen that g

Hi @LPBourret. I have tried the extension "Windows Machine Learning Code Generator" as per the title in both VS 2017 and 2019 with no luck. Even tried uninstalling the extension and reinstalling on both. Also tried uninstalling VS 2019 and reinstalling. No luck there either.

@LPBourret
Copy link
Contributor

Hi @Janickvw
thank you for trying the install of the plugin, 1 more thing: can you confirm that after installing the plugin you excluded then added back the ONNX model file? If you installed the plugin and then opened your project already containing the model file, the class would not have been generated. The wrapper class generation occurs only upon adding the model file to your project.

@Janickvw
Copy link
Author

@LPBourret Hi yes, I tried excluding and re adding the model many times after the extension was installed. Also tried excluding the model, closing VS, reopening and re adding to no luck.

@mspmtc
Copy link

mspmtc commented Dec 20, 2019

I am seeing the same exact behavior in VS2019. I have tried install, uninstall/reinstall, disable/enable, different models from known UWP sample apps, model from Custom Vision - nothing happens when adding an onnx file to the project.

@zhangxiang1993
Copy link
Member

Hi @Janickvw and @mspmtc,
What's the ONNX versions of your models. I think they should be higher than opset8(ONNX 1.3).
The released MLgen support to generate code for models with versions under 1.3.

The coming releasing MLGen will support ONNX 1.4 and ONNX 1.5

@Janickvw
Copy link
Author

Hi @zhangxiang1993 this is the model https://gallery.azure.ai/Model/MNIST-Handwritten-Digit-Recognition . I assumed this model would work with MLgen as it is literally the model used in the MLgen tutorial demo, so it doesn't make sense this wouldn't work. Also tried using my custom vision object detection model which didn't work either.

@LPBourret
Copy link
Contributor

LPBourret commented Dec 31, 2019

@Janickvw Weird, for me with Visual Studio 2019 (v16.4.2) and this Windows Machine Learning Code Generator plugin, the model you linked leads to correct automatically generated wrapping code. The model is of an older ONNX opset that was supported by CNTK 2.4 so the ONNX opset version is not the issue here.

@JeffBrand
Copy link

Just applied the 1/2/2020 update to WMLCG and still no joy. Very disappointing. No errors. Muddling through how to build the c# wrapper using online code examples.

@arcontechnologies
Copy link

arcontechnologies commented Jan 5, 2020

MLGEN is not working ! I tried with different versions under 1.3 and still no .cs generated.
I'm using VS2019 C#

@toilet2000
Copy link

It may be a path character problem. For example, code generation failed in c:\한글\WIndows-Machine-Learning. It created the mnist.cs file to Assets folder but no code in it. So I moved the Sample folder to c:\WIndows-Machine-Learning and it works.

@aydtmiri
Copy link

aydtmiri commented Aug 31, 2020

I'm experiencing the same issue in Visual Studio 2019 with an onnx model version 1.5 and 1.3. I already installed "Windows Machine Learning Code Generator", reopened VS, deleted my project and tried with a new one. nothing worked

@ryanlai2
Copy link
Contributor

ryanlai2 commented Sep 1, 2020

@miyrai , would you be able to share your model for investigation purposes? I was able to get onnx models version 1.3 and 1.5 working on my end.
1.3 model : https://github.com/onnx/models/tree/master/vision/classification/alexnet
1.5 model : https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/ssd

@aydtmiri
Copy link

aydtmiri commented Sep 1, 2020

@ryanlai2 I used this one https://github.com/onnx/models/blob/master/vision/object_detection_segmentation/mask-rcnn/model/MaskRCNN-10.onnx and i also tried your suggested models, but it didn't work with both of them.

I know that the problem is with my settings, because it works for you, so what i did is:

  • Extension > Windows Machine Learning Code Generation is installed
  • latest windows sdk version
  1. Create a new Blank App(Universial Windows) Project
  • Target version: Windows 10, version 1903(10.0; Build 18362)
  • Minimum version: Windows 10, version 1809(10.0; Build 17763)
  1. Right click on Assets folder > Add > Existing Item > .onnx file

@aydtmiri
Copy link

aydtmiri commented Sep 2, 2020

@ryanlai2 if it works for you that the cs file of my onnx model is generated, maybe you could just send me the cs file? thats all i need

@ryanlai2
Copy link
Contributor

ryanlai2 commented Sep 2, 2020

Here you go @miyrai ! Let me know if it works :) You will need to change the namespace.

MaskRCNN-10.zip

@logeshpalani30
Copy link

@ryanlai2 I used this one https://github.com/onnx/models/blob/master/vision/object_detection_segmentation/mask-rcnn/model/MaskRCNN-10.onnx and i also tried your suggested models, but it didn't work with both of them.

I know that the problem is with my settings, because it works for you, so what i did is:

  • Extension > Windows Machine Learning Code Generation is installed
  • latest windows sdk version
  1. Create a new Blank App(Universial Windows) Project
  • Target version: Windows 10, version 1903(10.0; Build 18362)
  • Minimum version: Windows 10, version 1809(10.0; Build 17763)
  1. Right click on Assets folder > Add > Existing Item > .onnx file

It works

@MichaSattler
Copy link

For anyone still running into problems win the mlgen: The extension doesn't work if the full path to your project contains white spaces!
Unfortunately, this was was what broke it for me: There was one white space in the path, and the code generation didn't work. Once I eliminated the whitespace, code generation worked in an instant.

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