Age Detection by NN trained LBP features

(1 customer review)


Total downloads: 157

This Repository is designed to detect the age from an image using LBP features. The Neural network is used as a classifier for it.  FGNET database is used which has 1002 sample images of different objects at different ages. The number of samples in each class is highly non -uniform. So the data is oversampled first and then trained.

This Repository contains the MATLAB code:

  • age detection using neural network
Download Code


The neural network facilitates automation image processing facilities which is either number plate recognition, face detection, expression recognition, joining images at different exposures etc. It also eases the task to recognize and verify the ages from the images which help in passports and other related applications. This MATLAB code for age detection from images contributes towards that fact. We developed this code at free-thesis. We used FGNET aging dataset for the features generation and testing. Though testing also worked on other images which don’t have covered faces by sunglasses or by any other means. The complete pipeline is like this:

Age detection by Neural Network
Age detection by Neural Network [free-thesis]
The features are extracted by Local binary feature extraction. MATLAB has a toolbox for that.

for ii=3:size(files,1)
    if size(img,3)==3
    features(ii,:) = extractLBPFeatures(img);

After extracting features we had a matrix of dimension 1002*20 where each row represents every image in the database. The interesting step in the whole pipeline is the features pre-processing. The whole database is divided into eight different age groups, which makes this data highly imbalanced as shown in figure 2.

Dataset distribution in each age group class
Dataset distribution in each age group class[free-thesis]
We had the highest number of samples in class 1 and non-competitive very few numbers of samples in other classes. Training the neural network using this dataset would be highly biased and the same class would be predicted with every different test image. To avoid this, this data is made balanced with the help of SMOTE algorithm. This was developed for binary classes. In it, the classes with less number of samples are oversampled to balance the distribution and we tweaked this algorithm to make it suitable for multiclass data.

The difference in the number of samples from the major class is used to balance for every class. The code snippet for this is as

%add on samples will be calculated by taking the difference of each
%classSamples with highest number of class samples

[maximumSamples,sampleClass]=max(classNo); % number of maximum samples
for ii=1:numel(class)
    N (ii) = ceil(samplediff(ii)/ 100);

The samples distribution in each class after the SMOTE algorithm is shown in the figure.

Balanced data distribution after SMOTE
Balanced data distribution after SMOTE [free-thesis]
We recommend users to read the SMOTE in detail here.


1 review for Age Detection by NN trained LBP features

  1. admin (verified owner)


Only logged in customers who have purchased this product may leave a review.