Face recognition using IP, computer vision toolbox, NN toolbox and statistics toolbox
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, I wanted to know how i can make use of IP, computer vision, NN and statistics toolboxes to develop a face recognition system. Can anyone help me with this. I came across few methods for face recognition, but since i've the above mentioned toolboxes, i want to know how to use all of them for my project.
0 Commenti
Risposta accettata
Aruni
il 31 Lug 2014
Modificato: Aruni
il 31 Lug 2014
Hi,
I had implemented face recognition using MATLAB by following the paper http://www4.comp.polyu.edu.hk/~cslzhang/paper/conf/iccv11/CRC_RLS_final.pdf
The ridge() function in Statistics Toolbox can be used for the L2-regularized regression mentioned in the paper. http://www.mathworks.com/help/stats/ridge.html
The other steps in that paper are straightforward matrix manipulations.
For detecting faces , I used the face detector of the Computer Vision System Toolbox. http://www.mathworks.com/help/vision/ref/vision.cascadeobjectdetector-class.html
Representing a face can be done in several ways.
The paper linked above simply vectorized the 2D array of grayvalues. This would not be robust in case of lesser number of samples per person, different posed faces etc.
One alternative is to detect facial landmarks (using the Viola-Jones Cascade Object Detector in the Computer Vision toolbox as before, but instead of faces using the provided models for – nose, lips, eyes) and extract SURF or HOG features ( extractFeatures ) at those locations. A concatenated vector of the features extracted at the landmarks can be used to represent the face.
Recognition can be done using regularized regression as in the paper. Or you can train an SVM (Stats toolbox) to recognize each person in your face database – the pictures of that person as positive samples, all other pictures as negative samples. Create an SVM for each person in the database and use that to recognize/classify a new face (one-versus-rest SVM).
1 Commento
omar A.alghafoor
il 17 Mar 2021
Hi Mathworks team .
I am having two problems distinguishing faces using (face recognition convolutional neural network)
First: How to detect the intruder.
Second: The facial recognition overlaps between one person and another in the system.
The first test on grayscale images was good recognition, but on realtime of web camera the results are incorrect, knowing that I use a camera that has accuracy: 1024x570
note : all imge are grayscale .
Where is the defect in the code?
this my code for training dataset:
clc
clearvars
close all
%% variables
trainingNumFiles = 0.8;
rng(1)
faceData = imageDatastore('AutoCapturedFaces','IncludeSubfolders',true,'LabelSource','foldernames');
% Resize the images to the input size of the net
faceData.ReadFcn = @(loc)imresize(imread(loc),[227,227]);
% read one image to get pixel size
img = readimage(faceData,1);
% splitting the testing and training data
[trainFaceData,testFaceData] = splitEachLabel(faceData, ...
trainingNumFiles,'randomize');
%% defining CNN parameters
% defining layers
layers = [imageInputLayer([size(img,1) size(img,2) 1])
%middle layers
convolution2dLayer(5,3,'Padding', 2, 'Stride',3)
reluLayer
maxPooling2dLayer(3,'Stride',3)
%final layers
fullyConnectedLayer(8)
softmaxLayer
classificationLayer()];
% options to train the network
options = trainingOptions('sgdm', ...
'MiniBatchSize', 40, ...
'InitialLearnRate', 1e-4, ...
'MaxEpochs', 25, ...
'LearnRateSchedule', 'piecewise', ...
'LearnRateDropFactor', 0.875, ...
'LearnRateDropPeriod', 12, ...
'VerboseFrequency', 5);
% training the network
convnet = trainNetwork(trainFaceData,layers,options);
%% classifying
YTest = classify(convnet,testFaceData);
TTest = testFaceData.Labels;
%% Calculate the accuracy.
accuracy = sum(YTest == TTest)/numel(TTest)
save convnet
accuracy =
0.9375
https://www.mathworks.com/matlabcentral/answers/774947-face-recognition-convolutional-neural-network?s_tid=prof_contriblnk
Più risposte (1)
Namratha
il 31 Lug 2014
2 Commenti
Aruni
il 31 Lug 2014
Sorry, the link is corrected now: http://www4.comp.polyu.edu.hk/~cslzhang/paper/conf/iccv11/CRC_RLS_final.pdf
Please ask any specific doubts you have?
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!