Ask Your Question
0

opencv_createsamples doesn't create samples

asked 2017-02-01 17:50:37 -0600

Davaaron gravatar image

Hi,

i'm pretty new to openCV and I need it for an university project. As I couldn't found any proper classifier that is capable of detecting side-way faces, I wanted to create my own classifier. What I've already done:

  1. Loaded positive images from a database containg faces and negative images not containing faces
  2. Put all images from positives to positves.txt like find ./positive_images -iname "*.jpg" -or -iname "*.gif" > positives.txt (same way for negatives)
  3. Fired perl bin/createsamples.pl positives.txt negatives.txt samples 1500\ "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1\ -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40"

And thats the problem. No samples are generated. I've read several tutorials but it seems like I don't get it.

Do I need to get a info file? Do I need to draw rectangles around the objects in my positive images? I have like 1500 positive and 800 negative images.

The thing is that the script runs without any error but not even a single sample file is created. What do I miss? I couldn't find any answer out there.. hope anyone of you can help me!

Thanks in advance.

Info: I'm on Linux Mint 18. The output is similar to:

/positive_samples/93-13.jpg -bg tmp -vec -num/positive_samples/93-13.jpg.vec -num 0
Info file name: (NULL)
Img file name: ./positive_samples/93-13.jpg
Vec file name: -num/positive_samples/93-13.jpg.vec
BG  file name: tmp
Num: 0
BG color: 0
BG threshold: 0
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: 80
Height: 40
Max Scale: -1
Create training samples from single image applying distortions...
Done

The field 'Num: 0' is a needle in my eye, as Info file name: (NULL). Could this occur the problem that no samples are generated? What about the script 'createtrainsamples.pl' you can find at github? I mean I want to generate samples for the training. Am I actually using the right script?

I'm desperate..

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2017-02-02 01:44:01 -0600

berak gravatar image

updated 2017-02-02 01:56:46 -0600

As I couldn't found any proper classifier that is capable of detecting side-way faces,

please have a look at this (the general problem with profile views is, that you can train it only for one side, and you have to flip() the image, and try a detection for both sides later)

then, the whole idea of "synthesizing" multiple positive images from one or a few is broken, and won't work.

(your blog/tutorial seems quite wrong and outdated, please use this instead )

so, try:

  • collect as many positive images you can get (any size, but not .gif !)
  • run the annotation tool on the folder with the positives, mark your faces there, to produce an info file (containing filenames & list of found rectangles)
  • then, pass the info file to opencv_createsamples like: opencv_createsamples -vec faces.vec -info info.txt -w 24 -h 24
edit flag offensive delete link more

Comments

1

I did annotate around 3k images and stored them in file.txt using the specified tool. Running createsamples results now in an error:

Unable to open image: C:\...\Pictures\positive\9336923.1.jpg
OpenCV Error: Unknown error code -9 () in cvSetImageROI, file C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\array.cpp, line 3021

I opened another issue for that: link text

Davaaron gravatar imageDavaaron ( 2017-03-11 08:50:02 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-02-01 17:46:22 -0600

Seen: 4,220 times

Last updated: Feb 02 '17