当前位置: 首页>>代码示例>>C++>>正文


C++ XList::getLineCount方法代码示例

本文整理汇总了C++中XList::getLineCount方法的典型用法代码示例。如果您正苦于以下问题:C++ XList::getLineCount方法的具体用法?C++ XList::getLineCount怎么用?C++ XList::getLineCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XList的用法示例。


在下文中一共展示了XList::getLineCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IvExtractorEigenDecomposition

//-----------------------------------------------------------------------------------------------------------------------------------------------------------
int IvExtractorEigenDecomposition(Config& config)
{
	String inputWorldFilename = config.getParam("inputWorldFilename");

	// label for selected frames - Only the frames associated with this label, in the label files, will be used
	bool fixedLabelSelectedFrame=true;
	String labelSelectedFrames;
	if (config.existsParam("useIdForSelectedFrame"))    // the ID of each speaker is used as labelSelectedFrame ?
		fixedLabelSelectedFrame=(config.getParam("useIdForSelectedFrame").toBool()==false);  
	if (fixedLabelSelectedFrame)                        // the label is decided by the command line and is unique for the run
		labelSelectedFrames=config.getParam("labelSelectedFrames");
 
try{
	MixtureServer ms(config);
	if (verbose) cout << "(IvExtractor) Approximate i-vector by using Eigen Decomposition"<<endl;
	if (verbose) cout << "(IvExtractor) TotalVariability - Load world model [" << inputWorldFilename<<"]"<<endl;
	MixtureGD& world = ms.loadMixtureGD(inputWorldFilename);      

	//Read the NDX file
	String ndxFilename = config.getParam("targetIdList");

	//Remove the first element of each line which is the model name
	XList tmpFileList(ndxFilename);
	XList fileList;
	for(unsigned long ll=0;ll<tmpFileList.getLineCount();ll++){
		fileList.addLine();
		for(unsigned long i=1;i<tmpFileList.getLine()->getElementCount();i++){
			fileList.getLine(fileList.getLineCount()-1).addElement(tmpFileList.getLine(ll).getElement(i));
		}
	}
	
	//Create and initialise the accumulator
	TVAcc tvAcc(fileList, config);
	Matrix<double> Q(tvAcc.getRankT(),tvAcc.getRankT());
	Matrix<double> D(tvAcc.getNDistrib(),tvAcc.getRankT());

	if(config.existsParam("loadEigenDecompositionParam") && config.getParam("loadEigenDecompositionParam").toBool()){	// Load normalized T matrix and weighted Covariance matrix if pre-computed

		//Load TotalVariability matrix
		String normTFilename = config.getParam("totalVariabilityMatrix") + "_norm";
		tvAcc.loadT(normTFilename, config);

		//Load D and Q matrices
		String dFilename = config.getParam("matrixFilesPath") + config.getParam("totalVariabilityMatrix") + "_EigDec_D" + config.getParam("loadMatrixFilesExtension");
		D.load(dFilename,config);

		String qFilename = config.getParam("matrixFilesPath") + config.getParam("totalVariabilityMatrix") + "_EigDec_Q" + config.getParam("loadMatrixFilesExtension");
		Q.load(qFilename,config);

	}
	else{
		//Load TotalVariability matrix
		tvAcc.loadT(config.getParam("totalVariabilityMatrix"), config);

		// Normalize matrix T
		tvAcc.normTMatrix();

		// Compute weighted co-variance matrix by using UBM weight coefficients
		DoubleSquareMatrix W(tvAcc.getRankT());
		W.setAllValues(0.0);
		tvAcc.getWeightedCov(W,world.getTabWeight(),config);

		// Eigen Decomposition of W to get Q
		Matrix<double> tmpW(W);
		Q.setAllValues(0.0);
		tvAcc.computeEigenProblem(tmpW,Q,tvAcc.getRankT(),config);

		// Compute D matrices (approximation of Tc'Tc matrices)
		D.setAllValues(0.0);
		tvAcc.approximateTcTc(D,Q,config);
	}

	//Load the statistics from files or compute statistics for all segments at once
	if((config.existsParam("loadAccs")) && config.getParam("loadAccs").toBool()){	//load pre-computed statistics
		cout<<"	(IvExtractor) Load Accumulators"<<endl;
		tvAcc.loadN(config);
		tvAcc.loadF_X(config);
	}
	else{															//Compute statistics if they don't exists
		tvAcc.computeAndAccumulateTVStat(config);
		tvAcc.saveAccs(config);
	}

	// Then load the meanEstimate computed by minDiv if required
	DoubleVector meanEstimate = tvAcc.getUbmMeans();
	if(config.existsParam("minDivergence")&& config.getParam("minDivergence").toBool()){
		String minDivName = config.getParam("matrixFilesPath") + config.getParam("meanEstimate") + config.getParam("loadMatrixFilesExtension");
		Matrix<double> tmpMean(minDivName,config);
		for(unsigned long i=0;i<meanEstimate.size();i++){
			meanEstimate[i] = tmpMean(0,i);
		}
	}
	//Update the mean Estimate
	cout<<"	(IvExtractor) Load Mean Estimate"<<endl;
	tvAcc.loadMeanEstimate(meanEstimate);

	//Substract mean from the statistics and normalize co-variance
	tvAcc.normStatistics(config);

//.........这里部分代码省略.........
开发者ID:orsonwang,项目名称:ALIZE-LIA_RAL-extensions,代码行数:101,代码来源:IvExtractor.cpp

示例2: IvExtractor

//-----------------------------------------------------------------------------------------------------------------------------------------------------------
int IvExtractor(Config& config)
{
	String inputWorldFilename = config.getParam("inputWorldFilename");

	// label for selected frames - Only the frames associated with this label, in the label files, will be used
	bool fixedLabelSelectedFrame=true;
	String labelSelectedFrames;
	if (config.existsParam("useIdForSelectedFrame"))    // the ID of each speaker is used as labelSelectedFrame ?
		fixedLabelSelectedFrame=(config.getParam("useIdForSelectedFrame").toBool()==false);  
	if (fixedLabelSelectedFrame)                        // the label is decided by the command line and is unique for the run
		labelSelectedFrames=config.getParam("labelSelectedFrames");
 
try{
	MixtureServer ms(config);
	if (verbose) cout << "(IvExtractor) TotalVariability - Load world model [" << inputWorldFilename<<"]"<<endl;
	MixtureGD& world = ms.loadMixtureGD(inputWorldFilename);      
	
	//Load the statistics from files or compute statistics for all segments at once
	//Read the NDX file
	String ndxFilename = config.getParam("targetIdList");

	//Remove the first element of each line which is the model name
	XList tmpFileList(ndxFilename);
	XList fileList;
	for(unsigned long ll=0;ll<tmpFileList.getLineCount();ll++){
		fileList.addLine();
		for(unsigned long i=1;i<tmpFileList.getLine()->getElementCount();i++){
			fileList.getLine(fileList.getLineCount()-1).addElement(tmpFileList.getLine(ll).getElement(i));
		}
	}

	//Create and initialise the accumulator
	TVAcc tvAcc(fileList, config);

	//Load TotalVariability matrix
	tvAcc.loadT(config.getParam("totalVariabilityMatrix"), config);

	//Statistics
	if((config.existsParam("loadAccs")) && config.getParam("loadAccs").toBool()){	//load pre-computed statistics
		cout<<"	(IvExtractor) Load Accumulators"<<endl;
		tvAcc.loadN(config);
		tvAcc.loadF_X(config);
	}
	else{															//Compute statistics if they don't exists
		tvAcc.computeAndAccumulateTVStat(config);
		tvAcc.saveAccs(config);
	}

	// Then load the meanEstimate computed by minDiv if required
	DoubleVector meanEstimate = tvAcc.getUbmMeans();
	if(config.existsParam("minDivergence")&& config.getParam("minDivergence").toBool()){
		String minDivName = config.getParam("matrixFilesPath") + config.getParam("meanEstimate") + config.getParam("loadMatrixFilesExtension");
		Matrix<double> tmpMean(minDivName,config);
		for(unsigned long i=0;i<meanEstimate.size();i++){
			meanEstimate[i] = tmpMean(0,i);
		}
	}
	//Update the mean Estimate
	cout<<"	(IvExtractor) Load Mean Estimate"<<endl;
	tvAcc.loadMeanEstimate(meanEstimate);

	//Substract mean from the statistics
	tvAcc.substractM(config);

	//Compute vEvT for each session
	tvAcc.estimateTETt(config);

	// Estimate I-Vectors
	tvAcc.estimateW(config);

	cout<<"--------- save IV by File --------"<<endl;
	tvAcc.saveWbyFile(config);
	cout<<"--------- end of process --------"<<endl;

} // fin try
catch (Exception& e) {cout << e.toString().c_str() << endl;}
return 0;
}
开发者ID:orsonwang,项目名称:ALIZE-LIA_RAL-extensions,代码行数:79,代码来源:IvExtractor.cpp


注:本文中的XList::getLineCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。