Skip to content

Commit

Permalink
added flag to switch ground truth visualisations between real and ide…
Browse files Browse the repository at this point in the history
…alised.
  • Loading branch information
MiscellaneousStuff committed May 6, 2022
1 parent d5e96e0 commit 30ebad5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions visualise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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

Expand All @@ -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),
Expand Down

0 comments on commit 30ebad5

Please sign in to comment.