diff --git a/util/spectrogram_augmentations.py b/util/spectrogram_augmentations.py index fb47f713..98159826 100644 --- a/util/spectrogram_augmentations.py +++ b/util/spectrogram_augmentations.py @@ -72,7 +72,7 @@ def augment_pitch_and_tempo(spectrogram, new_height = tf.cast(tf.cast(original_shape[1], tf.float32)*choosen_pitch, tf.int32) new_width = tf.cast(tf.cast(original_shape[2], tf.float32)/(choosen_tempo), tf.int32) spectrogram_aug = tf.image.resize_bilinear(tf.expand_dims(spectrogram, -1), [new_height, new_width]) - spectrogram_aug = tf.image.crop_to_bounding_box(spectrogram_aug, offset_height=0, offset_width=0, target_height=tf.minimum(original_shape[1],new_height), target_width=tf.shape(spectrogram_aug)[2]) + spectrogram_aug = tf.image.crop_to_bounding_box(spectrogram_aug, offset_height=0, offset_width=0, target_height=tf.minimum(original_shape[1], new_height), target_width=tf.shape(spectrogram_aug)[2]) spectrogram_aug = tf.cond(choosen_pitch < 1, lambda: tf.image.pad_to_bounding_box(spectrogram_aug, offset_height=0, offset_width=0, target_height=original_shape[1], target_width=tf.shape(spectrogram_aug)[2]),