Haar Cascade training outOfMemory error.. help!!

asked 2015-11-02 11:06:46 -0500

Papercut gravatar image


I need to find patterns in manually set ROI. The patterns are not complicated so I decided to use Haar Cascade Pattern Detection. In order to do that, I needed to train my samples first using "opencv_traincascade.exe" so I grabbed 38 positive images and a few negative images. For the positive images, I tried two different sizes, 100 x 64 and 50 x 32, to train.

But everytime I try run my opencv_traincascade.exe, it returns with outOfMemory error: "OpenCV Error: Insufficient memory error (failed to allocate 3.8GB) in cv::OutOfMemoryError, file: c:\builds\2_4_PackSlace-win32-vc12-shared\opencv\modules\core\src\alloc.cpp line 52"

When I tried two difference positive sample sizes, the memory size in the error message was exactly same so I don't think it's sample size.

The command I entered in my cmd was: opencv_traincascade -vec positive.txt -bg negative.txt -data output -featureType LBP

Why does this happen and how do I fix it? Please help!!

edit retag flag offensive close merge delete


There are plenty of threads in the forum showing proper use of these tools. The first problem I see if that your positive file is a .txt and not a .vec file. You need to generate the .vec file before trying to train.

LorenaGdL gravatar imageLorenaGdL ( 2015-11-02 11:43:16 -0500 )edit

Thank you!

Papercut gravatar imagePapercut ( 2015-11-02 18:14:32 -0500 )edit