how can I recognize face of unknown person using CNN in matlab
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have train faces of 16 people with 35 images for each person .how can I recognize face of unknown person. Please help in coding for this requirement. Here is test data code .For training I have use CNN .
load net.mat;%Train data
myFolder ='D:\FYP\Convolutions\New folder\New folder';%Image taken for attendace
filePattern = dir(fullfile(myFolder,'*.jpg'));
totalstudents=numel(filePattern)
for k = 1:totalstudents
e=fullfile(myFolder,filePattern(k).name);
ourimage=imread(e);
imgre=imresize(ourimage,[128 128]);
present(k,:)=classify(net,imgre);%net is train data and imgre is images for attendace
subplot(4,5,k)
imshow(imgre)
title(char(present(k)));
end
if I have unknown face which not train in train images then how to write code after classification or prediction to recognized that face .
0 comentarios
Respuestas (1)
Rahul
el 12 de Mzo. de 2025
As I understand, you wish to train a CNN model to recognise faces of people. Your training set consists of images of 16 people with 35 images per person. You wish to classify the image of an 'unknown' person whose image is not included within the training set.
One option can be to obtain the confidence scores after applying classification at each iteration. Using these scores we can set a confidence threshold for them and hence recognise a image/face as 'unknown'. Here is an example:
% This code can be used within the for loop
confidenceThreshold = 0.6; % This can be adjusted accordingly
[label, scores] = classify(net, imgre); % Get classification scores
% Check confidence score
maxScore = max(scores);
if maxScore < confidenceThreshold
present(k, :) = "Unknown";
else
present(k, :) = label;
end
The following MathWorks documentations can be referred to know more:
'scores' (classify): https://www.mathworks.com/help/deeplearning/ref/seriesnetwork.classify.html#d126e36619
Thanks.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!