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


C++ Param::Load方法代码示例

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


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

示例1: Load

void Accessor::Load(
	lpxmlnode						pNode)
{
	m_source	= GetAttributeStringValue("source", pNode);
	m_count		= GetAttributeIntegerValue("count", pNode);
	m_stride	= GetAttributeIntegerValue("stride", pNode);

	uint i=0;
	lpxmlnode pCurrNode = pNode->first_node();
	do {
		std::string Name = pCurrNode->name();
		if(Name == "param") {
			Param prm;
			prm.Load(pCurrNode);
			m_param.push_back(prm);
		} 
		pCurrNode = pCurrNode->next_sibling();
	}	while(pCurrNode != NULL);
}
开发者ID:TimelessVisions,项目名称:GLEngine,代码行数:19,代码来源:ColladaDoc.cpp

示例2: main

int main(int argc, char* argv[])
{
	OPTIONS opt;
	if(!LoadConfiguration(argc, argv, opt))
		return 1;

	clock_t time_b, time_e;
	time_b = clock();

	try {
		// load input lists
		CFileList files("Files");
		CFileList **fileLists;

		loadFileLists(files, opt);

		// load GMM
		GMModel GMM;
		if (GMM.Load(opt.GMM_file.c_str(), opt.load_txt) != 0) {
			error_report = string("GMM model [") + opt.GMM_file + "] not found";
			throw runtime_error(error_report.c_str());
		}
		unsigned int M = GMM.GetNumberOfMixtures();
		unsigned int D = GMM.GetDimension();

		// prepare estimator
		GMMStatsEstimator<realT> *estimator;
		if(opt.SSEacc) {
			estimator = new GMMStatsEstimator_SSE <realT>;
		}
#ifdef _CUDA
		else if(opt.CUDAacc) {
			estimator = new GMMStatsEstimator_CUDA <realT> (opt.cudaGPUid);
		}
#endif
		else {
			estimator = new GMMStatsEstimator <realT>;
		}

		if(opt.verbosity > 1)
			cout << " [" << estimator->getEstimationType().c_str() << " Estimation ON]" << endl;

		estimator->insertModel(GMM);
		estimator->_numThreads = opt.numThreads;
		estimator->_verbosity = opt.verbosity;

		char *filename;
		string outFileName;

		if(opt.verbosity > 1)
			cout << "Log-likes are going to be computed [#files = " << files.ListLength() << "]" << endl;

		float *outLLs = NULL;
		unsigned int outLLs_size = 0;

		Param param;
		files.Rewind();
		while(files.GetItemName(&filename)) {		
			
			if(param.Load(filename, opt.load_type, opt.dwnsmp) != 0) {
				cerr << "WARNING: Param file [" << filename << "] not found -> skipped!" << endl;
				continue;
			}

			unsigned int NSamples = (unsigned int) param.GetNumberOfVectors();
			unsigned int prmdim = (unsigned int) param.GetVectorDim();

			if(NSamples < 1 && opt.verbosity > 1) {
				cerr << "WARNING: Param file [" << filename << "] empty" << endl;
				continue;
			}

			if (NSamples > outLLs_size) {
				delete[] outLLs;
				outLLs = new float [NSamples];
				outLLs_size = NSamples;
			}
			estimator->compVecsLogLikeMT(*param.GetVectors(), NSamples, prmdim, outLLs);

			if(estimator->_fNumStabilityTroubles) {
				cerr << "WARNING: numerical stability troubles detected [file> " << filename << "]" << endl;
				estimator->_fNumStabilityTroubles = false;
			}

			if (opt.forEachVec) {
				string foo(filename);
				GetNewPath(outFileName, foo, opt.outputDir, opt.outExt);
				saveMat<float> (outFileName.c_str(), opt.save_txt, outLLs, 1, NSamples);
			}
			else {
				float meanLL = 0.0f;
				for (unsigned int n = 0; n < NSamples; n++)
					meanLL += outLLs[n];
				meanLL /= NSamples;
				cout << "\r" << filename << "\t" << meanLL << "\n";
			}
		}

		delete estimator;
		delete[] outLLs;
//.........这里部分代码省略.........
开发者ID:GMMTeam,项目名称:GMM,代码行数:101,代码来源:main.cpp


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