Code covered by the BSD License  

Highlights from
Morphological Shared-Weight Neural Network for Face Recognition

image thumbnail

Morphological Shared-Weight Neural Network for Face Recognition

by

 

31 Dec 2004 (Updated )

MSNN has the ability to learn feature extraction and perform classification at the same time.

readimage.m
clear
%---------------read testset----------------


for i = 1:4
    for j = 5:8
   	string1 = ['C:\images\f10\' num2str(i) '.tif'];
    string2 = ['C:\images\f10\' num2str(j) '.tif'];
   	Dataf1{i} = imread(string1);   
    Testf1{j-4} = imread(string2);
end;
end;

for i = 1:4
    for j = 5:8
   	string1 = ['C:\images\f1\' num2str(i) '.tif'];
    string2 = ['C:\images\f1\' num2str(j) '.tif'];
   	Dataf2{i} = imread(string1);   
    Testf2{j-4} = imread(string2);
end;
end;

for i = 1:4
    for j = 5:8
   	string1 = ['C:\images\f9\' num2str(i) '.tif'];
    string2 = ['C:\images\f9\' num2str(j) '.tif'];
   	Dataf3{i} = imread(string1);   
    Testf3{j-4} = imread(string2);
end;
end;

for i = 1:4
    for j = 5:8
   	string1 = ['C:\images\f6\' num2str(i) '.tif'];
    string2 = ['C:\images\f6\' num2str(j) '.tif'];
   	Dataf4{i} = imread(string1);   
    Testf4{j-4} = imread(string2);
end;
end;

for i = 1:4
    for j = 5:8
   	string1 = ['C:\images\f7\' num2str(i) '.tif'];
    string2 = ['C:\images\f7\' num2str(j) '.tif'];
   	Dataf5{i} = imread(string1);   
    Testf5{j-4} = imread(string2);
end;
end;

for i = 1:4
    for j = 5:8
   	string1 = ['C:\images\f2\' num2str(i) '.tif'];
    string2 = ['C:\images\f2\' num2str(j) '.tif'];
   	Dataf6{i} = imread(string1);   
    Testf6{j-4} = imread(string2);
end;
end;

for i = 1:4
    for j = 5:8
   	string1 = ['C:\images\f3\' num2str(i) '.tif'];
    string2 = ['C:\images\f3\' num2str(j) '.tif'];
   	Dataf7{i} = imread(string1);   
    Testf7{j-4} = imread(string2);
end;
end;

for i = 1:4
    for j = 5:8
   	string1 = ['C:\images\f5\' num2str(i) '.tif'];
    string2 = ['C:\images\f5\' num2str(j) '.tif'];
   	Dataf8{i} = imread(string1);   
    Testf8{j-4} = imread(string2);
end;
end;

for i = 1:4
    for j = 5:8
   	string1 = ['C:\images\f4\' num2str(i) '.tif'];
    string2 = ['C:\images\f4\' num2str(j) '.tif'];
   	Dataf9{i} = imread(string1);   
    Testf9{j-4} = imread(string2);
end;
end;

for i = 1:4
    for j = 5:8
   	string1 = ['C:\images\f8\' num2str(i) '.tif'];
    string2 = ['C:\images\f8\' num2str(j) '.tif'];
   	Dataf10{i} = imread(string1);   
    Testf10{j-4} = imread(string2);
end;
end;



%------------compact data set---------------------------
TrainData = {Dataf1{1},Dataf1{2},Dataf1{3},Dataf1{4},...
             Dataf2{1},Dataf2{2},Dataf2{3},Dataf2{4},...
             Dataf3{1},Dataf3{2},Dataf3{3},Dataf3{4},...
             Dataf4{1},Dataf4{2},Dataf4{3},Dataf4{4},...
             Dataf5{1},Dataf5{2},Dataf5{3},Dataf5{4},...
             Dataf6{1},Dataf6{2},Dataf6{3},Dataf6{4},...
             Dataf7{1},Dataf7{2},Dataf7{3},Dataf7{4},...
             Dataf8{1},Dataf8{2},Dataf8{3},Dataf8{4},...
             Dataf9{1},Dataf9{2},Dataf9{3},Dataf9{4},...
             Dataf10{1},Dataf10{2},Dataf10{3},Dataf10{4}};
%-------------------------------------------------------

%------------compact test set---------------------------
TestData = {Testf1{1},Testf1{2},Testf1{3},Testf1{4},...
            Testf2{1},Testf2{2},Testf2{3},Testf2{4},...
            Testf3{1},Testf3{2},Testf3{3},Testf3{4},...
            Testf4{1},Testf4{2},Testf4{3},Testf4{4},...
            Testf5{1},Testf5{2},Testf5{3},Testf5{4},...
            Testf6{1},Testf6{2},Testf6{3},Testf6{4},...
            Testf7{1},Testf7{2},Testf7{3},Testf7{4},...
            Testf8{1},Testf8{2},Testf8{3},Testf8{4},...
            Testf9{1},Testf9{2},Testf9{3},Testf9{4},...
            Testf10{1},Testf10{2},Testf10{3},Testf10{4}};
%-------------------------------------------------------
save B;

Contact us