Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

opencv_traincascade error : _img.rows * _img.cols == vecSize

Hi All,

I'm trying to get a basic version of a cascade classifier working with my own data.

Here's what I've done:

1) Created a few samples (which runs without errors). opencv_createsamples -info C:\Users\anthony\Dropbox\CASEY\training_images\info.txt -vec C:\Users\anthony\Dropbox\CASEY\training2.vec -bg C:\Users\anthony\Dropbox\CASEY\training_images\bg.txt -num 24 -bgcolor 0 -bgthresh 0 -maxxangle 0.3 -maxyangle 0.3 maxzangle 0.5 -maxidev 40 -w 24-h 24

The BG file contains 10 image paths: false/fake_teapot.jpg ... ..

2) When Attempting to train with the following command I get the error shown after: opencv_traincascade -data C:\Users\anthony\Dropbox\CASEY -vec C:\Users\anthony\Dropbox\CASEY\training2.vec -bg C:\Users\anthony\Dropbox\CASEY\training_images\bg.txt -numPos 24 -numNeg 10 -sampleWidth 24 -sampleHeight 24

-- ERROR OpenCV Error: Assertion failed (_img.rows * _img.cols == vecSize) in CvCascadeImageReader::PosReader::get, file ........\opencv\apps\traincascade\imagestorage.cpp, line 157

I'm adjusting the parameters and still getting the same error. I presume this is a check done early on for something I've seriously missed but I really can't figure out what. I have the same number of images, same image widths/height for both positive and negative and for both commands.

Any directions or help as I can see very little on Google and the documentation I've found just lists parameters with descriptions.

Thanks.

click to hide/show revision 2
retagged

updated 2014-08-10 02:09:09 -0600

berak gravatar image

opencv_traincascade error : _img.rows * _img.cols == vecSize

Hi All,

I'm trying to get a basic version of a cascade classifier working with my own data.

Here's what I've done:

1) Created a few samples (which runs without errors). opencv_createsamples -info C:\Users\anthony\Dropbox\CASEY\training_images\info.txt -vec C:\Users\anthony\Dropbox\CASEY\training2.vec -bg C:\Users\anthony\Dropbox\CASEY\training_images\bg.txt -num 24 -bgcolor 0 -bgthresh 0 -maxxangle 0.3 -maxyangle 0.3 maxzangle 0.5 -maxidev 40 -w 24-h 24

The BG file contains 10 image paths: false/fake_teapot.jpg ... ..

2) When Attempting to train with the following command I get the error shown after: opencv_traincascade -data C:\Users\anthony\Dropbox\CASEY -vec C:\Users\anthony\Dropbox\CASEY\training2.vec -bg C:\Users\anthony\Dropbox\CASEY\training_images\bg.txt -numPos 24 -numNeg 10 -sampleWidth 24 -sampleHeight 24

-- ERROR OpenCV Error: Assertion failed (_img.rows * _img.cols == vecSize) in CvCascadeImageReader::PosReader::get, file ........\opencv\apps\traincascade\imagestorage.cpp, line 157

I'm adjusting the parameters and still getting the same error. I presume this is a check done early on for something I've seriously missed but I really can't figure out what. I have the same number of images, same image widths/height for both positive and negative and for both commands.

Any directions or help as I can see very little on Google and the documentation I've found just lists parameters with descriptions.

Thanks.