Help on Gesture recognition code?

2 次查看(过去 30 天)
I'm doing a project on gesture recognition using Neural Networks. The training Network is RBF net, and the net is saved as gesture1net in an m-file train.m . However, when I load the network, I get an error message that says "undefined variable or function gesture1net". Can anyone tell me why that is? Here's part of the code:
1) train.m
% This program is used to make the neural network for the identification of the gesture1.
clc;
clear all;
% Load the sample images (of different poses) to make net for gesture1
img1=imread('firsgesture1.jpg');
img2=imread('firsgesture2.jpg');
img3=imread('firsgesture3.jpg');
% Crop the sample images
imgcpd1=imcrop(img1);
imgcpd2=imcrop(img2);
imgcpd3=imcrop(img3);
% Train the network. p is the input vector and t is the target vector
p=[imgcpd1,imgcpd2,imgcpd3];
t=[imgcpd1,imgcpd1,imgcpd1];
p=double(p);
t=double(t);
net=newrb(p,t,.001,.1,1000,25); %train using RBF net
save('gesture1net','net'); %save the network
2) trackrecog.m
% MATLAB program for real time hand tracking and gesture identification
clc;
clear all;
close all;
train;
closepreview;
vid = videoinput('winvideo', 1, 'YUY2_640x480'); %specify the video adaptor
src = getselectedsource(vid);
vid.ReturnedColorspace = 'grayscale'; %define the color format to GRAYSCALE
vid.FramesPerTrigger = 1;
preview(vid); %preview the video object
load gesture1net; %load the network for each gesture
imgref1=imread('refimg1.jpg'); %loading the reference image for each gesture
imgcrpd1=imcrop(imgref1); %crop the reference images
imgcrpd1=double(imgcrpd1);
imgtrained1=sim(gesture1net,imgcrpd1) ; %train the cropped reference images_
Thank You!

采纳的回答

Walter Roberson
Walter Roberson 2014-2-4
Do you get the error message on the load statement? Or on something you do right after the load? With that form of "load" the variable that would be created would be named "net".
Also, your invocation of train should be only
train
and not
train.m
  10 个评论
Greg Heath
Greg Heath 2014-2-10
1. train is a MATLAB function in the NNTBX
help train
doc train
I recommend using another name.
2. I am very suspicious of the inputs in
net = newrb(p,t,.001,.1,1000,25); %train using RBF net
H = 1000 indicates to me that the net is probably overfit, overtrained, and, probably, unsuccessful on nontraining data.
3. Will you please post the results of the command
whos
so that I can see the dimensions of your variables?
Hope this helps.
Greg
Pruthvi
Pruthvi 2014-2-13
Well, the performance doesn't meet the goal even after H=1000. The MSE is 126.07. But you're right, the network isn't able to classify other images, and the program doesn't work very well. Here's our code. Could you suggest any changes to make it better?

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by