Ask Your Question
0

Why am I getting error "'train' is ambiguous" when trying to train this MLP?

asked 2012-09-14 12:27:39 -0600

ZachTM gravatar image

I have the following code in my first attempt to use neural networks in opencv:

//Neural network
CvANN_MLP network;

Mat layer_sizes = Mat::zeros(1,3,CV_32S);
layer_sizes.at<int>(0,0) = data.cols;
layer_sizes.at<int>(0,1) = 163;
layer_sizes.at<int>(0,2) = NUM_LETTERS;

int method = CvANN_MLP_TrainParams::BACKPROP;
double method_param = 0.001;
int max_iter = 300;

network.train( data, dataLabels, 0, 0,
    CvANN_MLP_TrainParams(cvTermCriteria(CV_TERMCRIT_ITER,max_iter,0.01),
                          method, method_param));

data is 78 rows by 300 cols

dataLabels is 78 rows by 26 cols.

I realize my training set is way too small, I am just trying to get this to compile.

This was all adapted from the included sample letter recognizer. in the network.train call data and datalabels are both Mat objects that are filled with row vectors of binary values. I am getting an error that "'train' is ambiguious" on train. Does anyone see anything wrong with my code?

Thanks for any help!

edit retag flag offensive close merge delete

Comments

I have so many questions. But to start ... This question says, "This was all adapted from the included sample letter recognizer." Where can I find that included sample letter recognizer?

zerowords gravatar imagezerowords ( 2012-12-02 10:01:32 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-09-14 19:04:01 -0600

ZachTM gravatar image

Alright well I fixed this by converting my input and output data from Mat to CvMat. It seems I have to do this for all of the neural network functions. Does anyone know if the C++ interface for neural networks is supposed to be working and if it is what might i be doing wrong? It looks messy having to go back and forth from Mat to CvMat.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-09-14 12:27:39 -0600

Seen: 429 times

Last updated: Sep 14 '12