Ask Your Question
0

openCV 2.4.9.1 sample creation works but gives error message

asked 2016-12-16 05:29:27 -0600

cvDede gravatar image

updated 2016-12-17 01:45:28 -0600

berak gravatar image

Hi everybody,

I am currently working on training my own haar classifier. So here is my problem, As I start the creation of the .vec-File, opencv_createssamples prints following error-message:

 oe@sourdell:~/programming/opencv-haar-classifier-training$ opencv_createsamples  -info resPos.dat -vec /home/oe/programming/opencv-haar-classifier-training/samples/resizedSamples.vec -bg negatives.txt  -w 196 -h 196
Info file name: resPos.dat
Img file name: (NULL)
Vec file name: /home/oe/programming/opencv-haar-classifier-training/samples/resizedSamples.vec
BG  file name: negatives.txt
Num: 1000
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 40
Max x angle: 1.1
Max y angle: 1.1
Max z angle: 0.5
Show samples: FALSE
Width: 196
Height: 196
Create training samples from images collection...
OpenCV Error: Assertion failed (ssize.area() > 0) in resize, file /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/imgproc/src/imgwarp.cpp, line 1834
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/imgproc/src/imgwarp.cpp:1834: error: (-215) ssize.area() > 0 in function resize
Aborted (memory output written)

But when I look in to my samplefolder, I see a .vec-File of about 36MB.

My question is, is the .vec-File corrupted? Because when I want to start the opencv_haartraining process I get a killed message after appr. 5 - 10 minutes. Or could it be the amount of RAM on my laptop(4GB, i5 3rd Gen.; Ubuntu 16.04), when I run it on my win10-desktop(32GB, i7-4790k) it just aborts without an error-message.

Thanks in advance
Olaf

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-12-17 01:48:25 -0600

berak gravatar image

updated 2016-12-17 01:50:22 -0600

-w 196 -h 196 is far too large.

remember, that this will be the minimum size, at which your object can be detected.

training on this will just melt the universe, as you need absurd amounts of ram/cpu, to process it.

please pick something as small as possible here, e.g. face cascades use 24x24

edit flag offensive delete link more

Comments

Good morning/ or day (depending on where you are) berak,

okay. I will scale the positives and give it a try. Another question, that comes to my mind, I worked with a tool (found here: link text) to create my positives. Do I have to mark them all again? Or would scaling to 24x24 be enough?

Berak, could I really melt the universe? Given this knowledge, I would like to try it.

Thanks a lot. I will scale my images and respond a.s.a.p

Olaf

cvDede gravatar imagecvDede ( 2016-12-17 03:13:27 -0600 )edit

moin !

no, you don't have to mark them again (btw, opencv now has a tool for this, too !) , also create_samples will do the scaling on it's own, so no need for you to do so.

you only need to adjust the -w -h params in your cmdline

berak gravatar imageberak ( 2016-12-17 03:18:57 -0600 )edit

moin!

now that I set the params to 24x24. I get the following error message. Error Message I checked the input for curupted images, but they're not. The structure of the input file looks like this Sample Folder

I am, by now, at a point where I don't know what to google anymore. Should I rescale the input images, or could it be that line breaks an spaces in the input file cause the error?

cvDede gravatar imagecvDede ( 2016-12-17 04:34:05 -0600 )edit

mahlzeit !

your resPos.dat needs marked rectangles, too

berak gravatar imageberak ( 2016-12-17 04:59:37 -0600 )edit
1

Update

if I use a single image as input, it works. To me, it looks like there seems to be an error with the input file.

working

cvDede gravatar imagecvDede ( 2016-12-17 05:10:49 -0600 )edit
1

Hey Berak,

I had another resPos.dat with the marked rectangles. I am going to remove the breaks an spaces, because there are now a lot of them in it. Could be caused by switching from ubuntu to win10. I'll keep you updated.

cvDede gravatar imagecvDede ( 2016-12-17 06:03:36 -0600 )edit

Hello again,

as i promised I keep you updated. My new resPos.dat looks like this and I get this error message

When I remove the corresponding line in resPos.dat, createsamples continues to work until the next error appears. So I removed the corresponding line again, the same error comes up. I checked the referenced imagefiles and can't recognize anything that could be wrong.

edit I removed the lines given in the braces and now I get this one again.

cvDede gravatar imagecvDede ( 2016-12-17 10:20:39 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-12-16 04:45:36 -0600

Seen: 2,205 times

Last updated: Dec 17 '16