Ask Your Question

ejehardenberg's profile - activity

2015-01-06 08:20:46 -0500 received badge  Nice Answer (source)
2014-10-30 12:02:27 -0500 commented answer CvSVM::EPS_SVR train_auto assertion sv_count != 0 failed

The other thing it could possibly be, is that the subset of training samples within that fold (for the k-fold) has no samples in it. If you look at line 1982 in the modules/ml/src/svm.cpp file you'll see where that comes in. Unfortunately, I'm not entirely sure exactly how the alpha value is calculated (it is done by the solver for the algorithm type from what I understand), but it's more likely the k-fold sample is the problem I think.

2014-10-30 11:10:13 -0500 commented answer Beginner guide for SVM

+1 for the StackOverflow post on images, probably one of the most useful openCv posts I've found on SVM's on StackOverflow

2014-10-30 10:50:03 -0500 answered a question CvSVM::EPS_SVR train_auto assertion sv_count != 0 failed

Using your sample code provided I don't get any issue at all, though I did change the maximum number of iterations down to 1000 so I could run it in a reasonable amount of time.

Looking at the source code near that assertion I spy the following:

if( !train1( sample_count, var_count, samples, svm_type == ONE_CLASS ? 0 : responses->data.i, 0, 0, temp_storage, alpha, df->rho ))
    EXIT;

for( i = 0; i < sample_count; i++ )
    sv_count += fabs(alpha[i]) > 0;

CV_Assert(sv_count != 0);

So you either have 0 samples and the sv_count is never increasing (it is initialized to 0) or every alpha value is equal to 0 (since the use of fabs precludes negative values here)

2014-10-30 10:29:09 -0500 commented question How to use opencv_haartraining to train a haarcascade

