Exemplo n.º 1
0
def cal_PoG(config):

    base_path = config['base_path']
    label_path = config['label_path']
    name = config['name']
    outfilepath = config['outfilepath']

    lf0_mean = np.load('{}/mean.npy'.format(base_path))

    # print lf0_mean[1000]

    lf0_cov = np.load('{}/cov.npy'.format(base_path))

    dur_list, names = gen_dur_and_name_list(label_path, name)

    w = gen_W(len(lf0_mean), dur_list, num_coeff)

    syllable_mean, syllable_cov = gen_mean_and_cov_of_dct(names)

    print w.shape, syllable_mean.shape, syllable_cov.shape, lf0_mean.shape, lf0_cov.shape

    mean, cov = PoGUtility.cal_mean_variance_of_product_of_gaussian(
        w, syllable_mean, syllable_cov, lf0_mean, lf0_cov)

    # print mean.shape, cov.shape
    # print mean[1000]

    np.save('{}/mean.npy'.format(outfilepath), mean)
    np.save('{}/cov.npy'.format(outfilepath), cov)

    pass
Exemplo n.º 2
0
    ph_dist_path = '/work/w15/decha/decha_w15/Specom_w15/05b_GPR_for_duration/testrun/out/tsc/a-{}/infer/a-{}/demo/seed-00/M-1024/B-1024/num_iters-5/dur/predictive_distribution/'.format(
        end_set, end_set)

    # outpath = '/work/w25/decha/decha_w25/ICASSP_2017_workspace/Result/alpha_{}_beta_{}/a-{}/'.format(alpha, beta, end_set)

    # Utility.make_directory(outpath)

    for f in Utility.list_file(file_path):
        label_file = '{}/{}'.format(file_path, f)
        w = PoGUtility.read_file_to_W(label_file)

        base = Utility.get_basefilename(f)

        syl_predictive_dist_path = '{}/{}/'.format(syl_dist_path, base)
        syllable_mean, syllable_cov = PoGUtility.read_mean_and_cov_of_predictive_distribution(
            syl_predictive_dist_path)

        ph_predictive_dist_path = '{}/{}/'.format(ph_dist_path, base)
        phone_mean, phone_cov = PoGUtility.read_mean_and_cov_of_predictive_distribution(
            ph_predictive_dist_path)

        print w.shape, syllable_mean.shape, syllable_cov.shape, phone_mean.shape, phone_cov.shape

        mean, cov = PoGUtility.cal_mean_variance_of_product_of_gaussian(
            w, syllable_mean, syllable_cov, phone_mean, phone_cov)

        sys.exit()

    pass