OpenCV traincascade fails: Insufficient memory
Hi,
I'm trying to use the traincascade app to create my own data, but it keeps giving me insufficient memory even though I have enough free memory.
OpenCV Error: Insufficient memory (Failed to allocate 536871664 bytes) in unknown function, file D:\Dev\opencv\modules\core\src\alloc.cpp, line 52
My samples file has 1000 positive samples of size 50x50. I tried with 500 also, it didn't work. Only with 100 worked but I'm afraid that isn't enough.
Actually, can you specify your full command. It takes standard only 256 MB of memory for calculation. Have your tried increasing that parameter to for example 2047 MB?
This is the command I'm using:
opencv_traincascaded -data ./trained5/ -vec samples.vec -bg neg.txt -numPos 300 -numNeg 7 -w 50 -h 50 -numStages 5
I tried using
precalcValBufSize
andprecalcIdxBufSize
to increase the buffer size to 2048 but it gives me the same error..Two more questions: what is the size of your negatives and how much free memory do you have? I personally met with this kind of problem and the solution was that I had to close some of my applications (in spite of my 4 GB total memory).
Ps.: Sometimes the traincascade can consume at least 1 GB.
I have cascade training processes grabbing up to 3GB of memory, so it is surely not even limited to 1GB. However the amount of training samples are sufficiently larger in that case...