espnet2.gan_svs.visinger2.ddsp.mean_std_loudness
Less than 1 minute
espnet2.gan_svs.visinger2.ddsp.mean_std_loudness
espnet2.gan_svs.visinger2.ddsp.mean_std_loudness(dataset)
Calculate the mean and standard deviation of loudness values in a dataset.
This function iterates over the dataset and computes the mean and standard deviation of the loudness values contained within. The dataset is expected to be an iterable containing tuples where the third element is a tensor representing loudness.
- Parameters:dataset (iterable) – An iterable dataset where each element is a tuple containing data, labels, and loudness values (tensor).
- Returns: A tuple containing two elements: : - mean (float): The computed mean of loudness values.
- std (float): The computed standard deviation of loudness values.
- Return type: tuple
Examples
>>> dataset = [
... (None, None, torch.tensor([0.1, 0.2, 0.3])),
... (None, None, torch.tensor([0.2, 0.4, 0.6])),
... (None, None, torch.tensor([0.5, 0.1, 0.3]))
... ]
>>> mean, std = mean_std_loudness(dataset)
>>> print(mean)
0.3666666666666667
>>> print(std)
0.136164163677245