Ask Your Question

zugo's profile - activity

2015-06-23 03:15:22 -0500 received badge  Enthusiast
2015-06-22 10:43:25 -0500 commented question cv::MatEXpr?

cameraMatrixLeft where is defined?

2015-06-21 14:05:57 -0500 received badge  Supporter (source)
2015-06-21 08:22:37 -0500 received badge  Student (source)
2015-06-20 08:16:57 -0500 received badge  Editor (source)
2015-06-18 13:37:50 -0500 asked a question Neural Networks UPDATE_WEIGHTS does not work

Hi, I'm trying to develop a neural network, where my weights are trained on-line, i.e. training algorithms should be called more times, and each time the net should keep learning starting from the current weights. So I added UPDATE_WEIGHTS flag, but when I use it, prediction and other methods return 0 or nan values. Is there a bug with this flag or am I supposed to do something different? Here the code I used:

    Mat classificationResult(1, 100, CV_32F);
    Mat training_set = Mat::zeros(100,1,CV_8U); //fill it with something at each step in the loop
    Mat test_set = Mat::zeros(100,1,CV_8U); //fill it either
    Mat layers(3,1,CV_32S);
    layers.row(0)  = Scalar(100);
    layers.row(1)  = Scalar(10);
    layers.row(2)  = Scalar(100);

    CvANN_MLP aann(layers,CvANN_MLP::SIGMOID_SYM,1,1); //aann initialization
    CvANN_MLP_TrainParams params( cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 1000, 0.0001), CvANN_MLP_TrainParams::BACKPROP, 0.1, 0.1);
    while(1){   //run it for a while
          int iterations = aann.train(training_set, training_set,Mat(),Mat(),params, CvANN_MLP::UPDATE_WEIGHTS);
    }
   aann.predict(test_set, classificationResult);
   cout << classificationResult << endl;

Since I'd like to create an autoassociator supervision coincides with the pattern features. If, instead, I train my network without using UPDATE_WEIGHTS, I get consistent results.