Ask Your Question

about traincascade negative set creation

asked 2012-11-11 08:44:16 -0600

marcoromagnoli gravatar image


I'm training a classifier with opencv_traincascade.exe for a VideoSurveillance AirCam positioned in a fix place outside one office. I created about 1000 positive samples. Reading many tutorials I find out that the number of negatives should be more than the positive, BUT I doubt it in this case as the camera is fixed in a still place and the background is always the same. So my concerns is to create a dataset of negative images that is only about one hundred images, cropping different details of the same, and never changing background. Is it correct? Can anybody give me any hits. A suggestion will be welcome, and helpful. Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-11-12 02:51:34 -0600

When you train a detector there is usually no problem to get a large number of negative examples. Even in case when the camera is fixed I would highly recommend to use a large number of negative examples. It is true that some part of the background will be always the same (or similar, dependent on illumination) but soms of the background will vary and you don't know how in advance. For example if you were to detect heads from top view, heads will be positive examples, but shoulders and legs will be negative examples. Detector shouldn't fire on those as well. When you have large negative set it will lead to lower false positive rate.

edit flag offensive delete link more


Hi Ekalic: ThankYou for Your answer. Now I have a different problem with traincascade, because the program is exiting with error: OpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file. Here: Maria Dimashova She is giving the formula : vec-file has to contain >= (numPose + (numStages-1) * (1 - minHitRate) * numPose) + S, where S is a count of samples from vec-file . First I would like to know where to find this formula, in which document . Second She is writing :Bug "It was fixed in r8913", What daes it mean r8913? Is it Opencv actual version 2.4.3 ? Thank You.

marcoromagnoli gravatar imagemarcoromagnoli ( 2012-11-20 08:27:33 -0600 )edit

Question Tools

1 follower


Asked: 2012-11-11 08:44:16 -0600

Seen: 726 times

Last updated: Nov 12 '12