Is there a way to save the model in its entirety i.e. weights and architecture via standard means? Currently the weights of the Mask RCNN are saved at every epoch in the logs directory. Now how can I save the model architecture as well and load it when required?
Usually with keras, you can save a model as an h5 file or have a combination (weights-h5, model-json).
Is that applicable here?
The architecture is fixed, it's the Mask R-CNN.
The line:
model = modellib.MaskRCNN(mode="training", config=config,
model_dir=MODEL_DIR)
creates the model.
Then you can load the weights:
model.load_weights(WEIGHTS_PATH, by_name=True)
Right but is there a way to use tensorflow's save and restore functionality in this particular case? That is,
Is there a way to load the model kind of like this?
model = tf.train.import_meta_graph('mask-rcnn.meta')
model.restore(sess,tf.train.latest_checkpoint('./'))
@ash1995 : I found something in the matterport-> samples-> shapes -> train_shapes notebook which solves the issue.
simply use,
model_path = os.path.join(MODEL_DIR, 'name_of_trained_model.h5')
model.keras_model.save_weights(model_path)
Generally speaking you don't have to save the model as it is automatically saved in the log folder.
I am facing the same problem. I want to save the model not only weight. I want to save weight and model separately
I am facing the same problem. I want to save the model not only weight. I want to save weight and model separately. Someone have a solution?
Hi, Same for me 馃槩 Does someone found a solution ?
Hi, Same for me 馃槩 Does someone found a solution ?
Check this might be useful. It lets you save model in JSON and H5 format.
Most helpful comment
I am facing the same problem. I want to save the model not only weight. I want to save weight and model separately