ImageToArray method does not work
Hello. I am currently working on CNN in Keras.NET and I have some troubles with the model.predict method. It refuses to work because I can't find a way to give it inputs in the right format (BGR with 3 channels). When I worked in python I used the img_to_array() method to turn the Mat into numpy array. I checked the documentation for Keras.NET and found this function as ImageToArray(), but when I added it to the program it gave a strange exception:
"System.NotImplementedException: 'Type is not yet supported: Mat. Add it to 'ToPythonConversions''"
Is the method not implemented yet? If so could someone help me to convert OpenCvSharp Mat object into Numpy Array, while keeping all 3 channels of the image? I have only managed to convert into 1 channel image, which model.predict does not accept.
Part of my code where the error appears:
private static void PredictImage(Mat img, Sequential model, Rect r, Mat realFrame){ NDarray arr = ImageUtil.ImageToArray(img); var newArr = np.expand_dims(arr, axis: 0); var val = model.Predict(newArr); . . . The line with ImageToArray function thows the: 'Type is not yet supported: Mat. Add it to 'ToPythonConversions''
I am working on: Windows 10, Visual Studio 2019 Installed: Keras.NET, NumSharp, OpenCvSharp4.Windows, PILSharp, python, Python.Included, TensorFlow.NET