yes, I suppose you could look at each script (everything is in a git repository https://github.com/mrnugget/opencv-haar-classifier-training) and convert it to do whatever you need it to do, but that would be a lot of work I think. The perl scripts are just for getting the samples and vector format you need to use the opencv_traincascade. Since you mention opencv_haartraining, I think this tutorial goes really far in depth on that http://note.sonots.com/SciSoftware/haartraining.html and is what the first one I linked to is based on. Either way I think you need to use perl though

2014-10-27 13:40:50 -0500 commented question How to use opencv_haartraining to train a haarcascade

coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html Try out this tutorial? They do a really good job of explaining.

2014-10-08 12:04:17 -0500 commented question Install opencv in Ubuntu 64 bits

posting the errors you got will help people help you.

2014-10-07 14:25:20 -0500 commented question Cascade Training Error

also make sure numNeg is less than the number of negatives as well! I got this error and then got it working again by checking wc -l pos|neg file and making sure the settings were below for each one.

2014-10-01 14:28:27 -0500 answered a question Are there specific times when cv2.waitKey() is required?

I know that it is required if you want to show changes in an image during a loop, or even the loop itself. When you call imshow it doesn't immediately draw itself (in my experience and afaik), it requires a call to waitKey before it attempts to process it's event loops. This is because waitKey is simply waiting for a delay, and during this delay Highgui runs whatever tasks need to be done drawing.

HighGui cannot process windows events like redraw, resizing, input event unless you call waitKey(delay), I found this info out from firsthand experience and from this post http://stackoverflow.com/a/12452139/1808164

As far as when it is recommended, I'd say anytime you need to update display changes to a user you should call it, or if you're waiting for a user to give you some input. Hope this helps.

The documentation here: http://docs.opencv.org/modules/highgui/doc/user_interface.html#imshow should tell you pretty much everything you want to know about why this all is, but to qoute:

This function is the only method in HighGUI that can fetch and handle events, so it needs to be called periodically for normal event processing unless HighGUI is used within an environment that takes care of event processing.

2014-10-01 14:21:34 -0500 commented question Histogram Comparison: Sensitive to Illumination?

Have you considered using a different colorspace? Like YCrCb?

2014-10-01 13:20:48 -0500 commented question Response is not integral

I am getting this error if I save a SVM, then try to load it and keep training on it. Is this not possible?

2014-10-01 10:22:44 -0500 received badge  Enlightened (source)
2014-10-01 10:22:44 -0500 received badge  Good Answer (source)
2014-10-01 09:47:18 -0500 received badge  Nice Answer (source)
2014-09-30 12:54:06 -0500 answered a question How to get a probability for a SVM prediction?

The output of predict will be the label which you have set the class with. For example, if you have set up a binary SVM then you will have likely also set up 2 labels (say -1 and 1). If the SVM decides that the Mat in question is of class -1 then it will return -1.

The sign is dependent entirely on the labels you set, if you don't use a sign then there will be none.

All that said, If you look at the [documentation] then you'll find that there is a second parameter to the predict function:

returnDFVal – Specifies a type of the return value. If true and the problem is 2-class classification then the method returns the decision function value that is signed distance to the margin, else the function returns a class label (classification) or estimated function value (regression).

In simple terms, if you pass true for the second parameter you don't get back your class label, but the distance from the margin, and here the sign matters as it will be the direction away from the hyperplane. But only if you are doing a binary classification!

I'm not sure about your last question about the probability for non-binary problems, but in the case of a binary problem then the distance is your probability (Or can be converted, see the comments below), the farther from the margin the more likely the object belongs to the class on that side of the cutting plane. The negative/positive will tell you which class it is.

The documentation for predict is here: http://docs.opencv.org/modules/ml/doc/support_vector_machines.html#cvsvm-predict

2014-09-25 08:08:27 -0500 received badge  Teacher (source)
2014-09-17 11:40:28 -0500 commented question Best way to integrate mutiple classifiers into a single system

If you have multiple descriptors for items, perhaps you run each of those descriptors on your image, possibly within a ROI created by a sliding window?

To deal with the angles thing, perhaps you can just run each of the classifiers you have for each angle, and have each classifier say yes or no, and if X classifiers say yes then you can say you have that object?

These are just suggestions, so I figured I'd put them in a comment rather than an answer. I don't know anything about convolutional NN or voc. trees sorry.

2014-09-03 11:49:36 -0500 received badge  Supporter (source)
2014-09-02 09:21:55 -0500 received badge  Necromancer (source)
2014-09-02 09:20:47 -0500 received badge  Editor (source)
2014-09-02 09:18:56 -0500 commented question Trying to calculate histogram on Android and find the median. Unsure how to access histogram data from Mat

hist.at<float>(num), is the same as Mat.get I believe. The links in your question are broken otherwise I would try to answer a bit more

2014-09-02 09:16:46 -0500 answered a question *java* api Histogram calculation

I just ran into this problem and solved it. The important things to note are the following areas within the native library:

CV_Assert(nimages > 0 && dims > 0);
CV_Assert(rsz == dims*2 || (rsz == 0 && images.depth(0) == CV_8U));
CV_Assert(csz == 0 || csz == dims);

dims is the number of elements in the histSize vector, rsz is the range vector size, and csz is the channel vector size. Looking at your code we can see that the third assertion fails because the channel size (your channels vector) is of size 3, but the size of your histSize vector is only 1! So what you should do is change

MatOfInt histSize=new MatOfInt(256);

to

MatOfInt histSize=new MatOfInt(256, 256, 256);

now of course you will get an assertion error on the second assertion in the native code above, so you should then notice that your ranges vector must be modified to satisfy the requirement of rsz == dims*2, in other words, specify a range for each bucket like so:

 MatOfFloat ranges=new MatOfFloat(0.0f,255.0f, 0.0f, 255.0f, 0.0f, 255.0f);

Hope this helps

Edit: Also, you should think about using 256.0f instead of 255.0f in your ranges since it is exclusive on the top (it says it somewhere in the documentation but I don't have a link)