Does Any one got “AttributeError: 'str' object has no attribute 'decode' ” , while Loading a Keras Saved Model

后端 未结 5 1848
轮回少年
轮回少年 2021-01-01 17:01

After Training, I saved Both Keras whole Model and Only Weights using

model.save_weights(MODEL_WEIGHTS) and model.save(MODEL_NAME)

Models

5条回答
  •  时光说笑
    2021-01-01 18:01

    I had the same problem, solved putting compile=False in load_model:

    model_ = load_model('path to your model.h5',custom_objects={'Scale': Scale()}, compile=False)
    sgd = SGD(lr=1e-3, decay=1e-6, momentum=0.9, nesterov=True)
    model_.compile(loss='categorical_crossentropy',optimizer='sgd',metrics=['accuracy'])
    

提交回复
热议问题