本文整理汇总了C++中GestureRecognitionPipeline::loadPipelineFromFile方法的典型用法代码示例。如果您正苦于以下问题:C++ GestureRecognitionPipeline::loadPipelineFromFile方法的具体用法?C++ GestureRecognitionPipeline::loadPipelineFromFile怎么用?C++ GestureRecognitionPipeline::loadPipelineFromFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GestureRecognitionPipeline
的用法示例。
在下文中一共展示了GestureRecognitionPipeline::loadPipelineFromFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, const char * argv[])
{
//Load some training data from a file
ClassificationData trainingData;
if( !trainingData.loadDatasetFromFile("HelloWorldTrainingData.grt") ){
cout << "ERROR: Failed to load training data from file\n";
return EXIT_FAILURE;
}
cout << "Data Loaded\n";
//Print out some stats about the training data
trainingData.printStats();
//Partition the training data into a training dataset and a test dataset. 80 means that 80%
//of the data will be used for the training data and 20% will be returned as the test dataset
ClassificationData testData = trainingData.partition(80);
//Create a new Gesture Recognition Pipeline using an Adaptive Naive Bayes Classifier
GestureRecognitionPipeline pipeline;
pipeline.setClassifier( ANBC() );
//Train the pipeline using the training data
if( !pipeline.train( trainingData ) ){
cout << "ERROR: Failed to train the pipeline!\n";
return EXIT_FAILURE;
}
//Save the pipeline to a file
if( !pipeline.savePipelineToFile( "HelloWorldPipeline.grt" ) ){
cout << "ERROR: Failed to save the pipeline!\n";
return EXIT_FAILURE;
}
//Load the pipeline from a file
if( !pipeline.loadPipelineFromFile( "HelloWorldPipeline.grt" ) ){
cout << "ERROR: Failed to load the pipeline!\n";
return EXIT_FAILURE;
}
//Test the pipeline using the test data
if( !pipeline.test( testData ) ){
cout << "ERROR: Failed to test the pipeline!\n";
return EXIT_FAILURE;
}
//Print some stats about the testing
cout << "Test Accuracy: " << pipeline.getTestAccuracy() << endl;
cout << "Precision: ";
for(UINT k=0; k<pipeline.getNumClassesInModel(); k++){
UINT classLabel = pipeline.getClassLabels()[k];
cout << "\t" << pipeline.getTestPrecision(classLabel);
}cout << endl;
cout << "Recall: ";
for(UINT k=0; k<pipeline.getNumClassesInModel(); k++){
UINT classLabel = pipeline.getClassLabels()[k];
cout << "\t" << pipeline.getTestRecall(classLabel);
}cout << endl;
cout << "FMeasure: ";
for(UINT k=0; k<pipeline.getNumClassesInModel(); k++){
UINT classLabel = pipeline.getClassLabels()[k];
cout << "\t" << pipeline.getTestFMeasure(classLabel);
}cout << endl;
MatrixDouble confusionMatrix = pipeline.getTestConfusionMatrix();
cout << "ConfusionMatrix: \n";
for(UINT i=0; i<confusionMatrix.getNumRows(); i++){
for(UINT j=0; j<confusionMatrix.getNumCols(); j++){
cout << confusionMatrix[i][j] << "\t";
}cout << endl;
}
return EXIT_SUCCESS;
}