possibly fixed crash boost caused by the recent modification; slightly improved mlp params in letter_recog sample

This commit is contained in:
Vadim Pisarevsky 2012-06-09 07:05:24 +00:00
parent e86f0aaea1
commit 1e14d84008
2 changed files with 12 additions and 5 deletions

View File

@ -1250,7 +1250,7 @@ CvBoost::update_weights( CvBoostTree* tree )
if( have_subsample )
{
float* values = (float*)cur_buf_pos;
cur_buf_pos = (uchar*)(values + data->buf->step);
cur_buf_pos = (uchar*)(values + data->buf->cols);
uchar* missing = cur_buf_pos;
cur_buf_pos = missing + data->buf->step;
CvMat _sample, _mask;

View File

@ -437,13 +437,20 @@ int build_mlp_classifier( char* data_filename,
cvMat( 1, (int)(sizeof(layer_sz)/sizeof(layer_sz[0])), CV_32S, layer_sz );
mlp.create( &layer_sizes );
printf( "Training the classifier (may take a few minutes)...\n");
mlp.train( &train_data, new_responses, 0, 0,
CvANN_MLP_TrainParams(cvTermCriteria(CV_TERMCRIT_ITER,300,0.01),
#if 1
CvANN_MLP_TrainParams::BACKPROP,0.001));
int method = CvANN_MLP_TrainParams::BACKPROP;
double method_param = 0.001;
int max_iter = 300;
#else
CvANN_MLP_TrainParams::RPROP,0.05));
int method = CvANN_MLP_TrainParams::RPROP;
double method_param = 0.1;
int max_iter = 1000;
#endif
mlp.train( &train_data, new_responses, 0, 0,
CvANN_MLP_TrainParams(cvTermCriteria(CV_TERMCRIT_ITER,max_iter,0.01),
method, method_param));
cvReleaseMat( &new_responses );
printf("\n");
}