Ask Your Question
0

Facial detection and Gender Classification

asked 2013-02-27 07:59:48 -0600

Chakan gravatar image

Hi

I am really new to c++ and opencv. I got the facial detection and tracking working over the weekend with the sample code provided in the documentation. I am using the 2.4.4 beta and vs2010.

What I want to do now is add gender classification to the facial tracking program. What I want to know is do I have to take a pic first and then parse it through the facial recognition or can the facial recognition do it straight from the video being streamed in real time?

If so how would I do this and can someone point me at some sample code to go through please.

edit retag flag offensive close merge delete

Comments

While the face detector was up and running in a weekend, for the gender classification you probably need an year of hard work and dedication. There are a few studies and research papers on the subject, but you'll have to implement it yourself based on those. Good luck!

sammy gravatar imagesammy ( 2013-02-27 08:19:50 -0600 )edit

That doesn't fill me with a lot of confidence as I need to have this done by Friday. Can I not take the sample code and tuts which come with opencv 2.4.4 and engineer a solution from there? Combining the 2 samples?

Chakan gravatar imageChakan ( 2013-02-27 08:39:48 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-02-27 09:15:27 -0600

There's a tutorial on Gender classification (with full source code sample) at:

edit flag offensive delete link more

Comments

I saw that, but it's taking a bunch of images and saying whether they are female or male, I want to be able to use the webcam and the face detected in the video stream and be able to say whether or not that face is male or female.

As I said I am very new to all of this, so if I am missing something obvious I apologise.

Chakan gravatar imageChakan ( 2013-02-27 09:22:43 -0600 )edit

You learn the model to classify male and female faces as shown, on a face database of your choice. And with the help of this trained model, you create a prediction on the face you have detected.

Philipp Wagner gravatar imagePhilipp Wagner ( 2013-02-27 09:48:10 -0600 )edit

I'm actually having problem getting this example to work. I thought it was something to do with my input so I ran the scripts to make sure I had consistent images but I get the following error:

OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed) in reshape, file /opt/local/var/macports/build/ _opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_opencv/opencv/work/opencv-2.4.6.1/modules/core/src/matrix.cpp, line 802

libc++abi.dylib: terminate called throwing an exception

mel gravatar imagemel ( 2013-09-16 06:41:32 -0600 )edit

Please open a Bug on issue tracker and I'll look into as soon as I can. Some people have reported this problem, so you are not alone. I guess I have done something wrong somewhere in code.

Philipp Wagner gravatar imagePhilipp Wagner ( 2013-09-16 15:17:35 -0600 )edit
0

answered 2013-02-27 11:52:32 -0600

If your time is limited an approach you could try is example based learning. 1) create image vectors from your positive and negative examples 2) feed them to a support vector machine or ANN to make a basic classifier 3) feed a new example and see if it works

This is however very basic. Like many others said, getting to implement something robust can take you some time. This is a large research topic in academic world, with many papers discussig approaches.

Another approach could be to represent your data in a reduced form by applying PCA, but again, it wont be just copy paste of existig codes.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-27 07:59:48 -0600

Seen: 2,963 times

Last updated: Feb 27 '13