0

I have a model with me named "model.json" and I want to use that trained model in my python code so so you tell me how to convert the code or how can I load the "model.json" file in python to use that for any use.

1 Answers1

0

you must of course also save the model weights in h5 format. If you want to load the model from json do this

json_file = open('model.json', 'r')
loaded_model_json = json_file.read()
json_file.close()
loaded_model = model_from_json(loaded_model_json)
#load weights into new model
loaded_model.load_weights("model.h5")

From your code i read you upload a dict so try this:

from keras.models import model_from_config
model = model_from_config(model_dict)

the model dict is the json.

For the placeholder problem try:

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior() 

Let me know if you've solved it

Zrufy
  • 423
  • 9
  • 22