Description
The neural network in machine learning facilitates automation in 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 that don’t have covered faces by sunglasses or by any other means. The complete pipeline is like this:

The features are extracted by Local binary feature extraction. MATLAB has a toolbox for that.
files=dir('./FGNET/images'); for ii=3:size(files,1) imgname=files(ii).name; img=imread(['./FGNET/images/',imgname]); if size(img,3)==3 img=rgb2gray(img); end features(ii,:) = extractLBPFeatures(img); end
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.

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) samplediff(ii)=maximumSamples-classNo(ii); N (ii) = ceil(samplediff(ii)/ 100); end
The samples distribution in each class after the SMOTE algorithm is shown in the figure.

We recommend users to read the SMOTE in detail here.
Need Help With This Code?
Work with a PhD research mentor to adapt this code to your data, extend it for your thesis, or turn the results into a publishable paper.
- Step 1 Post your project Title, subject, budget, deadline and keywords.
- Step 2 Brief is reviewed Spam checks, then a project manager approves the scope.
- Step 3 Doctorates apply PhD researchers who fit your topic show interest.
- Step 4 Choose on evidence Compare their SCIE/Scopus papers, citations and Google Scholar.
- Step 5 Chat and assign Talk in secure chat, then fund the milestone in escrow.
- Step 6 Work securely Work in our editor; confidential files stay view-only.
- Step 7 Approve and release Pay only when you approve each milestone.
Dr. Abhishek Gupta
ScholarsColab.com is an innovative and first of its kind platform created by Vidhilekha Soft Solutions Pvt Ltd, a Startup recognized by the Department For Promotion Of Industry And Internal Trade, Ministry of Commerce and Industry, Government of India recognised innovative research startup.







garba.abdulrauf (verified owner) –
Thank you
neha.baruah (verified owner) –
good
morteza (verified owner) –
good
john.doe (verified owner) –
Easy
aaaaa.aaaaaa (verified owner) –
nice
chandra.jonala (verified owner) –
Thank you
chandra.jonala (verified owner) –
Thank you
Anonymous –
LETS CHECK THE SERVICES PROVIDED BY YOU
Anonymous –
it helped me to kickstart
admin (verified owner) –
Thanks