⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.m

📁 用人工神经网络进行人脸识别
💻 M
字号:
% Face Recognition with Artificial Neural Networks (ANN)
% L Png, MSc Computation, UMIST, 2004. Supervisor: Dr H. Qiao
% ----------------------------------------------------------------
% In this project, a face recognition system based on the morphological shared-weight 
% neural network (MSNN) is introduced. The MSNN algorithm consists of two stages: 
% feature extraction followed by classification. In the feature extraction stage, 
% the operations of mathematical morphology perform nonlinear, translation-invariant 
% transformations on grayscale images. In the classification stage, 
% the standard error-backpropagation network provides function mapping of weighted vectors. 
% Feature extraction is performed using shift-independent hit-miss transforms. 
% The extracted output is then learned by interacting with the classification process. 
% For evaluation, we test for robustness under variations in gray-levels and noise while 
% varying the neural network architecture to optimize recognition efficiency and processing time. 
% Results show that the MSNN outperforms the ordinary multilayer network for 
% grayscale image face classification.


choice=0;
possibility=13;

% Create menu******************************
while choice~=possibility,
choice=menu('MSNN Face Recognition System [2004, L. PNG]','1. Recognition by Whole Image',...
            '2. Train Training Set','3. Train Test Set',...
            '4. DETECT','5. Recognition by Eye Detection','6. Train Eyes (Training Set)',...
            '7. Train Eyes (Validation Set)','8. Train Eyes (Test Set)',...
            '9. DETECT with Eye Image','10. Locate Eyes in Detected Image',...
            '11. Hough Eye-level Detection',...
            '12. Eye-level Adjustment','Close Program');
save R;

% Read Images*************************
    if choice==1,
        readimage;
        load R;
    end;
    
    
% Train Training Set******************    
    if choice==2
        traindata_newfinal;
        load R;
    end;
     
    
% Train Test Set*************************    
    if choice==3
        traintest_newfinal;
        load R;
    end;
   
    
% Detection***************************
    if choice==4
        detect;
        load R;
    end;


% Select Eye Area******************************    
    if choice==5
        selecte = input('Enter test image (1-20): ');   
       for i1 = 1:20
   	    string = ['C:\images\unseen\' num2str(i1) '.tif'];
   	    dataP{i1} = imread(string);   
       end;
        test_image = dataP{selecte};
        [lefte,righte,outim] = eyecrop_testim(test_image);
        save C;
        load R;
    end;
    
% Train Training Set*************************
    if choice==6
        traineyes_datafinal;       
        load R;
    end;
    
% Train Test Set************************
    if choice==7
        traineyes_valfinal;
        load R;
    end;
    
% Validate**************************
    if choice==8
        traineyes_testSHIFT; 
        load R;
    end;
    
% Train and Detect Cropped Area****************
    if choice==9
        validation;
        load R;
    end;
    
% Eye Detection****************************
    if choice==10
        load C selecte;load C lefte;load C righte;load XX flagx;load C dataP;
        
        % get detected image collection
        for i1 = 1:10
   	    string = ['C:\images\id3\' num2str(i1) '.tif'];
   	    dataG{i1} = imread(string);   
        
        % adjust here to test detection on shifted images
        %dataG{i1} = imadjust(dataG{i1},[0.1 0.9],[0.1 0.9]);
        
        end;
        
        % split up all the images
        [pk1,pk2] = split(dataG{1},dataG{2},dataG{3},dataG{4},...
                          dataG{5},dataG{6},dataG{7},dataG{8},...
                          dataG{9},dataG{10});
                      
        % perform detection
        [Ileft,Iright,merge] = eyesearch(pk1{flagx},pk2{flagx},lefte,righte);
        
        subplot(121);imshow(dataP{selecte});
        subplot(122);imshow(merge);
        
        save Q;
        load R;
    end;

% Hough Detection
         if choice==11
         geteyelevel;
         load R;
         end;
         
% Perform Eye-level Adjustment     
        if choice==12
        load Q; 
        [Ileft,Iright,merge] = eyesearch_amend(pk1{flagx},pk2{flagx},lefte,righte);
        subplot(121);imshow(dataP{selecte});
        subplot(122);imshow(merge);
        load R;
        end;
        
% Close Program****************************                   
         if choice==13
         close all;
         %helpwin main;
         end;
end;

% ^End of Program^
         
         
         
         
         

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -