Ask Your Question

Baschdi's profile - activity

2016-08-11 17:03:30 -0500 received badge  Editor (source)
2016-08-11 17:02:44 -0500 answered a question i am using open cv 2.4.8 with visual studio 2012 as i compile the code it gave a linker error 1181 even though i had added dependencies libraries.. it always say unable to open : opencv_calib3d248d.lib

The linker needs the library path in order to link the library to the binaries. Make sure again the both Properties:

Project Properties > Linker > General > Additional Library Directories Project Properties > Linker > Input > Additional Dependencies

are set correctly.

Also take care to add the ".lib" - files, not the ".dll" ones. Watch out for the correct ending: *248d.lib of the files as 248d stands for OpenCV 2.4.8 - Debug.

If this does not work, try adding the location where your library is located to your PATH. If nothing works, make sure opencv_calib3d248d.lib even exists.

2016-08-10 08:33:22 -0500 received badge  Nice Answer (source)
2016-08-09 05:39:34 -0500 received badge  Teacher (source)
2016-08-09 03:36:07 -0500 received badge  Self-Learner (source)
2016-08-09 03:18:04 -0500 answered a question Is there a way to import a RapidMiner MLP-ANN in OpenCV?

After some time playing around with weights, positions and scales I came to the conclusion that it is generally not possible to use the same weights.

The reason for this is in my opinion the inability to handle categorical data as is (Look at the Official Documentation for details). The whole structure of the weights and scales becomes somehow incomprehensible for me.

I had to retrain the network directly with OpenCV. This is sad, because I am not able to use the great crossvalidation-feature from RapidMiner to validate the classification. Furthermore the algorithms for training seem to work quite different, so I get a different network.

If someone has a solution for importing the weights to OpenCV in the future, please let me know.

2016-08-04 08:19:07 -0500 received badge  Critic (source)
2016-08-04 05:38:15 -0500 received badge  Supporter (source)
2016-08-04 03:06:20 -0500 commented question Is there a way to import a RapidMiner MLP-ANN in OpenCV?

I've got the Dataset to train as an Excel-File. I'm used to RapidMiner and I like it's cross-validation functionality. After the training I wondered how to implement the model in my specific application just for prediction. As I already use OpenCV I came across its ML tools. Training again would take some time again to implement and train. So I just wondered why not simply import the weights when they are already calculated. If it's not possible, I surely have to train directly in OpenCV again as I can't see other possibilities. But importing an existing weight matrix would be a nice-to-have feature ;)

2016-08-04 02:56:11 -0500 asked a question Is there a way to import a RapidMiner MLP-ANN in OpenCV?

I trained and validated a MLP Model in RapidMiner Studio. My Input Values are already normalized to [-1, 1]. As far as I understood, the MLP is already defined by its weights. As you can see here, the ANN has one Hidden Layer: http://i.stack.imgur.com/qhVP0.png

Now I'm trying to import this in OpenCV, as I don't want to retrain the whole model. I got all weights per Node + Bias from RapidMiner.

OpenCV offers the function CvANN_MLP::load(), where I am able to load a XML or YML file. I tried to modify an existing YML config for my needs. As you can see, I already defined the dimensions of the layers/data.

I have 23 Inputs, 15 Hidden Nodes and 5 Outputs. So i got (23 + 1) * 15 = 360 weights for the Hidden-Layer and (15 + 1) * 5 = 80 weights for the Output-Layer.

My main questions are:

  • Is this even possible?
  • What is the correct order for the values?
  • Where are the Bias-Values located?
  • What exactly does the output-scaling do?
  • How to determine the predicted label from the Response Matrix in OpenCV? (Is it the Index of the largest Value?)

I already tried to import the modified file and the program compiled as well. It computes something, but I don't think / am not really sure it worked.

Here is my YML File:

%YAML:1.0
mlp: !!opencv-ml-ann-mlp
   layer_sizes: !!opencv-matrix
      rows: 1
      cols: 3
      dt: i
      data: [ 23, 15, 5 ]
   activation_function: SIGMOID_SYM
   f_param1: 0.6666666666666666
   f_param2: 1.7159000000000000
   min_val: -0.9500000000000000
   max_val: 0.9500000000000000
   min_val1: -0.9800000000000000
   max_val1: 0.9800000000000000
   training_params:
      train_method: RPROP
      dw0: 0.1000000000000000
      dw_plus: 1.2000000000000000
      dw_minus: 0.5000000000000000
      dw_min: 1.1920928955078125e-07
      dw_max: 50.
      term_criteria: { epsilon:9.9999997764825821e-03, iterations:1000 }
   input_scale: [ 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1 ]
   output_scale: [ 1, -1, 1, -1, 1, -1, 1, -1, 1, -1 ]
   inv_output_scale: [ 1, -1, 1, -1, 1, -1, 1, -1, 1, -1 ]
   weights:
      - [ 10.063, 8.812, 3.996, 19.716, -10.239, 2.720, -21.349, 16.635, 0.797, -0.906, -3.003, -5.882, -2.595, -0.957, -4.255, -2.008, 2.978, 17.362, 2.246, 9.740, 0.491, 3.492, 23.299, 10.214,
          31.730, -23.089, 0.369, -72.193, 2.193, -9.687, 4.192, -26.858, 2.780, 5.791, 0.348, -3.331, 2.822, -15.520, -9.149, -16.861, -10.512, -17.079, -14.414, -14.371, -0.278, 10.420, -3.733, -1.921,
          -0.198, 50.929, 0.355, 3.136, 4.892, 0.496, -10.206, -2.844, 0.606, 1.570, -3.054, 6.012, 1.654, -2.043, -2.194, -3.776, -4.745, -6.988, -4.795, -0.397, -2.280, -7.741, -12 ...
(more)