Closed fisakhan closed 3 years ago
Hi,
The model is stored in the "model" attribute of the RetinaFace object, so you can try something like this :
detector = RetinaFace(FLAGS.weights_path, FLAGS.use_gpu_nms, FLAGS.nms_thresh)
model = detector.model
model.save_weights("path_to_file.h5")
Let me know if it works
AttributeError: 'Function' object has no attribute 'save_weights'
Ok try this code (taken from from retinaface.py):
from networks.retinaface_network import RetinaFaceNetwork
model = RetinaFaceNetwork(model_weights).model
model.save_weights("path_to_file.h5")
This code saved the model in .h5 format (I named it "rf.h5") having size of 118.7MB. But after trying to load the model using the following code, I received an error. loaded_model_from_h5 = tf.keras.models.load_model('rf.h5')
raise ValueError('No model found in config file.') ValueError: No model found in config file.
This https://github.com/keras-team/keras/issues/6937 might be the reason.
Yes I think this is the issue, try using model.save() instead of save_weights() Sorry I dont have my laptop so I cant test myself at the moment
How can we convert this model into .h5 or savedmodel or tflite?