doughtmw / HoloLens2-Machine-Learning

Using deep learning models for image classification directly on the HoloLens 2.
MIT License
107 stars 28 forks source link

Issue with input size for WinML models #1

Closed reneschulte closed 3 years ago

reneschulte commented 3 years ago

Hi Mitchell!

Just tried out your modified sample. BTW, love what you are doing here. 👍

I made sure the ONNX model is part of the assets and it can be loaded and the labels file but it still won't work. I don't have much time to debug it myself but see below exception which could be causing this. Maybe just a model update with the wrong dimensions or input binding name?

Exception thrown at 0x00007FF943D345FC (KernelBase.dll) in HoloLens-2-Machine-Learning.exe: WinRT originate error - 0x80070057 : 'Got invalid dimensions for input: input_2 for the following indices
 index: 0 Got: 1 Expected: 0
 Please fix either the inputs or the model.'.
Exception thrown at 0x00007FF943D345FC in HoloLens-2-Machine-Learning.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x00000010032FF280.
doughtmw commented 3 years ago

Hi @reneschulte, thanks for checking out the sample! The current ONNX model requires a tensor with an input shape of (0, 3, 224, 224); based on your error, it sounds like that could be causing the issue. I've modified the included ONNX model to reset its input shape to (1, 3, 224, 224). Let me know if that resolves the issue! Also, my HL2 device is currently on build 19041.1134 - not sure if that could be causing some ONNX incompatibilites as well.

reneschulte commented 3 years ago

Thanks @doughtmw 🙏

It was indeed the model input that fixed it. I'm on Insider build and it works now after you updated the model. 😁 HL2 Windows version 20279.1006.arm64fre.fe_release_svc_sydney.210108-1600

Curious where you are going with this. 🚀