for fold in range(1,6): t = time.time() test_folder = [folder for folder in os.listdir(os.path.join("./experiments/",experiment,str(fold))) if partition in folder] wer_details = os.path.join("./experiments/",experiment,str(fold),test_folder[0],"wer_details","per_utt") corpus = WERDetails(wer_details) per_per_experiment.append(corpus.all_pers()) poa_afer_per_experiment.append(corpus.all_poa_afers()) moa_afer_per_experiment.append(corpus.all_moa_afers()) poa_cm_per_experiment.append(corpus.poa_confusion_matrix()) moa_cm_per_experiment.append(corpus.moa_confusion_matrix()) s = time.time() - t print("Fold took", s, "seconds") if i == 0: phoneme_type, phoneme_counts = np.unique(corpus.all_ref_phonemes, return_counts=True) phoneme_count_per_fold[fold - 1, :] = phoneme_counts per.append(per_per_experiment) poa_afer.append(poa_afer_per_experiment) moa_afer.append(moa_afer_per_experiment) poa_cm.append(poa_cm_per_experiment) moa_cm.append(moa_cm_per_experiment) with open('objs.pkl', 'wb') as file: pickle.dump([per, poa_afer, moa_afer, poa_cm, moa_cm, phoneme_count_per_fold], file)
import time from corpus import WERDetails from utils import HParam #partition = "test" #number_of_phonemes = 40 preprocessing = True import numpy as np import pandas as pd if preprocessing: config = HParam("configs/dutch.yaml") wer_details = WERDetails( "experiments/jasmin_example/scoring_kaldi/wer_details/per_utt", skip_calculation=False, config=config) #phoneme, other = wer_details.all_poa_afers() t = time.time() moa_mat = wer_details.moa_confusion_matrix() s = time.time() print(s - t, "secs") poa_mat = wer_details.poa_confusion_matrix() k = time.time() print(k - s, "secs") print(poa_mat) print() #df = pd.DataFrame(data=other, index=phoneme)