File Exchange

image thumbnail

Gender recognition from face images with trainable COSFIRE filters

version (13.4 MB) by Antonio Greco
This MATLAB code allows you to perform gender recognition from face images for a given dataset.


Updated 06 Jun 2018

View License

Gender recognition from face images is an important application in the fields of security, retail advertising and marketing. We propose a novel descriptor based on COSFIRE filters for gender recognition. A COSFIRE filter is trainable, in that its selectivity is determined in an automatic configuration process that analyses a given prototype pattern of interest. We demonstrate the effectiveness of the proposed approach on a new dataset called GENDER-FERET with 474 training and 472 test samples and achieve an accuracy rate of 93.7%. It also outperforms an approach that relies on handcrafted features and an ensemble of classifiers. Furthermore, we perform another experiment by using the images of the Labeled Faces in the Wild (LFW) dataset to train our classifier and the test images of the GENDER-FERET dataset for evaluation. This experiment demonstrates the generalization ability of the proposed approach and it also outperforms two commercial libraries, namely Face++ and Luxand.
Due to the random selection of features, the recognition rate that you will obtain with this script may not be precisely the same as the reported one in the paper. It should, however, be very close. Please read the readme.txt file before running the code.
You are kindly invited to use this Matlab implementation and cite the following articles:
1. George Azzopardi, Antonio Greco, and Mario Vento. "Fusion of domain-specific and trainable features for gender recognition from face images." IEEE Access, 2018.
2. George Azzopardi, Antonio Greco, and Mario Vento. "Gender recognition from face images with trainable COSFIRE filters." Advanced Video and Signal Based Surveillance (AVSS), 2016 13th IEEE International Conference on. (pp. 235-241) IEEE, 2016.
3. George Azzopardi and Nicolai Petkov, "Trainable COSFIRE filters for keypoint detection and pattern recognition", IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 35(2), pp. 490-503, 2013.

Comments and Ratings (15)

Mohd Zamri

Dear M.Muhajid,
the module Gender_recognition/testCOSFIREPyramidModel can help you for this purpose.

[pl,~,svmscore] = svmpredict(data.testing.labels',testingKernel,model);
result = classperf(data.testing.labels,pl);

As we did for the structure result, you may save pl, which gives you information about the decisions taken by the classifier. Using such information, you can perform reverse engineering to understand which are the images wrongly classified.


Hi MR @Antonio Greco
Your code works perfectly.As the code gives overall result in accuracy percentage, how should i know from the result variables that which of the test images belongs to which class???Reply ASAP

alice rules

alice rules

Hi guys, i've already try the codes.. it works and Mr. Antonio assisted me with the code too. Thank you.

Rere yuni

Dear Syahdan Edy Murad,
you have less than 180 images in your training set.
So you have two possibilities:
1) Increase the number of samples in the training set
2) Start the program with Gender_recognition_with_COSFIRE(X, 'COSFIRE', 1, NaN), where X is less than the number of samples in the training set


Otherwise, I got another error. Could you please help me?
>> Gender_recognition_with_COSFIRE(180, 'COSFIRE', 1, NaN)
Configuring COSFIRE filters from Male face images
Error using randperm
K must be less than or equal to N.

Error in configureCOSFIREfilters (line 14)
permlist = randperm(size(imageset,3),noperators);

Error in getCOSFIREoperators (line 7)
operatormalelist = configureCOSFIREfilters(,noperators,1);

Error in Gender_recognition_with_COSFIRE (line 89)
operatorlist = getCOSFIREoperators(outdir,dataset,noperatorspergender);

Thanks for the code.Can you please help me in running this?

Antonio Greco

Hi Wafa! Thank you for your interest. My e-mail is on the paper: .

wafa khan

Hi Antonio Greco ,
Thanks for publishing such matlab code it's very useful
I found difficulties to run this
can u help me, please?
How can I contact you ?
best wishes ^_^

wafa khan

Hi Akhil,
considering your e-mail, I guess that you solved the problems with the compilation of libsvm. Please contact me if you need more help. Regards!

Hi Antonio Greco,
Thanks for providing matlab code. I read readme file,
I selected Application folder and executed "setup;"
But I am facing few issues as follows

Error ..\svm.cpp: 15 syntax error; found `<' expecting `;'
Error ..\svm.cpp: 18 too many errors

<matlab_folder>\BIN\MEX.PL: Error: Compile of '..\svm.cpp' failed.
Error:<matlab_folder>\toolbox\matlab\general\mex.m failed (line 221)
Unable to complete successfully.

Could you please help me out, How to solve this issue.?


Links updated

Links updated

References updated

Updated paper reference

Code documentation improved

Description updated

Description updated

Description updated

Description updated

Description updated

Description updated

MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor