Info

This question is closed. Reopen it to edit or answer.

How toTEST NEW input and target file during neural network testing in my own GUI Application?

1 view (last 30 days)
hello ,
I need a help regarding training and testing of neural network in my own GUI application.
I generate 2 push button in GUI one for training and another for testing.
I Colleted 20 people signature images , 5 different copies of each individual that is total 100 signature images. i did pre- processing and feature extraction from each image. and i generate 20 targets for neural network training.
the dimension of input file is 7x100 and target filedimension is 20*100. after that i trained the neural network by tainlm. but in gui during testing I want input a new test image and I extracted the 7 features of input image and save it in newinput.mat and having dimensions of 7x1. now i want to compaire newinput.mat features with all 100 images which is generated during training . if it match with 1 to 5 image that means it belong to 1st person , if it match with 6 to 10 that means it belong to 2nd person and so on upto 100 images. but the error during testing is dimension of input and targets are different.
please help me to solve it.
function pushbutton1_Callback(hObject, eventdata, handles)
clc ;
global net;
inputs=signinput;% initial inputs for training input of size 7x100 dimensions
targets=signTargets; % targets of 20X100 dimensions
rng(6,'twister');
% Create a Pattern Recognition Network
hiddenLayerSize = 10;
net = patternnet(hiddenLayerSize);
% Train the Network
net = train(net,inputs,targets);
nntraintool
view(net)
function pushbutton2_Callback(hObject, eventdata, handles)
clc ;
global net;
inputs=newinput;% new input inputs for testing of size 7x1 dimensions
targets=signTargets; % peviouse targets of trained network 20X100 dimensions
rng(6,'twister');
% Create a Pattern Recognition Network
hiddenLayerSize = 10;
net = patternnet(hiddenLayerSize);
% Train the Network
net = configure(net,input1,targets);
net = train(net,inputs,targets);
nntraintool
view(net)
% Test the Network
outputs = net(input1);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)
% The error is as following %
Error using mse (line 423)
Dimensions of targets and outputs do not match.
Error in network/perform (line 31)
perf = feval(net.performFcn,net,t,y,ew,net.performParam);
Error in gui22>pushbutton2_Callback (line 345)
performance = perform(net,output,outputs,{})
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in gui22 (line 45)
gui_mainfcn(gui_State, varargin{:});

Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!