【发布时间】:2020-07-19 11:33:28
【问题描述】:
在 google 的一篇文章 (EXPLORING TRADEOFFS IN MODELS FOR LOW-LATENCY SPEECH ENHANCEMENT) 中使用这个
损失函数来最小化错误,我已经用Tensorflow在Python中编写了这个函数,
def loss_cal(noise_source, mask, target):
landa = 0.113
masked_spec = noise_source*mask
cc = K.l2_normalize(tf.abs(tf.pow(tf.maximum(1e-4, target), 0.3))-tf.abs(tf.pow(tf.maximum(1e-4, masked_spec), 0.3)))
cm = K.l2_normalize(tf.math.pow(tf.maximum(1e-4, target), 0.3)-tf.math.pow(tf.maximum(1e-4, masked_spec), 0.3))
res = tf.math.square(cc)+landa*tf.math.square(cm)
return res
但它返回一个矩阵,而损失函数必须重新计算一个比例,请纠正我,我的实现是否错误?或者可以训练一个损失为矩阵的模型?
【问题讨论】:
标签: python-3.x machine-learning deep-learning tensorflow2.0 loss-function