def read_args(args): segments, labels = read_labels_file(args.input_label_file) xvec_all = dict(kaldi_io.read_vec_flt_ark(args.xvector_ark_file)) xvectors = [] for segment in segments: xvectors.append(xvec_all[segment]) _, _, plda_psi = kaldi_io.read_plda(args.plda) return xvectors, segments, labels, plda_psi
def read_args(args): segments, labels = read_labels_file(args.input_label_file) xvec_all = dict(kaldi_io.read_vec_flt_ark(args.xvector_ark_file)) xvectors = [] for segment in segments: xvectors.append(xvec_all[segment]) _, _, plda_psi = kaldi_io.read_plda(args.plda) if (args.overlap_rttm is not None): print('Getting overlap segments...') overlaps = get_overlap_vector(args.overlap_rttm, segments) else: overlaps = None return xvectors, segments, labels, plda_psi, overlaps
sys.argv[12] ) # For VB-HMM, x-vectors are reduced to this dimensionality using LDA Fa = float( sys.argv[13]) # Parameter of VB-HMM (see VB_diarization.VB_diarization) Fb = float( sys.argv[14]) # Parameter of VB-HMM (see VB_diarization.VB_diarization) LoopP = float( sys.argv[15]) # Parameter of VB-HMM (see VB_diarization.VB_diarization) use_VB = True # False for using only AHC frm_shift = 0.01 # frame rate of MFCC features glob_tran = kaldi_io.read_mat( tran_mat_file) # x-vector whitening transformation glob_mean = kaldi_io.read_vec_flt(mean_vec_file) # x-vector centering vector kaldi_plda_train = kaldi_io.read_plda(plda_file) # out-of-domain PLDA model kaldi_plda_adapt = kaldi_io.read_plda( plda_adapt_file) # in-domain "adaptation" PLDA model segs_dict = read_xvector_timing_dict( segments_file) # segments file with x-vector timing information plda_train_mu, plda_train_tr, plda_train_psi = kaldi_plda_train plda_adapt_mu, plda_adapt_tr, plda_adapt_psi = kaldi_plda_adapt # Interpolate across-class, within-class and means of the two PLDA models with interpolation factor "alpha" plda_mu = alpha * plda_train_mu + (1.0 - alpha) * plda_adapt_mu W_train = np.linalg.inv(plda_train_tr.T.dot(plda_train_tr)) B_train = np.linalg.inv((plda_train_tr.T / plda_train_psi).dot(plda_train_tr)) W_adapt = np.linalg.inv(plda_adapt_tr.T.dot(plda_adapt_tr)) B_adapt = np.linalg.inv((plda_adapt_tr.T / plda_adapt_psi).dot(plda_adapt_tr)) W = alpha * W_train + (1.0 - alpha) * W_adapt