Error with UPDATE_WEIGHTS and neural networks
Hello,
I get an error when using UPDATE_WEIGHTS in order to adapt the weights of a neural network without reinitializing them. The error states:
OpenCV Error: One of arguments' values is out of range (Some of new output train ing vector components run exceed the original range too much) in CvANN_MLP::calc _output_scale, file ......\src\opencv\modules\ml\src\ann_mlp.cpp, line 638
I am using OpenCV 2.4.2 (before I tried with 2.3.1 and got the same error). My code looks like this:
int flags = CvANN_MLP::NO_INPUT_SCALE | CvANN_MLP::NO_OUTPUT_SCALE;
int numiter = 0;
for(size_t n=0; n<_num_trn_cycles; ++n)
{
if(n>0)
flags = flags | CvANN_MLP::UPDATE_WEIGHTS;
numiter += _mlp.train(trnfeat, trnlabs, Mat(), Mat(), params, flags);
cout << numiter << endl;
}
My feature vectors have been previously normalized to have zero mean and unit standard deviation. The first iteration of the loop executes correctly, but afterwards once the UPDATE_WEIGHTS flag is set, the program stops. Is this a bug in the OpenCV code or should I do something else?
Thanks in advance!
jmr
have you checked neural layer...check the layer size if there may be wrong configuration..