|
|
|
@ -51,7 +51,7 @@ CV_SLMLTest::CV_SLMLTest( const char* _modelName, const char* _testName ) : |
|
|
|
|
|
|
|
|
|
int CV_SLMLTest::run_test_case( int testCaseIdx ) |
|
|
|
|
{ |
|
|
|
|
int code = CvTS::OK; |
|
|
|
|
int code = CvTS::OK; |
|
|
|
|
code = prepare_test_case( testCaseIdx ); |
|
|
|
|
|
|
|
|
|
if( code == CvTS::OK ) |
|
|
|
@ -61,10 +61,14 @@ int CV_SLMLTest::run_test_case( int testCaseIdx ) |
|
|
|
|
if( code == CvTS::OK ) |
|
|
|
|
{ |
|
|
|
|
get_error( testCaseIdx, CV_TEST_ERROR, &test_resps1 ); |
|
|
|
|
save( tmpnam( fname1 ) ); |
|
|
|
|
tmpnam(fname1); |
|
|
|
|
if(fname1[0] == '\\') fname1[0] = '_'; |
|
|
|
|
save( fname1 ); |
|
|
|
|
load( fname1); |
|
|
|
|
get_error( testCaseIdx, CV_TEST_ERROR, &test_resps2 ); |
|
|
|
|
save( tmpnam( fname2 ) ); |
|
|
|
|
tmpnam(fname2); |
|
|
|
|
if(fname2[0] == '\\') fname2[0] = '_'; |
|
|
|
|
save( fname2 ); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
ts->printf( CvTS::LOG, "model can not be trained" ); |
|
|
|
@ -87,15 +91,15 @@ int CV_SLMLTest::validate_test_results( int testCaseIdx ) |
|
|
|
|
getline( f2, s2 ); |
|
|
|
|
if( s1.compare(s2) ) |
|
|
|
|
{ |
|
|
|
|
ts->printf( CvTS::LOG, "first and second saved files differ in %n-line; first %n line: %s; second %n-line: %s", |
|
|
|
|
lineIdx, lineIdx, s1.c_str(), lineIdx, s2.c_str() ); |
|
|
|
|
ts->printf( CvTS::LOG, "first and second saved files differ in %n-line; first %n line: %s; second %n-line: %s", |
|
|
|
|
lineIdx, lineIdx, s1.c_str(), lineIdx, s2.c_str() ); |
|
|
|
|
code = CvTS::FAIL_INVALID_OUTPUT; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if( !f1.eof() || !f2.eof() ) |
|
|
|
|
{ |
|
|
|
|
ts->printf( CvTS::LOG, "in test case %d first and second saved files differ in %n-line; first %n line: %s; second %n-line: %s", |
|
|
|
|
testCaseIdx, lineIdx, lineIdx, s1.c_str(), lineIdx, s2.c_str() ); |
|
|
|
|
ts->printf( CvTS::LOG, "in test case %d first and second saved files differ in %n-line; first %n line: %s; second %n-line: %s", |
|
|
|
|
testCaseIdx, lineIdx, lineIdx, s1.c_str(), lineIdx, s2.c_str() ); |
|
|
|
|
code = CvTS::FAIL_INVALID_OUTPUT; |
|
|
|
|
} |
|
|
|
|
f1.close(); |
|
|
|
@ -111,21 +115,21 @@ int CV_SLMLTest::validate_test_results( int testCaseIdx ) |
|
|
|
|
{ |
|
|
|
|
if( fabs(*it1 - *it2) > FLT_EPSILON ) |
|
|
|
|
{ |
|
|
|
|
ts->printf( CvTS::LOG, "in test case %d responses predicted before saving and after loading is different", testCaseIdx ); |
|
|
|
|
ts->printf( CvTS::LOG, "in test case %d responses predicted before saving and after loading is different", testCaseIdx ); |
|
|
|
|
code = CvTS::FAIL_INVALID_OUTPUT; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return code; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CV_SLMLTest lsmlnbayes( CV_NBAYES, "slnbayes" ); |
|
|
|
|
//CV_SLMLTest lsmlknearest( CV_KNEAREST, "slknearest" ); // does not support save!
|
|
|
|
|
CV_SLMLTest lsmlsvm( CV_SVM, "slsvm" ); |
|
|
|
|
//CV_SLMLTest lsmlem( CV_EM, "slem" ); // does not support save!
|
|
|
|
|
CV_SLMLTest lsmlann( CV_ANN, "slann" ); |
|
|
|
|
CV_SLMLTest slmldtree( CV_DTREE, "sldtree" ); |
|
|
|
|
CV_SLMLTest slmlboost( CV_BOOST, "slboost" ); |
|
|
|
|
CV_SLMLTest slmlrtrees( CV_RTREES, "slrtrees" ); |
|
|
|
|
CV_SLMLTest slmlertrees( CV_ERTREES, "slertrees" ); |
|
|
|
|
|
|
|
|
|
CV_SLMLTest lsmlnbayes( CV_NBAYES, "slnbayes" ); |
|
|
|
|
//CV_SLMLTest lsmlknearest( CV_KNEAREST, "slknearest" ); // does not support save!
|
|
|
|
|
CV_SLMLTest lsmlsvm( CV_SVM, "slsvm" ); |
|
|
|
|
//CV_SLMLTest lsmlem( CV_EM, "slem" ); // does not support save!
|
|
|
|
|
CV_SLMLTest lsmlann( CV_ANN, "slann" ); |
|
|
|
|
CV_SLMLTest slmldtree( CV_DTREE, "sldtree" ); |
|
|
|
|
CV_SLMLTest slmlboost( CV_BOOST, "slboost" ); |
|
|
|
|
CV_SLMLTest slmlrtrees( CV_RTREES, "slrtrees" ); |
|
|
|
|
CV_SLMLTest slmlertrees( CV_ERTREES, "slertrees" ); |
|
|
|
|
|
|
|
|
|
/* End of file. */ |
|
|
|
|