a big patch; use special proxy types (Input/OutputArray, Input/OutputArrayOfArrays) for passing in vectors, matrices etc.
This commit is contained in:
@@ -1228,7 +1228,7 @@ int CvANN_MLP::train_rprop( CvVectors x0, CvVectors u, const double* sw )
|
||||
|
||||
__BEGIN__;
|
||||
|
||||
int i, ivcount, ovcount, l_count, total = 0, max_iter, buf_sz, dcount0, dcount=0;
|
||||
int i, ivcount, ovcount, l_count, total = 0, max_iter, buf_sz, dcount0;
|
||||
double *buf_ptr;
|
||||
double prev_E = DBL_MAX*0.5, epsilon;
|
||||
double dw_plus, dw_minus, dw_min, dw_max;
|
||||
@@ -1294,10 +1294,7 @@ int CvANN_MLP::train_rprop( CvVectors x0, CvVectors u, const double* sw )
|
||||
*/
|
||||
for( iter = 0; iter < max_iter; iter++ )
|
||||
{
|
||||
int n1, n2, si, j, k;
|
||||
double* w;
|
||||
CvMat _w, _dEdw, hdr1, hdr2, ghdr1, ghdr2, _df;
|
||||
CvMat *x1, *x2, *grad1, *grad2, *temp;
|
||||
int n1, n2, j, k;
|
||||
double E = 0;
|
||||
|
||||
// first, iterate through all the samples and compute dEdw
|
||||
|
||||
@@ -355,8 +355,6 @@ float CvKNearest::find_nearest( const CvMat* _samples, int k, CvMat* _results,
|
||||
float result = 0.f;
|
||||
const int max_blk_count = 128, max_buf_sz = 1 << 12;
|
||||
|
||||
int i, count, count_scale, blk_count0, blk_count = 0, buf_sz, k1;
|
||||
|
||||
if( !samples )
|
||||
CV_Error( CV_StsError, "The search tree must be constructed first using train method" );
|
||||
|
||||
@@ -395,15 +393,15 @@ float CvKNearest::find_nearest( const CvMat* _samples, int k, CvMat* _results,
|
||||
"The distances from the neighbors (if present) must be floating-point matrix of <num_samples> x <k> size" );
|
||||
}
|
||||
|
||||
count = _samples->rows;
|
||||
count_scale = k*2;
|
||||
blk_count0 = MIN( count, max_blk_count );
|
||||
buf_sz = MIN( blk_count0 * count_scale, max_buf_sz );
|
||||
int count = _samples->rows;
|
||||
int count_scale = k*2;
|
||||
int blk_count0 = MIN( count, max_blk_count );
|
||||
int buf_sz = MIN( blk_count0 * count_scale, max_buf_sz );
|
||||
blk_count0 = MAX( buf_sz/count_scale, 1 );
|
||||
blk_count0 += blk_count0 % 2;
|
||||
blk_count0 = MIN( blk_count0, count );
|
||||
buf_sz = blk_count0 * count_scale + k;
|
||||
k1 = get_sample_count();
|
||||
int k1 = get_sample_count();
|
||||
k1 = MIN( k1, k );
|
||||
|
||||
cv::parallel_for(cv::BlockedRange(0, count), P1(this, buf_sz, k, _samples, _neighbors, k1,
|
||||
|
||||
@@ -203,7 +203,7 @@ void CV_KMeansTest::run( int /*start_from*/ )
|
||||
int code = cvtest::TS::OK;
|
||||
Mat bestLabels;
|
||||
// 1. flag==KMEANS_PP_CENTERS
|
||||
kmeans( data, 3, bestLabels, TermCriteria( TermCriteria::COUNT, iters, 0.0), 0, KMEANS_PP_CENTERS, 0 );
|
||||
kmeans( data, 3, bestLabels, TermCriteria( TermCriteria::COUNT, iters, 0.0), 0, KMEANS_PP_CENTERS, OutputArray() );
|
||||
if( calcErr( bestLabels, labels, sizes, false ) > 0.01f )
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "bad accuracy if flag==KMEANS_PP_CENTERS" );
|
||||
@@ -211,7 +211,7 @@ void CV_KMeansTest::run( int /*start_from*/ )
|
||||
}
|
||||
|
||||
// 2. flag==KMEANS_RANDOM_CENTERS
|
||||
kmeans( data, 3, bestLabels, TermCriteria( TermCriteria::COUNT, iters, 0.0), 0, KMEANS_RANDOM_CENTERS, 0 );
|
||||
kmeans( data, 3, bestLabels, TermCriteria( TermCriteria::COUNT, iters, 0.0), 0, KMEANS_RANDOM_CENTERS, OutputArray() );
|
||||
if( calcErr( bestLabels, labels, sizes, false ) > 0.01f )
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "bad accuracy if flag==KMEANS_PP_CENTERS" );
|
||||
@@ -223,7 +223,7 @@ void CV_KMeansTest::run( int /*start_from*/ )
|
||||
RNG rng;
|
||||
for( int i = 0; i < 0.5f * pointsCount; i++ )
|
||||
bestLabels.at<int>( rng.next() % pointsCount, 0 ) = rng.next() % 3;
|
||||
kmeans( data, 3, bestLabels, TermCriteria( TermCriteria::COUNT, iters, 0.0), 0, KMEANS_USE_INITIAL_LABELS, 0 );
|
||||
kmeans( data, 3, bestLabels, TermCriteria( TermCriteria::COUNT, iters, 0.0), 0, KMEANS_USE_INITIAL_LABELS, OutputArray() );
|
||||
if( calcErr( bestLabels, labels, sizes, false ) > 0.01f )
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "bad accuracy if flag==KMEANS_PP_CENTERS" );
|
||||
|
||||
Reference in New Issue
Block a user