1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

initial commit; ml has been refactored; it compiles and the tests run well; some other modules, apps and samples do not compile; to be fixed

This commit is contained in:
Vadim Pisarevsky
2014-07-29 23:54:23 +04:00
parent dce1824a91
commit ba3783d205
25 changed files with 8320 additions and 21792 deletions
+19 -11
View File
@@ -25,6 +25,20 @@
#define CV_RTREES "rtrees"
#define CV_ERTREES "ertrees"
enum { CV_TRAIN_ERROR=0, CV_TEST_ERROR=1 };
using cv::Ptr;
using cv::ml::StatModel;
using cv::ml::TrainData;
using cv::ml::NormalBayesClassifier;
using cv::ml::SVM;
using cv::ml::KNearest;
using cv::ml::ParamGrid;
using cv::ml::ANN_MLP;
using cv::ml::DTrees;
using cv::ml::Boost;
using cv::ml::RTrees;
class CV_MLBaseTest : public cvtest::BaseTest
{
public:
@@ -39,24 +53,16 @@ protected:
virtual int validate_test_results( int testCaseIdx ) = 0;
int train( int testCaseIdx );
float get_error( int testCaseIdx, int type, std::vector<float> *resp = 0 );
float get_test_error( int testCaseIdx, std::vector<float> *resp = 0 );
void save( const char* filename );
void load( const char* filename );
CvMLData data;
Ptr<TrainData> data;
std::string modelName, validationFN;
std::vector<std::string> dataSetNames;
cv::FileStorage validationFS;
// MLL models
CvNormalBayesClassifier* nbayes;
CvKNearest* knearest;
CvSVM* svm;
CvANN_MLP* ann;
CvDTree* dtree;
CvBoost* boost;
CvRTrees* rtrees;
CvERTrees* ertrees;
Ptr<StatModel> model;
std::map<int, int> cls_map;
@@ -67,6 +73,7 @@ class CV_AMLTest : public CV_MLBaseTest
{
public:
CV_AMLTest( const char* _modelName );
virtual ~CV_AMLTest() {}
protected:
virtual int run_test_case( int testCaseIdx );
virtual int validate_test_results( int testCaseIdx );
@@ -76,6 +83,7 @@ class CV_SLMLTest : public CV_MLBaseTest
{
public:
CV_SLMLTest( const char* _modelName );
virtual ~CV_SLMLTest() {}
protected:
virtual int run_test_case( int testCaseIdx );
virtual int validate_test_results( int testCaseIdx );