Esempio n. 1
0
    for item in training_list:
        for q in range(6, 40, 4):
            for iteration in range(0, 2):
                folder_name = os.path.split(item[1])[-1]
                hmm_path = "%s_%d_%d.hmm" % (os.path.splitext(
                    item[2])[0], q, iteration)
                if os.path.exists(hmm_path):
                    print("Skipping already trained %s for q=%d and i=%d..." %
                          (folder_name, q, iteration))
                    continue
                print("Training %s for q=%d and i=%d..." %
                      (folder_name, q, iteration))

                speech_hmm = em.build_hmm_from_folder(item[1],
                                                      q,
                                                      max_iterations=250,
                                                      show_plots=False,
                                                      convergence_threshold=1)
                speech_hmm.save(hmm_path)

                matches = speech_hmm.match_from_folder(item[1])
                for i in range(0, len(matches)):
                    print("\ttraining match: %.3f" % matches[i])
                metrics = [
                    max(matches),
                    min(matches),
                    np.mean(matches),
                    np.std(matches),
                    np.percentile(matches, 5),
                    np.percentile(matches, 10),
                    np.percentile(matches, 15),