Sunday 4 August 2013

Gesture Recognition using Neural Network in MATLAB Code Part 2

neuralnetwork_gesture.m

Go to First Part                             Go to Next Part



echo on
clc
pause
clc

Store the training informations in a test file

fid = fopen('train.txt','rt');
P1 = fscanf(fid,'%f',[19,inf]);
P=P1;

Open some text file using code to write and fetch the required information about image.


fid = fopen('testO.txt','rt');
TS1 = fscanf(fid,'%f',[19,inf]);

%(As here we are only testing alphabet 'O')

fid = fopen('target8.txt','rt');
T = fscanf(fid,'%f',[8,inf]);

It has been found that the optimal number of neurons for  the hidden layer is 85

S1 = 85;
S2 = 5;

Now we have to initialize pre-processing layer

[W1,b1] = initp(P,S1);

We also have to initialize learning layer

 [W2,b2] = initp(S1,T);

pause 

NOW TRAIN THE NETWORK


A1 = simup(P,W1,b1);
TP = [1 500]; 
pause
clf reset
figure(gcf)

% resize the frame size
setfsize(600,300);

[W2,b2,epochs,errors] = trainp(W2,b2,A1,T,TP);

pause
clc 

ploterr(errors); 


pause

M = MENU('Choose a file resolution','Test O');    %as we are only showing 'O',you can add more
if M == 1 
 TS = TS1;
else 
 disp('Wrong input');

a1 = simup(TS,W1,b1);        

a2 = simup(a1,W2,b2)      

echo off 

Next part will be posted in next Post,Thanks for visiting have fun

Gesture Recognition using Neural Network in MATLAB 


2 comments:

  1. A special thanks for sharing this informative post. I've definitely learned a lot of new things here.

    ReplyDelete
  2. I want to implement dynamic Face ROI lie on ear and neck part (remove) contour detection and skelton . please share me code how i can remove ear and neck .please mail me to sameersoft6@gmail.com

    ReplyDelete