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
213 stars 43 forks source link

tf.lite example with custom train model issue #79

Open terryll opened 1 year ago

terryll commented 1 year ago

I followed the CVInterop.Lite.Net example and everything work. However, when I custom train an tf.lite classification model (ssdMobileV2), the return results are byte[8] instead of float[8] for _outputTensor.Data. If byte expected? If so, how do I interpreted the results? Thanks in advance, Terry

emgucv commented 1 year ago

The Tensor object can return byte[] if Tensord.DataType is UInt8: https://www.emgu.com/wiki/files/emgutf/2.8.0/document-lite/html/8f3e0a49-e7c4-3cb0-7213-1f4fe1ae9227.htm

You can follow this instructions for model loading issues: https://www.emgu.com/wiki/index.php/My_model_doesn%27t_work#Your_demo_works.2C_I_replaced_with_my_model_and_it_fails

You should always make sure your own model can be loaded and perform inference in python first, then replicate the same pyhon routine in C# with Emgu TF Lite.

Hope that helps.

terryll commented 1 year ago

Thanks for the suggestion. It ends up that I did not resigned the image causing unexpected results. However, the processing speed is much longer than expected. If I understand correctly, the tf.lite may need to rebuild based on the particular CPU in order to get the performance expected. I gave up that option for now. I try to use emgu.tf. When I run the example (CVInterop.NetCore), there is an error message "Error CS0246 The type or namespace name 'ConfigProto' could not be found ". Did I missed something on the installation ? I have went through the document and google the error, But not able to go pass this compile error on the sample program. Thanks in advance, Terry