face-recognition code in matlab

Hello all ... all i need is face recognition and face matching code in matlab because my project depends on that and i've not studied matlab or DIP as a course .... please help me by giving me face recognition code in matlab ... thnxxxxx

답변 (1개)

Sabarinathan Vadivelu
Sabarinathan Vadivelu 2014년 2월 11일

1 개 추천

If you have MATLAB R2013a, Then you can find the face detector which comes inbuilt with MATLAB.
% Create a cascade detector object.
faceDetector = vision.CascadeObjectDetector();
% Read a video frame and run the detector.
videoFileReader = vision.VideoFileReader('visionface.avi');
videoFrame = step(videoFileReader);
bbox = step(faceDetector, videoFrame);
% Draw the returned bounding box around the detected face.
videoOut = insertObjectAnnotation(videoFrame,'rectangle',bbox,'Face');
figure, imshow(videoOut), title('Detected face');

댓글 수: 7

Muhammad Omer
Muhammad Omer 2014년 2월 11일
i am sorry my question was wrong ... actually i need face recognition code in matlab not face detection only ... please help me please ...
Sabarinathan Vadivelu
Sabarinathan Vadivelu 2014년 2월 11일
편집: Sabarinathan Vadivelu 2014년 2월 11일
  1. Acquire face images from "n" Number of persons.
  2. Detect face.
  3. Extract the required features.
  4. Train the database using a classifier, E,g SVM.
  5. Test Your code.
Muhammad Omer
Muhammad Omer 2014년 2월 11일
cant you provide me the code actually ive already mentioned that ive not studied it as a course ...
prashanth
prashanth 2014년 5월 9일
http://www.pages.drexel.edu/~sis26/Eigenface%20Tutorial.htm please check this site very helpful.You will get code here.
Sabarinathan Vadivelu
Sabarinathan Vadivelu 2014년 7월 31일
@ Omer, If this fulfills your need, then make sure you accepted the answer.
shahana muzaffar
shahana muzaffar 2015년 8월 19일
편집: shahana muzaffar 2015년 8월 19일
if we want to capture the image through direct integrated cam wt can i do??plz tel me in 2014a matlab
omar A.alghafoor
omar A.alghafoor 2021년 3월 17일
편집: Walter Roberson 2023년 3월 30일
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

댓글을 달려면 로그인하십시오.

질문:

2014년 2월 11일

편집:

2023년 3월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by