Image-CCV

 view release on metacpan or  search on metacpan

ccv-src/doc/bbf.md  view on Meta::CPAN

and it reports:

	real	0m27.977s user	  0m27.860s sys     0m0.050s

You see the difference.

Accuracy-wise:

I wrote a little script called bbfvldr.rb that can check the output of bbfdetect against ground
truth, before run the script, you need to do some house-cleaning work on the result.txt:

Basically, the result.txt file will contain the full path to the file, for which, we only need
the filename, use your favorite editor to remove the directory information, for me, it is:

	sed -i "s/\.\.\/test\/faces\///g" result.txt

Suppose you have copied the ground truth to truth.txt file, run the validator:

	./bbfvldr.rb truth.txt result.txt

My result for bbfdetect is:

	82.97% (12)

The former one is detection rate (how many faces are detected), the later one is the number of
false alarms (how many non-face regions are detected as faces)

The result for OpenCV default face detector is:

	86.69% (15)

Well, we are a little behind, but you can train the detector yourself, just get a better
data source!

How to train my own detector?
-----------------------------

In this chapter, I will go over how I trained the face detector myself. To be honest, I lost
my face detector training data several years ago. Just like everyone else, I have to download
it somewhere. In the end, I settled with LFW (http://vis-www.cs.umass.edu/lfw/). Technically,
it is the dataset for face recognition, so there are less variations. But that's the largest
dataset I can find to download. I downloaded the aligned data, cropped with random rotation,
translation and scale variations, got 13125 faces in 24x24 size.

The bbfcreate also requires negative images, just so happened, I have about 8000 natural scene
images that contains no faces downloaded from Flickr. OK, now I have all the data, what's next?

First, you need to create a directory called data/ under the same directory of bbfcreate. Then,
you need to create two filelists of positive data and negative images, for me, it is:

	find ../data/faces/*.bmp > faces.dat find ../data/negs/*.jpg > negs.dat

That's all! Just find a computer powerful enough and run the following line for several days:

	./bbfcreate --positive-list faces.dat --background-list negs.dat --negative-count 26250 --working-dir data

The --negative-count parameter denotes how many negative samples extracted for each round,
experimentally, it is something about twice of the number of your positive ones.

If you configure the makefile well, bbfcreate will use OpenMP to speed up, which will eat up
all the CPUs. My own training process ran about one week, it is a extremely powerful desktop PC,
you should expect weeks for the result on modest PC with so many samples.

You can stop bbfcreate at any time you want, the most recent result will be saved in data/
directory, clean up the directory to restart.

I probably will implement MPI support in near future so that you can run this with many computers
in parallel, but who nowadays have OpenMPI setup besides supercomputing centers?



( run in 1.663 second using v1.01-cache-2.11-cpan-d8267643d1d )