0
$\begingroup$

I have a keras model for image classification saved in a .h5 file or Json file, and then I created a C# desktop app ( in visual studio 2019) which contains two buttons one to load an image and an other to show the result of the prediction. Could any one tell me how can I load my model on the application and use it with the button to make predictions? Please help if you have any ideas. Thanks

$\endgroup$
8
  • $\begingroup$ a possible solution is to run python via a shell command from C# and get the output back in C# $\endgroup$
    – Nikos M.
    Jun 14, 2021 at 14:22
  • $\begingroup$ These open source libraries may be useful: Keras.NET , TensorFlowSharp $\endgroup$
    – noe
    Jun 14, 2021 at 15:54
  • $\begingroup$ Ok, Thank you I will see that. $\endgroup$
    – Lema Zaidi
    Jun 15, 2021 at 7:08
  • $\begingroup$ @noe Is there a way to call my saved keras model (.h5 and .json file) using keras.NET ? I used modelfromjson but it doesn't work, this is used for sequential models but I'm not using sequential model. $\endgroup$
    – Lema Zaidi
    Jun 15, 2021 at 10:04
  • $\begingroup$ If Keras.NET did not work for you, I suggest you convert your .h5 Keras model to tensorflow format (.pb) (e.g. with this) and then you use TensorFlowSharp to load it. $\endgroup$
    – noe
    Jun 15, 2021 at 10:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.