opencv_traincascade.exe = Assertion Failed (s >= 0) Help?

asked 2014-08-19 20:42:34 -0600

Hello,

I'm trying to train my first classifier and running into a bit of an issue that I cannot get past.

As a test I've cropped three images. These images are of myself just standing against the wall.

I've created a bg.txt file of negative images which were downloaded from the internet.

My info file contains one entry (only training on one image just to get a successful train first):

pos2Mark.jpg 1 0 0 284 640

First I run opencv_createsamples.exe to create my .vec file.

Second I run the following command:

opencv_trainingcascade.exe -data output -vec bodies.vec -bg bg.txt -numPos 3 -numNeg 3019 -numStages 1 -w 20 -h 20 -featureType HAAR

When doing so I receive the following error:

C:\BBi\HAAR_Training>opencv_traincascade.exe -data output -vec bodies.vec -bg bg .txt -numPos 1 -numNeg 3019 -numStages 1 -w 20 -h -20 -featureType HAAR OpenCV Error: Assertion failed (s >= 0) in unknown function, file ........\oc v\opencv\modules\core\src\matrix.cpp, line 117

I'm really at a loss at this point. Can anyone give me some helpful tips based on the information I've provided?

I'll be happy to give more information if you just ask. Thank you very much

edit retag flag offensive close merge delete

Comments

Also if I look at matrix.cpp, I see where the assert is likely failing, but I don't necessarily understand why by just looking at the code.

static inline void setSize( Mat& m, int _dims, const int* _sz, const size_t* _steps, bool autoSteps=false ) { CV_Assert( 0 <= _dims && _dims <= CV_MAX_DIM ); if( m.dims != _dims ) { if( m.step.p != m.step.buf ) { fastFree(m.step.p); m.step.p = m.step.buf; m.size.p = &m.rows; } if( _dims > 2 ) { m.step.p = (size_t)fastMalloc(_dimssizeof(m.step.p[0]) + (_dims+1)sizeof(m.size.p[0])); m.size.p = (int)(m.step.p + _dims) + 1; m.size.p[-1] = _dims; } }

m.dims = _dims;
if( !_sz )
troniousCV gravatar imagetroniousCV ( 2014-08-19 21:03:45 -0600 )edit

so this makes no sense. When I change the h and w sizes from 20 to 24 it works.

Can someone explain why that might be?

troniousCV gravatar imagetroniousCV ( 2014-08-19 21:19:52 -0600 )edit
1

Check size of your negatives, they have to be larger than h i w you specified.

la lluvia gravatar imagela lluvia ( 2014-08-20 01:37:31 -0600 )edit