Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecursionError when trying to save 'model' and its 'trained-weights' into a single .h5 file #16

Open
ChetanPatil28 opened this issue Jul 18, 2019 · 1 comment

Comments

@ChetanPatil28
Copy link

Hi, i have trained the DeepLab model on my custom dataset. I'm able to load these saved weights inside the model architecture.
And now, I am trying to save this architecture with its loaded weights into a single .h5 file. However, when i do this i get error
RecursionError: maximum recursion depth exceeded while calling a Python object

Following is the code i'm using,
from utils import *
backbone = 'mobilenetv2'
n_classes=2
image_size=(512,512)
SegClass = SegModel(image_size=image_size)
model1 = SegClass.create_seg_model(net='original',n=n_classes, load_weights=False, multi_gpu=False, backbone=backbone)
model1.load_weights('weights/Saved_Weights-02.h5')
model1.save('Complete_Model.h5')

Im getting the RecursionError when the last line model1.save('Complete_Model.h5') is executed.
How can i resolve this issue such that both the 'model architecture' as well as its 'weights' are stored inside a single file.

@Golbstein
Copy link
Owner

try model.save_weights method instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants