improve accuracy in pattern recognition using neural network
3 views (last 30 days)
Show older comments
Hello I am trying to build a face recognition system using neural network. For that I am using SURF features as a feature vector for the input. Here is my code:
%%extract the face databse from the folders
imdataloc='D:\xdf\orl_faces';
facedatabase=imageSet(imdataloc,'recursive');
fprintf('The number of unique individuals are %d\n',length(facedatabase));
sd=input('enter the individual under consideration');
%display montage for the individual under choice
montage(facedatabase(sd).ImageLocation);
%%create a gallery of all individuals
for i=1:length(facedatabase)
image(i)=facedatabase(i).ImageLocation(1);
subplot(1,2,1)
imshow(read(facedatabase(sd),1));
subplot(1,2,2);
montage(image);
end
% split the database in to 70 20 split
[training,testing]=partition(facedatabase,[0.8 0.2]);
%extracting SIFT features fromeach image of the training data
extractorFcn = @exampleBag;% where example bag is SURF
bag =
bagOfFeatures(training,'CustomExtractor',extractorFcn,'Vocabulary',480);
bagtest=bagOfFeatures(testing,'CustomExtractor',extractorFcn );
featureVectortest =(encode(bag,training))';% the input feature vector
ind=[1 10 11 12 13 14 15 16 17 18 19 2 20 21 22 23 24 25 26 27 ...
28 29 3 30 31 32 33 34 35 36 37 38 ...
39 4 40 5 6 7 8 9];
ind = repelem(ind,8);% repeat the individual columns 8 times to represnt 80 percent of the dataset images in the training set
target = full(ind2vec(ind));% the target matrix
%save('SIFTneuraldata.mat','featureVectortest','target','training','testing','bagtest');%ssave the input and
for i=1:5
imagetest{i}=read(training(i), 1);
end
for j=1:5
featurevectorpar{j}=(encode(bagtest,imagetest{j}))';
end
%this is the query feature for 5 images from the test set
featurevectorpar=cell2mat(featurevectorpar);
training is done using patternet where net.divideParam.trainRatio = 100/100; as I am splitting the database already.The databse I am using is AT&T cam bride face dataset 40 individuals and 10 images per individual
The image set has been formed in this manner :
Image set 1: s1.
Image set 2: s10.
Image set 3: s11.
Image set 4: s12.
Image set 5: s13.
Image set 6: s14.
Image set 7: s15.
Image set 8: s16.
Image set 9: s17.
Image set 10: s18.
Image set 11: s19.
Image set 12: s2.
Image set 13: s20.
Image set 14: s21.
Image set 15: s22.
Image set 16: s23.
Image set 17: s24.
Image set 18: s25.
Image set 19: s26.
Image set 20: s27.
Image set 21: s28.
Image set 22: s29.
Image set 23: s3.
Image set 24: s30.
Image set 25: s31.
Image set 26: s32.
Image set 27: s33.
Image set 28: s34.
Image set 29: s35.
Image set 30: s36.
Image set 31: s37.
Image set 32: s38.
Image set 33: s39.
Im *age set 34: s4.
Image set 35: s40.
Image set* 36: s5.
Image set 37: s6.
Image set 38: s7.
Image set 39: s8.
* Image set 40: s9.
So in that manner I have made the class indices above. I am also restricting vocabulary of training set to be 480 and not default 500 because the test set is giving me 480 so feature vector has to be of consistent size .
*but the problem is tht the performance is very poor I dont know why perhaps because of less images or because I am labeling indices wrong in the target matrix.Kindly help me on how to improve this recognition *
0 Comments
Answers (0)
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!