OpenCV(3.4.1) Error: Bad argument (Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file.
) in CvCascadeImageReader::PosReader::get, file
解决办法,减少正样本数目
opencv_traincascade.exe -data data_2 -vec positives.vec -bg bg.txt -numPos 350 -numNeg 1963 -mem 8192 -numStages 20 -w 20 -h 20
这里将numPos值改小即可
OpenCV(3.4.1) Error: Insufficient memory (Failed to allocate 782736980 bytes) in cv::OutOfMemoryError, file C:\application\opencv\opencv\sources\modules\core\src\alloc.cpp, line 55
解决办法,增大内存
这里将-mem值改大 numPos值改小即可
总结:这两个错误主要在于每级训练正样本数目的值过大,numPos一定要小于正样本的总数,修改mem值只是提高运行速度