Create a layer for artificial neural network of openCV2
According to this blog, it create the labels as this way
cv::Mat layers = cv::Mat(4, 1, CV_32SC1); //create 4 layers
layers.row(0) = cv::Scalar(2); //input layer accepts x and y
layers.row(1) = cv::Scalar(10);//hidden layer
layers.row(2) = cv::Scalar(15);//hidden layer
layers.row(3) = cv::Scalar(1); //output layer returns 1 or -1
But in the book, it create the layers as following
Mat layers(1,3,CV_32SC1);
layers.at<int>(0)= TrainData.cols;
layers.at<int>(1)= nlayers;
layers.at<int>(2)= numCharacters;
1 : The blog use rows to save the parameters but the book use cols to save the parameters.Are they the same thing?Do I have to change the way of writing, reading the xml according to the way of saving the parameters(any issues I do not mention have to take care)?
2 : What is the order of the layers?As I guess(uncertain)
- The feature numbers of each sample
- number of layers
- ~ Last(assume 4 == last in this case) - 1
- Classes(The kinds of data want to classify. ex : '0', '1', ..., '9')