Ask Your Question

alirezad's profile - activity

2017-04-06 11:48:30 -0500 received badge  Popular Question (source)
2014-07-05 06:55:06 -0500 asked a question how to use CvANN_MLP::get_weights()

hello, how should we use the double array which return by CvANN_MLP::get_weights(). Imagine we have a 3 layer network. layer0: 4 nerouns, layer1: 2 neruon, layer2: 4 nerouns. when i call CvANN_MLP::get_weights(0), I think this should give me the weights between layer0 and layer1, is that right? and something else: weights between two layer should be 2D array. how should I convert this 1D array to 2D one? Thanks in advance.

2014-07-03 10:07:44 -0500 received badge  Student (source)
2014-07-03 08:25:56 -0500 received badge  Editor (source)
2014-07-03 08:24:58 -0500 asked a question Problem traning Auto-Associative Neural network

hi I want to use a feed-forward ANN to make an Auto-Associative neural network. for this purpose I used CvANN_MLP. but the output does'nt make sense?! As you may know, in AAANN the output should be like input (with an small error). but the output of my program is Something weird! my code is as below:

cv::Mat calcFeatureFromMLP(double *inFeature, const int inFeatureSize, const int numOfFeatureToRetain)

{ cv::Mat_<int> layerSize(1,5); layerSize(0) = inFeatureSize; layerSize(1) = inFeatureSize; layerSize(2) = numOfFeatureToRetain; layerSize(3) = inFeatureSize; layerSize(4) = inFeatureSize;

CvANN_MLP ANN(layerSize, CvANN_MLP::SIGMOID_SYM);


cv::Mat trainData(1, inFeatureSize, CV_32FC1, inFeature);
cv::Mat trainClass(1, inFeatureSize, CV_32FC1, inFeature);

CvANN_MLP_TrainParams trainParameter(cvTermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER ,100000, 0.00001), CvANN_MLP_TrainParams::BACKPROP,.9, .7);
ANN.train(trainData, trainClass, cv::Mat(),cv::Mat(),trainParameter);

cv::Mat output;
ANN.predict(trainData, output);

std::cout << output;
return output;

}

for example when I run the following code:

    double input[5] = {.31,.234,.4,.78,.001};
cv::Mat output = calcFeatureFromMLP(input, 5, 2);

the output is as follow:

0.303862;0.230611;3.66626e-314;6.54944e-307;1.13305e-317

but the output that I want is the same as input:

.31;.234;.4;.78;.001

Where I did wrong?!

2012-11-12 11:17:45 -0500 asked a question compiling openCV cpp files in matlab with mex

dear all i want to to compile a cpp file which uses OpenCV library with mex (in matlab) and with gcc compiler. i'm a windows user and already installed minGW in my windows 7 system. the command in linux was :

mex -O FaceDetect.cpp -I/usr/local/include/opencv -L/usr/local/lib -lcxcore -lcv -lcvaux

what is the equivalent command in windows ? thanks in advance.