def save_val_comparison(val_dir: str): parent_dir = get_parent_dirname(val_dir) path1 = os.path.join(val_dir, f"{parent_dir}_orig.png") path2 = os.path.join(val_dir, f"{parent_dir}.png") assert os.path.exists(path1) assert os.path.exists(path2) path = os.path.join(val_dir, f"{parent_dir}_comp.png") stack_images_vertically([path1, path2], path)
def save_infer_alignments_sentence_plot(infer_dir: str, infer_res: InferenceResult): plot_melspec(infer_res.alignments, title="{}: Alignments {}".format( get_parent_dirname(infer_dir), infer_res.sentence.sent_id)) path = os.path.join(infer_dir, f"{infer_res.sentence.sent_id}_alignments.png") plt.savefig(path, bbox_inches='tight') plt.close()
def save_infer_pre_postnet_sentence_plot(infer_dir: str, infer_res: InferenceResult): plot_melspec(infer_res.mel_outputs_postnet, title="{}: Pre-Postnet {}".format(get_parent_dirname(infer_dir), infer_res.sentence.sent_id)) path = os.path.join(infer_dir, f"{infer_res.sentence.sent_id}_pre_post.png") plt.savefig(path, bbox_inches='tight') plt.close()
def save_val_alignments_sentence_plot(val_dir: str, mel): parent_dir = get_parent_dirname(val_dir) plot_melspec(mel, title=f"{parent_dir}: Alignments") path = os.path.join(val_dir, f"{parent_dir}_alignments.png") plt.savefig(path, bbox_inches='tight') plt.close()
def save_val_pre_postnet_plot(val_dir: str, mel): parent_dir = get_parent_dirname(val_dir) plot_melspec(mel, title=f"{parent_dir}: Pre-Postnet") path = os.path.join(val_dir, f"{parent_dir}_pre_post.png") plt.savefig(path, bbox_inches='tight') plt.close()
def save_val_orig_plot(val_dir: str, mel): parent_dir = get_parent_dirname(val_dir) plot_melspec(mel, title=parent_dir) path = os.path.join(val_dir, f"{parent_dir}_orig.png") plt.savefig(path, bbox_inches='tight') plt.close()
def save_infer_plot(infer_dir: str, mel: np.ndarray): plot_melspec(mel, title=get_parent_dirname(infer_dir)) path = os.path.join(infer_dir, f"{get_parent_dirname(infer_dir)}.png") plt.savefig(path, bbox_inches='tight') plt.close() return path