Help on Gesture recognition code?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Pruthvi
am 4 Feb. 2014
Kommentiert: Pruthvi
am 13 Feb. 2014
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!
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 4 Feb. 2014
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 Kommentare
Greg Heath
am 10 Feb. 2014
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
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!