Ask Your Question
0

Neural Network calling classifier

asked 2015-02-25 18:49:22 -0600

Hadi gravatar image

updated 2015-02-26 23:59:02 -0600

Hi, I trained one classifier for OCR testing using RPROP method but when i am trying to load the trained parameter file it is exiting the code without any error.

cv::String file_name = "C:\\Users\\param.xml";
ANN_MLP *nnetwork;

nnetwork->load<ANN_MLP>(file_name);

Is the call for the network correct ? Please help me out here. Thank you.

EDIT 1:

The function is exiting while checking for mapping in this code

 if( !CV_NODE_IS_MAP(map_node->tag) )
 {
      if( (!CV_NODE_IS_SEQ(map_node->tag) || map_node->data.seq->total != 0) &&
           CV_NODE_TYPE(map_node->tag) != CV_NODE_NONE )
           CV_Error( CV_StsError, "The node is neither a map nor an empty collection" );
       return 0;
 }

I checked the name of the node and its the same but it is still unable to map it correctly.

I used the following method to save the parameter file pelase see

FileStorage fs("C:\\Users\\param.xml", FileStorage::WRITE);
classifier->write(fs);
fs.release();
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-02-26 03:51:07 -0600

berak gravatar image

i guess, you wanted this:

cv::String file_name = "C:\\Users\\param.xml";
cv::Ptr<cv::ml::ANN_MLP> nnetwork = ml::StatModel::load<ANN_MLP>(file_name);
cerr << nnetwork->isTrained() << endl;

it's important, to have a cv::Ptr there, not a raw one, else it self-destroys it after coming out of load()

edit flag offensive delete link more

Comments

1

Its going inside the load function but not coming out of it. I have updated the question where it is exiting please see. Thank you

Hadi gravatar imageHadi ( 2015-02-26 18:16:05 -0600 )edit

ok. so there's a loading problem, too.

how big is your params.xml ?

berak gravatar imageberak ( 2015-02-27 00:55:32 -0600 )edit

https://www.dropbox.com/s/vz3t66vsc22... Here is the link to the param.xml file its around 1.8 MB

Hadi gravatar imageHadi ( 2015-02-27 03:30:34 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-02-25 18:49:22 -0600

Seen: 380 times

Last updated: Feb 26 '15