Ask Your Question

ImageClassif75's profile - activity

2013-05-21 14:44:18 -0600 commented question ANN prediction

I am using OpenCV 2.4.3 version.

2013-05-21 14:35:28 -0600 commented question ANN prediction

Hi Berak, Thank you for your reply. I get the same result for most cases, but for some rows, the response differs. For example, for the input data I have column1 for solution1 and column2 for solution2 :

Column1 Column2

1.80621 1.80621

1.80621 1.80621

1.80621 1.80621

1.80621 1.80621

1.80621 1.80621

1.80621 1.80621

1.80621 1.80621

-0.309371 -0.309371

1.80621 -0.309371

-0.309371 -0.309371

-0.309371 -0.309371

-0.309371 -0.309371

-0.309371 -0.309371

-0.309371 -0.309371

-0.309371 -0.309371

-0.309371 -0.309371

-0.309371 -0.309371

-0.309371 -0.309371

-0.309371 -0.309371

-0.309371 -0.309371

-0.309371 -0.309371

-0.309371 1.80621

1.80621 1.80621

-0.309371 1.80621

1.80621 1.80621

1.80621 1.80621

1.80621 1.80621

1.80621 1 ... (more)

2013-05-20 16:53:47 -0600 received badge  Student (source)
2013-05-20 14:18:11 -0600 asked a question ANN prediction

I am using CvANN_MLP. When I call predict(), I don't get the same responses when I give all the data at once (1 row = vector) and when I make a loop and submit the vector one by one myself.

Here are my 2 solutions :

solution1 :

for (int z = 0; z<valid_data.rows; z++)
{
    Mat sample = valid_data.row(z);
    Mat result_test = Mat(1, 1, CV_32FC1);  
    ann.predict(sample, result_test);
    result_.at<float>(z) = result_test.at<float>(0);
}

solution2 :

 float res = ann.predict(valid_data, result_);

They don't give the same result, but they sould right?