1

I try to use opencv_traincascade.exe but it crashes few seconds after I launch it. Here is how I proceeded:

I first create the positive sample using:

opencv_createsamples -info info.txt -vec vecFile.vec -bg neg.txt -num 100 -w 100 -h 100
  • info.txt has 116 lines which are all like:

    imagepath 1 0 0 100 100

    just the name of the file change in the different lines but all the images are of size 100*100 (I am working on high resolution picture on stem cells, therefore in a 25*25 image, I think I would not have enough information to detect what I am looking for)

  • neg.txt contains 715 lines with just file paths

which successfully created 100 samples

and then I launch the training with:

opencv_traincascade -data Cascade -vec vecFile.vec -bg neg.txt -numPos 10 -numNeg 20 -numStages 2 -featureType HAAR -w 100 -h 100

And then I got the following error message:

opencv_traincascade.exe has stopped working

And nothing else.

Any idea what is going on ?

Thanks

azerty
  • 698
  • 7
  • 28

1 Answers1

3

This is happening because of the window size you chose. The memory traincascade.exe uses for training a classifier grows exponentially with window size, and there are few home computers that would handle a 100x100 window size in traincascade..

Do this exercise: open your task manager and monitorize the memory usage growing when you start training, you'll notice that the program crashes when it can't allocate more memory. To fix this you'll really have to choose a smaller window size.

Pedro Batista
  • 1,100
  • 1
  • 13
  • 25
  • I just monitorized as you suggested, but it does not use all the RAM of my PC, or maybe it goes on so fast I can not even see it ... I will try with smaller windows to see – azerty Jan 30 '14 at 11:26
  • You can use the arguments -precalcValBufSize 1024 and -precalcIdxBufSize 1024. The numbers can be increased, if you like, but you need to put a value below your RAM capacity. – cyberdecker Jan 30 '14 at 17:50