SciSharp / Keras.NET

Keras.NET is a high-level neural networks API for C# and F#, with Python Binding and capable of running on top of TensorFlow, CNTK, or Theano.
MIT License
591 stars 124 forks source link

WPF assembly #228

Closed MejlaB closed 1 year ago

MejlaB commented 2 years ago

Hello all, I recognized unability to call BaseModel.Predict() from WPF application. It is build under net6.0-windows and finishes with error: Python.Runtime.PythonException: 'AttributeError : 'NoneType' object has no attribute 'write''. I try to call prediction from visual thread. Here is a simple example, what am I trying to do:

        var model = Keras.Models.Model.LoadModel("existing path to model h5 file");
        byte[] data = new byte[99 * 162 * 3];

        NDarray t = np.array<byte>(data);
        var tt = t.reshape(new int[] { 1, 162, 99, 3 });
        var prediction = model.Predict(tt);

It works well, when I call the code from console application. I tried to put all Keras functionalities into separated net6.0 library and the behavior is exactly the same. It works well, when I refernce library from console application and failed, when it is referenced to wpf net6.0-windows application.

Thank you

Milan B.

github-actions[bot] commented 1 year ago

Stale issue message