out_feat_dir = os.path.join( work_dir, 'Data/inter-module/blzpilot/label_features/' + str(decomposition_unit) + '_baseline_592/binary_label_' + str(out_dim)) if not os.path.exists(out_feat_dir): os.makedirs(out_feat_dir) feat_switch = {} feat_switch['binary'] = 1 feat_switch['wordEmbed'] = 0 feat_switch['identity'] = 0 feat_switch['bottleneck'] = 0 feat_dir_path = {} feat_dir_path['input_binary'] = binary_label_dir feat_dir_path['input_labfile'] = label_align_dir feat_dir_path['input_txt'] = text_dir feat_dir_path['output_feat'] = out_feat_dir DFP = 1 if DFP: extract_base_feats = True if extract_base_feats: filelist = os.path.join(work_dir, 'Data/fileList/blzpilot.scp') word_embed_file = os.path.join( work_dir, 'Data/word_embeddings/turian-embeddings-50.txt') list_of_files = io_funcs.load_file_list(filelist) ip_feats.load_word_embeddings(word_embed_file) ip_feats.extract_base_features(feat_dir_path, feat_switch, list_of_files, decomposition_unit)
extractDur = False perform_CTC_classes = False analysisDur = False denormDur = True writeDur = False modifyLabels = False skip_pause = True calcRMSE = True if extractDur: if not os.path.exists(out_dir): os.makedirs(out_dir) filelist = os.path.join(work_dir, 'Data/fileList/'+speaker+'.scp') stat_fname = feat_dir_path + '.txt' stats_file = os.path.join(work_dir, 'Data/inter-module/'+speaker+'/misc/', stat_fname) list_of_files = io_funcs.load_file_list(filelist) all_files_ph = [] dur_features = []; flens = [] for i in range(len(list_of_files)): filename = list_of_files[i] print filename in_lab_file = os.path.join(label_align_dir, filename + '.lab') [phone, st_arr, ph_arr, mean_f0_arr] = htsclass.read_state_align_label_file(in_lab_file) flens.append((len(phone)-2)*out_dim) for j in range(len(phone)): if(phone[j] == '#'): continue;
DFP = True if DFP: prosodydecomp = True hierarcluster = True templatefeats = False analyseTrainData = False prosodyrecons = False computermse = False analyseresults = False if prosodydecomp: filelist = os.path.join(work_dir, 'Data/fileList/' + speaker + '_train.scp') list_arr = io_funcs.load_file_list(filelist) prosody_feats = [] flens = [] dct_features_all_files = [] stat_features_all_files = [] for k in xrange(100, 500): #if(k<1180): # continue filename = list_arr[k] print filename f0_file = os.path.join(f0_dir, filename + '.f0') lab_file = os.path.join(lab_dir, filename + '.lab') ### processing lf0 file ### # ori_f0_data, frame_number = io_funcs.load_binary_file_frame(f0_file, 1)
else: in_feat_dir_path = in_unit + '_template_' + str(num_of_clusters) out_feat_dir_path = out_unit + '_template_' + str(num_of_clusters) lab_dir = os.path.join(work_dir, 'Data/inter-module/'+speaker+'/label_state_align/') ### Directory of files processing ### DFP = True; if DFP: templatefeats = True; if templatefeats: filelist = os.path.join(work_dir, 'Data/fileList/'+speaker+'.scp') list_arr = io_funcs.load_file_list(filelist) in_template_dir = os.path.join(work_dir, 'Data/inter-module/'+speaker+'/template_features/' + in_feat_dir_path + '/') out_template_dir = os.path.join(work_dir, 'Data/inter-module/'+speaker+'/template_features/' + out_feat_dir_path + '/') if not os.path.exists(out_template_dir): os.makedirs(out_template_dir) removesilence=False for k in range(1): filename = list_arr[k] print filename in_file = os.path.join(in_template_dir, filename + '.cmp') out_file = os.path.join(out_template_dir, filename + '.cmp') in_lab_file = os.path.join(lab_dir, filename + '.lab')