def apply_cmvn(utt, mean, variance, reverse=False):
"""Apply mean and variance normalisation based on previously computed statistics.
Args:
utt: The utterance feature numpy matrix.
stats: A numpy array containing the mean and variance statistics.
The first row contains the sum of all the fautures and as a last
element the total numbe of features. The second row contains the
squared sum of the features and a zero at the end
Returns:
A numpy array containing the mean and variance normalized features
"""
if not reverse:
#return mean and variance normalised utterance
return np.divide(np.subtract(utt, mean), np.sqrt(variance))
else:
#reversed normalization
return np.add(np.multiply(utt, np.sqrt(variance)), mean)
评论列表
文章目录