Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV(3.4.1) Error: Assertion failed (_img.rows * _img.cols == vecSize)

I tried to run opencv_traincascade in cmd, but it crashes instantly and gives that output.

opencv_traincascade -data data -vec pos.vec -bg neg.lst -numPos 31 -numNeg 
100 -numStages 10 -w 20 -h 20 
PARAMETERS:
cascadeDirName: data
vecFileName: pos.vec
bgFileName: neg.lst
numPos: 31
numNeg: 100
numStages: 10
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
acceptanceRatioBreakValue : -1
stageType: BOOST
featureType: HAAR
sampleWidth: 20
sampleHeight: 20
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC
Number of unique features given windowSize [20,20] : 78460

And here is the error message:

 ===== TRAINING 0-stage =====
<BEGIN
OpenCV(3.4.1) Error: Assertion failed (_img.rows * _img.cols == vecSize) in 
CvCascadeImageReader::PosReader::get, file C:\build\master_winpack-build- 
win64- 
 vc15\opencv\apps\traincascade\imagestorage.cpp, line 153

I tried deleting all opencv xml as it was suggested else where, another reason for this problem to occure seams to be, that -w 20 - h 20 doesnt match the size of images.Therefore I doubled checked that, too.

A blind guess that may cause some issues is that the path "C:\build\master_winpack-build-win64-vc15\opencv\apps\traincascade" is correct. The imagesstorage.cpp is located in C:\Users\azach\Downloads\opencv\sources\apps\traincascade