Ask Your Question

Revision history [back]

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);="" <br=""> 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?

click to hide/show revision 2
No.2 Revision

updated 2013-05-20 14:32:43 -0600

berak gravatar image

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);="" <br=""> ann.predict(sample, result_test); result_.at<float>(z) = result_test.at<float>(0); }

  • solution2 :

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

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

click to hide/show revision 3
No.3 Revision

updated 2013-05-20 14:34:33 -0600

berak gravatar image

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++){="" z++)="" {="" mat="" sample="valid_data.row(z);" mat="" result_test="Mat(1," 1,="" cv_32fc1);="" <br=""> 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?

click to hide/show revision 4
No.4 Revision

updated 2013-05-20 14:36:43 -0600

berak gravatar image

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);="" <br="">
    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_);

result_);

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