OpenCV several objects CvANN_MLP
I am writing an application for ANPR. Is part of the neural network training: https://github.com/sploid/plate_recognition/blob/recog_sym_by_nn/train_neural_network/main.cpp
- line 246 : training chars
- line 247 : training numbers
If I interchange the line, I get different results. I do not have static variables and all variables are created on the stack. Why am I getting these strange results?
what is your 'strange result' ?
In code: FileStorage fs( path_to_save_train( module_path, num ), cv::FileStorage::WRITE ); mlp.write( *fs, "mlp" ); I save network state in file, and the result of training is different.
you expect us to debug your github repo ?
I expect to hear something that is not in the documentation. Something like this answer: http://answers.opencv.org/question/25965/opencv-neural-networks/
I made a very simple example:
weights in t1.yml t2.yml are different!!!! Why?
I found the reason. same post: https://code.ros.org/trac/opencv/ticket/1411 Reason difference in random generator.
the rng used is the global cv::theRNG()
you could try to seed it to the same val in each run
I harcode everywhere:
theRNG().state = 0x111111; CvANN_MLP mlp( ... ); mlp.train( input, output, weights );
and OK.