3

I have a Keras (backend tensorflow) model saved in (h5 or json) format using python, but I 'don't know how to load it and use it in a C# solution. any suggestion (library, or some logics)?

1
  • If you can create an onnx file with keras, you can try to use ML.net Commented Apr 6, 2019 at 17:58

1 Answer 1

7

Keras is built on TensorFlow which is a C++ project, so you can run it on almost every language you want with a simple wrapper.

Use Keras.NET (also available in nuget), and then load your model using:

var model = Keras.Models.Model.LoadModel(pathToYourModel.h5)

Good luck!

Sign up to request clarification or add additional context in comments.

1 Comment

github.com/SciSharp/TensorFlow.NET/issues/1024 (Model load of h5 format has not been supported) does not work at the moment: AsakusaRinne commented Apr 15, 2023 Hello, the loading of "h5" format keras model has not been supported. We has implemented the loading of "SavedModel" format first because it's recommended by tensorflow. The loading of "h5" format is also on our schedule but is not very urgent now. May I ask why you choose "h5" format instead of "SavedModel"?

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.