May 2020
Intermediate to advanced
404 pages
10h 52m
English
Once we have imported the necessary modules, we load the saved model JSON and weights, as in the following code snippet:
json_file = open('model.json','r')model_json = json_file.read()json_file.close()model = model_from_json(model_json)model.load_weights("weights.h5")model.compile(loss='categorical_crossentropy',optimizer='adam',metrics=['accuracy'])graph = tf.get_default_graph()
Note that we have also created a default graph item for the session ahead. This was implicitly created during the model training but is not carried over in the saved model and weights files, so we must explicitly create it here.
Read now
Unlock full access