我的模型看起来像
Keras中的单输出多损耗函数:https://stackoverflow.com/a/51705573/9079093
model = Model(inputs=[sketch_inp, color_inp], outputs=disc_outputs)
opt = Adam(lr=learning_rate, beta_1=.5)
model.compile(loss=lambda y_true, y_pred : tf.keras.losses.binary_crossentropy(y_true, y_pred) + \
pixelLevelLoss_weight * pixelLevelLoss(y_true, y_pred) + \
totalVariationLoss_weight * totalVariationLoss(y_true, y_pred) + \
featureLevelLoss_weight * featureLevelLoss(y_true, y_pred),\
optimizer=opt)
保存模型后,我想加载它并完成培训,但我不知道如何使用此自定义丢失函数加载它
加载模型时,只需使用cutom_对象参数传递损失
如果要加载的模型包括自定义层或其他自定义类或函数,则可以通过
custom_objects
参数将它们传递给加载机制:相关问题 更多 >
编程相关推荐