program will stuck when using detectMultiScale
I trained a cascade classifier to detect cars. I have 415 positive samples and 544 negative samples. After I trained the classifier, I got cascade.xml. When I use it in my program, the program will stuck when execute detectMultiScale function. But if I used trained classifier by others, there is no problem. I compare the xml file, there are some difference. I don't know whether the problem is caused by the version of xml file.
Dose any one have some idea?
Some comments
Once we have this data, we may be able to debug this issue.
I use OPenCV 3.1.The test image is not very large. When I change the xml file, for example https://github.com/andrewssobral/vehicle_detection_haarcascades/blob/master/cars.xml, my program works well. The format of this file is different with the one trained by myself. I don't know whether the problem is related to the format of xml file.
You did not even care to answer my questions. That being said, I cannot help you until I have that information.
I'm sorry I misunderstood your words.
I create samples using
opencv_createsamples -info road\road.txt -image road -vec road.vec -num 374 -w 32 -h 32
I train the classifier using
opencv_traincascade -data classifier -vec road.vec -bg list.txt -numStages 10 -numPos 374 -numNeg 560 -w 32 -h 32 -featureType LBP
The test image is https://raw.githubusercontent.com/lqj1990/TestCascade/master/test/test.jpg (image)
I try the sample code facedetect.cpp, it also does not work on my computer with the same problem.
Ok some remarks
-info
and-image
in the create_samples utility. Either stick to a list of images with annotated bounding boxes OR use a single image and apply deformations [bad option anyway, proved not to work decently].-info
When I use haartraining, the trained 5-stage classifier works well but very slow.
In this case, what can I do to improve the detection speed? Do I need to use more positive and negative samples to train the classifier?
However, when I use cascade training (both 2.4.10 and 3.2), the problem still exists. The test image size is 210*115. It's hard to judge whether it is too slow or stuck.
In this case, what can I do? Do I need to do more experiment or provide more information?
If I use the xml file in old format, the classifier trained by myself will generate a huge number of candidate. I suspect it is probably caused by some wrong settings in training process. But I don't know what should I do. I trained the classifier using 673 positive samples and 1044 negative samples.The setting is
opencv_haartraining.exe -data data -vec cars.vec -bg list.txt -npos 605 -nneg 1044 -nstages 11 -w 20 -h 20
. Detection code iscascade.detectMultiScale(frame_gray, cars, 1.01, 3, 0, Size(30,30));
When using xml file in new format, the problem is caused by
Mat(1, (int)(v.size()*sizeof(v[0])), CV_8U, (void*)&v[0]).copyTo(um);
in functioncopyVectorToUMat
in cascadedetect.cpp. It does not return a result, so the program stuck. I don't know why.