How to initialize neural network?
Hello everyone. I have question; how to initalize Neural Network? I implemented Neural Network in MATLAB, and now I want to do same in OpenCV. Basically, I have training data as Mat (size 110 x 2), and my train classes have size (110 x 1). Here is code I am trying to compile, but it throws exception ( something about number of rows and columns).
Mat_<int> layers(4,1,CV_16U);
layers(0) = 2; // input
layers(1) = 100; // hidden
layers(2) = 100; // hidden
layers(3) = 1; // output, 1 pin per class.
ann->setLayerSizes(layers);
ann->setActivationFunction(ml::ANN_MLP::SIGMOID_SYM,0,0);
ann->setTermCriteria(TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS, 300, 0.0001));
ann->setTrainMethod(ml::ANN_MLP::BACKPROP, 0.0001);
ann>train(trainData, ml::ROW_SAMPLE, trainClass);
I also tried other options for number of layers (I use 110 for layers(0), etc.) but it failed.
Something ? may be it could help.
layers(3) = 1; means you have got only one class.
train classes must be a mat with CV32FC1 type
Adding the actual errors could help us ...