From 30ebad5f84437e0828994bb3fa5f08ce98b6bd01 Mon Sep 17 00:00:00 2001 From: Joe Makepeace Date: Fri, 6 May 2022 03:29:27 +0100 Subject: [PATCH] added flag to switch ground truth visualisations between real and idealised. --- visualise.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/visualise.py b/visualise.py index 12a50c7..c1796ee 100644 --- a/visualise.py +++ b/visualise.py @@ -46,6 +46,8 @@ flags.DEFINE_boolean("closed_only", False, \ "(Optional) Evaluate only on the closed vocabulary slice of the dataset") flags.DEFINE_integer("max_examples", 10, "Number of testset examples to visualise") +flags.DEFINE_boolean("match_mels", False, \ + "Use log() on the ground truth mel spectrogram values.") flags.mark_flag_as_required("pred_dataset_path") flags.mark_flag_as_required("ground_dataset_path") @@ -71,9 +73,10 @@ def plot_mel_spectrograms(pred, y, text): return fig, ax def main(unused_argv): - g_dataset_path = FLAGS.ground_dataset_path - p_dataset_path = FLAGS.pred_dataset_path + g_dataset_path = FLAGS.ground_dataset_path + p_dataset_path = FLAGS.pred_dataset_path closed_only = FLAGS.closed_only + match_mels = FLAGS.match_mels # get desired book, sentence_idx @@ -94,7 +97,8 @@ def main(unused_argv): g_mel_spectrogram = valid_audio_transforms(waveform).squeeze(0).transpose(0, 1) - g_mel_spectrogram = torch.log(g_mel_spectrogram+1e-5) + if match_mels: + g_mel_spectrogram = torch.log(g_mel_spectrogram+1e-5) fig, ax = plot_mel_spectrograms(\ stack_mel_spectrogram(p_mel_spectrogram),