mel-tts-nar / testing.py
Lakshay1201's picture
Upload folder using huggingface_hub
cf09dea verified
Raw
History Blame Contribute Delete
942 Bytes
"""\
comparing gt_mel and predcted_mel
"""
import torch
import numpy as np
import matplotlib.pyplot as plt
# load a GT mel
gt_mel = np.load("../config/dataset/LJSpeech/Dataset/LJSpeech-1.1/mels/LJ001-0001.npy")
print(f"GT mel shape: {gt_mel.shape}")
print(f"GT mel min: {gt_mel.min():.4f}")
print(f"GT mel max: {gt_mel.max():.4f}")
print(f"GT mel mean: {gt_mel.mean():.4f}")
print(f"GT mel std: {gt_mel.std():.4f}")
# load predicted mel from inference
# save predicted mel before passing to vocoder in inference.py
# add this line before vocoder call:
# np.save("predicted_mel.npy", final_mel.cpu().numpy())
predicted_mel = np.load("predicted_mel.npy")
print(f"\nPredicted mel shape: {predicted_mel.shape}")
print(f"Predicted mel min: {predicted_mel.min():.4f}")
print(f"Predicted mel max: {predicted_mel.max():.4f}")
print(f"Predicted mel mean: {predicted_mel.mean():.4f}")
print(f"Predicted mel std: {predicted_mel.std():.4f}")