OpenCV haartraining - Out of memory

8

I have 30 positive images and 60 negative images. When I tried to run haartraining with 4GB of memory and Quadcore processor, I get this error message:

OpenCV ERROR: Insufficient memory (Out of memory)
  in function cvAlloc, cxalloc.cpp(111)
Terminating the application...
  called from cvUnregisterType, cxpersistence.cpp(4933)

The command I ran was:

./opencv-haartraining -vec vector/myvector.vec -bg negatives.txt -npos 24 -nneg 55 -mem 2048 -mode ALL -w 86 -h 150

The computer at test times was using less than 800 MB of memory, but during the execution of the above command, the memory used goes to more than 3GB and approximately 1GB of swap, all in less than 5 minutes of running the program.

Any suggestions of what can be done to solve this problem?

    
asked by anonymous 20.11.2014 / 12:39

3 answers

5

As per the comments in the question, I was passing many relatively large images (-w 86 -h 150) as a parameter. As the OpenCV engine allocates the images and in-memory samples before writing to the disk, the overflow due to size and quantity occurred.

To solve the problem, reducing the size of the sample images did not further burst the memory of my machine.

    
25.11.2014 / 00:26
0

When haarcascade is used we must specify the same parameters used in createsamples , as -w and -h .

    
05.05.2015 / 21:12
0

Hello, are you running via DOS or installing python on Windows? I'm doing the same procedure. In my case there is no error but processing for and error and I can not further decrease the positive images of what they are already understand I have 154 positive of 100 x 55 and 600 negative.

    
13.12.2017 / 01:53