memory consumption while training > 50GB
I try to train opencv to recognize a licenseplate. I have prepared some samples (few thousands), prepared vec file successfully and run opencv_traincascade (parameters below). After few minustes i had to stop the process due to the memory consumption that hit 16GB of my RAM and more than 50BG of (dynamic) swap. I have tried to run it with fewer examples, lowered the resolution of negative images. I last try runs were as below but without success (the same memory consumption).
opencv_createsamples -vec positive.vec -bg negative/IMG_5596.JPG -num 200 -maxxangle 0.4 -maxyangle 0.4 -maxzangle 0.2 -w 533 -h 117 -info info.dat
opencv_traincascade -data result -vec info.dat -numStages 200 -w 533 -h 117 -bg bg.txt
(If needed i can provide all files i use to train opencv). Neither precalcValBufSize nor precalcIdxBufSize did't help.
I use OpenCV 2.4.5, build it myself from sources, MBP 2013, OSX 10.8.4
All suggestions what I may be doing wrong or how to train opencv appreciated. Thanks in advance.
i'm no expert on this, but -w 533 -h 117 seems quite a lot. e,g haarcascade_frontalface_alt.xml uses <size>20 20</size>
also, you're planning to train for 200 stages ? the universe will collapse, before that's ready ;)
200 stages is a lot and in fact that was not my first attempt. I'v just tried to change parameters to get an idea which leads to such extraordinary memory consumption... I also experiment as this is my first attempt to use OpenCV and image recognition library :)
I thought about changing the samples size but i found no hint about relationship of memory and size. I'll give it a try.
Thanks for the response.
honestly, finding good params for this is hard, you're not the first to struggle with it, and you won't be the last ..
When it works (at least for the training part) it will be nice to explore many variants.
You were right about the size, using samples 226x61 made swapfiles grow only to 10GB which is acceptable... It's a pity that it is not clearly mentioned in the manual (the difference is incredible) however...
===== TRAINING 0-stage ===== <BEGIN OpenCV Error: Assertion failed (_img.rows * _img.cols == vecSize) in get, file /Users/abankowski/Downloads/opencv-2.4.5/apps/traincascade/imagestorage.cpp, line 154 libc++abi.dylib: terminate called throwing an exception Abort trap: 6
As this is different issue let's assume that the first problem is solved. ;)