Skip to content

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

@ChetanPatil28

Description

@ChetanPatil28

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions