How to apply SVM train for group of pictures after extracting HOG features?

I'm working on project, which about "gender recognition". After reading group of images and extracting HOG features for them, I need to train these pictures and classify them by using SVM classifier. I have wrote a code put it doesn't work (I don't know where is the problem exactly). Please help me to know how to train group of pictures using SVM classifier.
This is my try:
% Perform first run of svm
SVMStruct = svmtrain(Training_Set, train_label);
Group = svmclassify(SVMStruct, Test_Set);

1 Comment

Hello, R u able to classify gender from face images? I would like to do a similar kind of project. Need your help in this.

Sign in to comment.

Answers (2)

It is not possible to determine a person's gender from pictures. Gender is something internal, not something external. There are no known genetic or chromosome tests or x-rays or MRI that can determine gender, no hairstyles, no clothing choices -- only some items that correlate with self-reported gender to better or worse degrees.
Attempting to determine gender from pictures is a mistake very much like trying to determine someone's religion from pictures is a mistake.
Accordingly, it is not possible for your code to work for its stated purpose.

4 Comments

Thank you very much for your answer Mr. Walter Roberson. Indeed there are many ways to predict gender from person pictures by using Matlab. even there are many success researches that predict age and ethnic of any person from his/her face picture.
There are no ways to predict gender from pictures, period. Not in ANY programming language.
I have family members and friends who are gender variant, so I have studied this matter and spoken directly to a variety of transgender and transsexual people. You cannot tell a person's gender by any external examination.
See for example Complete Androgen Insensitivity Syndrome, in which a person is 46,XY (that is, Y chromosome which is usually associated with "male"), but the person's body cannot process testosterone at all, leaving them with a completely female-looking body. They would look female, often considered beautiful. But what is their gender? The answer to that is whatever they identify as. If they identify as female, they are female like their appearance. If they identify as male, they are male like their chromosomes. If they identify as something else, they are that something else.
The only way to determine someone's gender is to ask them.
Everything else is just correlation.
For example long hair is, in North America, more common for females than for males. But hair length for males varies with fashion; during the Hippie days hair was long for example. The Sikh people never cut their hair, including not facial hair, so you can easily find pictures of Sikh women with beards and mustaches. Likewise to the untrained eye, it is easy to confuse a colourful African male robe as being a dress.
You are mostly right Mr. Walter Roberson, but still there are many successful tries in this field. Although there is no any try give us 100% correct answer, some of them reached up to 95% correct prediction. This is one of them ( http://how-old.net/ ). In this site you upload your photo and it shows your age and gender (not always correct but I think it's good try). Thank you again Mr. Walter Roberson :)

A whole bunch of my friends tried how-old.net. The answers were pretty wrong, in both age and gender. For one of my pictures it identified me as 38 and male, and for another of my pictures it identified me as 56 and female. The difference between the two pictures was that I was looking at the camera at a slightly different angle.

Accuracy rates: please cite a source. I would like to examine the claimed rate.

"Computer Vision-Based Gender Detection from Facial Image" http://www.academia.edu/4275201/Computer_Vision-Based_Gender_Detection_from_Facial_Image

Final average accuracy rate: 78.91%. But the accuracy rate for women with short hair and no face or ear ornaments was only 44.16%

Kairos, a gender recognition product (e.g., for marketters), https://www.kairos.com/blog/gender-detection-in-live-video-and-still-images

"The ability for facial detection and recognition software to recognize gender is still in its relatively early days. There are not all that many statistics available yet. One figure that we know is that the Crowd Analytics API can boast a 92% gender accuracy rate."

However, if you read the rest of the blog they are not detecting gender, they are detecting the effects of testosterone, and detecting expression. The source for their 92% figure appears to be internal figures not scientific study.

Sign in to comment.

Hi Abu,
The following example showing how to classify hand-written digits using HOG and SVM would be a good place to start.

Asked:

on 6 Jun 2015

Commented:

on 10 Jun 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!