load_model and Lamda layer in Keras

后端 未结 1 1703
陌清茗
陌清茗 2021-01-29 02:52

How to load model that have lambda layer?

Here is the code to reproduce behaviour:

MEAN_LANDMARKS = np.load(\'data/mean_shape_68.npy\')

def add_mean_lan         


        
相关标签:
1条回答
  • 2021-01-29 03:36

    You need to pass custom_objects argument to load_model function:

    model = load_model('model_file_name.h5', custom_objects={'MEAN_LANDMARKS': MEAN_LANDMARKS})
    

    Look for more info in Keras docs: Handling custom layers (or other custom objects) in saved models .

    0 讨论(0)
提交回复
热议问题