All modules (except ocl and gpu) compiles and pass tests

This commit is contained in:
Andrey Kamaev
2013-03-20 20:13:46 +04:00
parent 762aefd71b
commit 2ad7b97f1c
91 changed files with 606 additions and 604 deletions

View File

@@ -48,7 +48,7 @@ Class for loading the data from a ``.csv`` file.
void set_miss_ch( char ch );
char get_miss_ch() const;
const std::map<std::string, int>& get_class_labels_map() const;
const std::map<cv::String, int>& get_class_labels_map() const;
protected:
...
@@ -245,7 +245,7 @@ CvMLData::get_class_labels_map
-------------------------------
Returns a map that converts strings to labels.
.. ocv:function:: const std::map<std::string, int>& CvMLData::get_class_labels_map() const
.. ocv:function:: const std::map<cv::String, int>& CvMLData::get_class_labels_map() const
The method returns a map that converts string class labels to the numerical class labels. It can be used to get an original class label as in a file.

View File

@@ -1043,7 +1043,7 @@ public:
CvForestTree* get_tree(int i) const;
protected:
virtual std::string getName() const;
virtual cv::String getName() const;
virtual bool grow_forest( const CvTermCriteria term_crit );
@@ -1115,7 +1115,7 @@ public:
CvRTParams params=CvRTParams());
virtual bool train( CvMLData* data, CvRTParams params=CvRTParams() );
protected:
virtual std::string getName() const;
virtual cv::String getName() const;
virtual bool grow_forest( const CvTermCriteria term_crit );
};
@@ -2072,7 +2072,7 @@ public:
void set_miss_ch( char ch );
char get_miss_ch() const;
const std::map<std::string, int>& get_class_labels_map() const;
const std::map<cv::String, int>& get_class_labels_map() const;
protected:
virtual void clear();
@@ -2101,7 +2101,7 @@ protected:
bool mix;
int total_class_count;
std::map<std::string, int> class_map;
std::map<cv::String, int> class_map;
CvMat* train_sample_idx;
CvMat* test_sample_idx;

View File

@@ -285,7 +285,7 @@ const CvMat* CvMLData::get_missing() const
return missing;
}
const std::map<std::string, int>& CvMLData::get_class_labels_map() const
const std::map<cv::String, int>& CvMLData::get_class_labels_map() const
{
return class_map;
}

View File

@@ -1537,7 +1537,7 @@ CvERTrees::~CvERTrees()
{
}
std::string CvERTrees::getName() const
cv::String CvERTrees::getName() const
{
return CV_TYPE_NAME_ML_ERTREES;
}

View File

@@ -1117,7 +1117,7 @@ void CvGBTrees::write( CvFileStorage* fs, const char* name ) const
CvSeqReader reader;
int i;
std::string s;
cv::String s;
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_GBT );
@@ -1167,7 +1167,7 @@ void CvGBTrees::read( CvFileStorage* fs, CvFileNode* node )
CvFileNode* trees_fnode;
CvMemStorage* storage;
int i, ntrees;
std::string s;
cv::String s;
clear();
read_params( fs, node );

View File

@@ -45,6 +45,7 @@
#include "cvconfig.h"
#endif
#include "opencv2/core.hpp"
#include "opencv2/ml.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/core/utility.hpp"

View File

@@ -246,7 +246,7 @@ CvRTrees::~CvRTrees()
clear();
}
std::string CvRTrees::getName() const
cv::String CvRTrees::getName() const
{
return CV_TYPE_NAME_ML_RTREES;
}
@@ -730,7 +730,7 @@ void CvRTrees::write( CvFileStorage* fs, const char* name ) const
if( ntrees < 1 || !trees || nsamples < 1 )
CV_Error( CV_StsBadArg, "Invalid CvRTrees object" );
std::string modelNodeName = this->getName();
cv::String modelNodeName = this->getName();
cvStartWriteStruct( fs, name, CV_NODE_MAP, modelNodeName.c_str() );
cvWriteInt( fs, "nclasses", nclasses );

