本文整理汇总了C++中WorkSpace::CalcLikelihoodVector方法的典型用法代码示例。如果您正苦于以下问题:C++ WorkSpace::CalcLikelihoodVector方法的具体用法?C++ WorkSpace::CalcLikelihoodVector怎么用?C++ WorkSpace::CalcLikelihoodVector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorkSpace
的用法示例。
在下文中一共展示了WorkSpace::CalcLikelihoodVector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_extra_recognition
// Created on 2008-07-10
// Test for what's happen when the extrapolated motion patterns are recognized by mimesis
// also for RSJ conf. 2008
int test_extra_recognition(void)
{
tl_message ("start");
JHMM *hmm1 = NULL, *hmm2 = NULL, *hmm3 = NULL, *synthesis_hmm = NULL;
Behavior *beh = NULL;
JHMM *hmm_vec[3];
double weight[3];
int i;
hmm1 = new JHMM;
hmm2 = new JHMM;
hmm3 = new JHMM;
hmm1->Load("./.tmp/punch/punch.hmm");
hmm2->Load("./.tmp/squat/squat.hmm");
hmm3->Load("./.tmp/kick/kick.hmm");
hmm_vec[0] = hmm1;
hmm_vec[1] = hmm2;
hmm_vec[2] = hmm3;
WorkSpace *work = NULL;
work = new WorkSpace();
if (script_file[0]==0) { print_usage(); exit(0); }
work->LoadMotionDB (script_file);
work->SetHTKUnitsFromMotionDB ();
work->BeforeRecognize();
work->DistanceLoad ("../../script/symbol_data/tmp_distance_vector");
work->SpaceLoad ("../../script/symbol_data/tmp_dim.spc");
vector<double> tmp_dis, new_dis, hellinger, tmp_cord;
vector<double> likelihood;
tl_message ("# of motion db is : %d\n", work->GetNumOfMotionDB() );
cout << "c_1, c_2, ";
for (i=0; i<(int)(work->GetNumOfMotionDB()); i++)
cout << "old_KLdistance[" << i << "] ,";
for (i=0; i<(int)(work->GetNumOfMotionDB()); i++)
cout << "new_KLdivergence[" << i << "] ,";
for (i=0; i<(int)(work->GetNumOfMotionDB()); i++)
cout << "Hellinger Distance[" << i << "] ,";
for (i=0; i<(int)(work->GetPsymbolSpace()->GetDimension() ); i++)
cout << "x[" << i << "] , ";
cout << endl;
for (int i=-10; i<20; i++)
{
synthesis_hmm = new JHMM;
weight[0] = i * 0.1;
weight[1] = 1 - weight[0];
synthesis_hmm->InterpolationAny (hmm_vec, weight, 2);
beh = synthesis_hmm->GenerateBehavior(100, 30);
work->CalcHellingerDistanceOfOnlineBehavior(beh, hellinger);
tl_message ("step hoge %d.0", i);
for (int j=0; j<(int)(hellinger.size()); j++)
cout << hellinger[j] << " , ";
cout << endl;
tl_message ("step hoge %d.1", i);
work->CalcLikelihoodVector (beh, likelihood);
tl_message ("step hoge %d.2", i);
work->CalcDistanceOfInputBehavior (beh, tmp_dis);
tl_message ("step hoge %d.3", i);
work->CalcDistanceOfOnlineBehavior(beh, new_dis);
tl_message ("step hoge %d.4", i);
work->GetPsymbolSpace()->CoordinateFromDistanceData(tmp_dis, tmp_cord);
tl_message ("step hoge %d.5", i);
cout << weight[0] << " , " << weight[1] << " , ";
for (int j=0; j<(int)(tmp_dis.size()); j++)
cout << tmp_dis[j] << " , ";
for (int j=0; j<(int)(new_dis.size()); j++)
cout << new_dis[j] << " , ";
for (int j=0; j<(int)(hellinger.size()); j++)
cout << hellinger[j] << " , ";
for (int j=0; j<(int)(tmp_cord.size()); j++)
cout << tmp_cord[j] << " , ";
cout << endl;
delete synthesis_hmm;
}
delete beh;
delete hmm1;
delete hmm2;
delete hmm3;
delete synthesis_hmm;
return TRUE;
}