I have URL for weight file (.h5) of a CNN model. I want to load that weight directly to Python file and compile a keras model. How can this be done.?
Is there a direct approach or should I download the weight file and load it from disk.?
There is a function to download weights from URL and stock it in ~/.keras/
It's the function get_file
from keras.utils.data_utils import get_file
Example :
from keras.utils.data_utils import get_file
weights_path = get_file(
'the name under the model will be saved',
'YOUR URL')
model.load_weights(weights_path)
It returns the path where the weights have been saved. Then you can use load_weight. But in all the case, the weights will be saved on your computer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With