View File

@@ -1924,7 +1924,7 @@ bool CvSVM::train_auto( const CvMat* _train_data, const CvMat* _responses,
qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio);
double old_dist = 0.0;
for (int k=0; k<k_fold; ++k)
old_dist += abs(ratios[k].val-class_ratio);
old_dist += cv::abs(ratios[k].val-class_ratio);
double new_dist = 1.0;
// iterate to make the folds more balanced
while (new_dist > 0.0)
@@ -1941,7 +1941,7 @@ bool CvSVM::train_auto( const CvMat* _train_data, const CvMat* _responses,
qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio);
new_dist = 0.0;
for (int k=0; k<k_fold; ++k)
new_dist += abs(ratios[k].val-class_ratio);
new_dist += cv::abs(ratios[k].val-class_ratio);
if (new_dist < old_dist)
{
// swapping really improves, so swap the samples

View File

@@ -179,7 +179,7 @@ float knearest_calc_error( CvKNearest* knearest, CvMLData* _data, int k, int typ
}
// 3. svm
int str_to_svm_type(string& str)
int str_to_svm_type(String& str)
{
if( !str.compare("C_SVC") )
return CvSVM::C_SVC;
@@ -194,7 +194,7 @@ int str_to_svm_type(string& str)
CV_Error( CV_StsBadArg, "incorrect svm type string" );
return -1;
}
int str_to_svm_kernel_type( string& str )
int str_to_svm_kernel_type( String& str )
{
if( !str.compare("LINEAR") )
return CvSVM::LINEAR;
@@ -297,7 +297,7 @@ float svm_calc_error( CvSVM* svm, CvMLData* _data, int type, vector<float> *resp
// 4. em
// 5. ann
int str_to_ann_train_method( string& str )
int str_to_ann_train_method( String& str )
{
if( !str.compare("BACKPROP") )
return CvANN_MLP_TrainParams::BACKPROP;
@@ -412,7 +412,7 @@ float ann_calc_error( CvANN_MLP* ann, CvMLData* _data, map<int, int>& cls_map, i
// 6. dtree
// 7. boost
int str_to_boost_type( string& str )
int str_to_boost_type( String& str )
{
if ( !str.compare("DISCRETE") )
return CvBoost::DISCRETE;
@@ -546,7 +546,7 @@ void CV_MLBaseTest::run( int )
int CV_MLBaseTest::prepare_test_case( int test_case_idx )
{
int trainSampleCount, respIdx;
string varTypes;
String varTypes;
clear();
string dataPath = ts->get_data_path();
@@ -605,7 +605,7 @@ int CV_MLBaseTest::train( int testCaseIdx )
}
else if( !modelName.compare(CV_SVM) )
{
string svm_type_str, kernel_type_str;
String svm_type_str, kernel_type_str;
modelParamsNode["svm_type"] >> svm_type_str;
modelParamsNode["kernel_type"] >> kernel_type_str;
CvSVMParams params;
@@ -625,7 +625,7 @@ int CV_MLBaseTest::train( int testCaseIdx )
}
else if( !modelName.compare(CV_ANN) )
{
string train_method_str;
String train_method_str;
double param1, param2;
modelParamsNode["train_method"] >> train_method_str;
modelParamsNode["param1"] >> param1;
@@ -659,7 +659,7 @@ int CV_MLBaseTest::train( int testCaseIdx )
int BOOST_TYPE, WEAK_COUNT, MAX_DEPTH;
float WEIGHT_TRIM_RATE;
bool USE_SURROGATE;
string typeStr;
String typeStr;
modelParamsNode["type"] >> typeStr;
BOOST_TYPE = str_to_boost_type( typeStr );
modelParamsNode["weak_count"] >> WEAK_COUNT;