本文整理汇总了C++中Param::GetVectors方法的典型用法代码示例。如果您正苦于以下问题:C++ Param::GetVectors方法的具体用法?C++ Param::GetVectors怎么用?C++ Param::GetVectors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Param
的用法示例。
在下文中一共展示了Param::GetVectors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
//.........这里部分代码省略.........