Skip to content

Commit fd3a8db

Browse files
committed
'fix': fix compute data statistics wrong when frame rate is 250 in datasets
1 parent 7e0a394 commit fd3a8db

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

ddsp/colab/colab_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ def upload(sample_rate=DEFAULT_SAMPLE_RATE, normalize_db=None):
183183
def save_dataset_statistics(data_provider,
184184
file_path=None,
185185
batch_size=1,
186-
power_frame_size=256,):
186+
power_frame_size=256,
187+
power_frame_rate=250):
187188
"""Calculate dataset stats and save in a pickle file.
188189
189190
Calls out to postprocessing.compute_dataset_statistics.
@@ -201,7 +202,7 @@ def save_dataset_statistics(data_provider,
201202
"""
202203

203204
ds_stats = ddsp.training.postprocessing.compute_dataset_statistics(
204-
data_provider, batch_size, power_frame_size)
205+
data_provider, batch_size, power_frame_size, power_frame_rate)
205206

206207
# Save.
207208
if file_path is not None:

ddsp/training/postprocessing.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ def get_stats(x, prefix='x', note_mask=None):
325325
mean_min = np.mean(np.min(x, axis=-1))
326326
else:
327327
max_list = []
328+
if x.shape != note_mask.shape:
329+
min_length = min(x.shape[1], note_mask.shape[1])
330+
x = x[:, :min_length]
331+
note_mask = note_mask[:, :min_length]
328332
for x_i, m in zip(x, note_mask):
329333
if np.sum(m) > 0:
330334
max_list.append(np.max(x_i[m]))

0 commit comments

Comments
 (0)