emgucv / emgutf

Emgu TF is a cross platform .Net wrapper for the Google Tensorflow library. Allows Tensorflow functions to be called from .NET compatible languages such as C#, VB, VC++, IronPython.
https://www.emgu.com/wiki/index.php/Emgu_TF
Other
215 stars 43 forks source link

TF Lite: Encountered unresolved custom op: ´`{.. #43

Open sfiruch opened 4 years ago

sfiruch commented 4 years ago

Tested with Emgu.TF.Lite 2.4.0.1059. Loading segm_full_v491.zip in a .NET 3.1 Core WPF app with new Interpreter(new FlatBufferModel("segm_lite_v509.tflite")).AllocateTensors(); results in the following exception, with varying random characters for the custom op:

Encountered unresolved custom op: ´`{..
   at Emgu.TF.Lite.TfLiteInvoke.TfliteErrorHandler(Int32 status, IntPtr errMsg)
   at Emgu.TF.Lite.TfLiteInvoke.tfeInterpreterAllocateTensors(IntPtr interpreter)
   at Emgu.TF.Lite.Interpreter.AllocateTensors()

(Btw: Thanks for the great work!)

emgucv commented 4 years ago

It is quite likely as the error message indicates: Your tflite model used a custom operation that is not part of the standard tflite distribution.

emgucv commented 4 years ago

Btw, upon checking your model, it seems that the model may be a quantized tflite model. Let me know if that is correct.

If you used a quantized model, please note that tflite on windows do not support quantized model. See this tensorflow ticket: https://github.com/tensorflow/tensorflow/issues/22532

You will not be able to run quantized model on Windows platform. Please create a non-quantized model instead. You will still be able to use the quantized model on Android, iOS, Mac OS or Linux.

sfiruch commented 4 years ago

Yes, it might be an unsupported operation. The model is from Google Meet. I think it is a quantized model. Wasn't aware that tflite supports fewer operations on Windows than in the browser.

In any case: I think the error message contains uninitialized memory - which seems to be a bug, no?