Problems with a saved neural network

조회 수: 1 (최근 30일)
Harold
Harold 2013년 4월 29일
댓글: keirth kilat 2018년 5월 6일
I've posted this question in another forum but decided to ask it here for a better chance at a response.
I'm having problems passing a neural network as a handle through a pushbutton callback. I use a menu to select the neural network file (mat file that was saved from a previous successful training session) and save this network as handles.neural_net = load('trained_net.mat'). Upon clicking the run neural network button, the network is run by netfunc(handles.neural_net, inputs,targets) where I've already specified the inputs and targets in the program. I get an error pointing within netfunc.m.
To make sure data was getting passed in, right under the function header within netfunc I put,
net inputs targets
The error points to the variable net. The size of net is 1x1. This is confusing because after the successful training run, I saved the network. I used save('trained_network.mat','net').
  댓글 수: 1
keirth kilat
keirth kilat 2018년 5월 6일
hello do you have the solution on this? because i have the same problem and it is killing me.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2013년 4월 29일
trained_net_vars = load('trained_net.mat');
handles.neural_net = trained_net_vars.net;
  댓글 수: 3
Walter Roberson
Walter Roberson 2013년 4월 30일
S = load(filename) loads the variables from a MAT-file into a structure array, or data from an ASCII file into a double-precision array.
You are working with a .mat file, so the output is a structure array. There will be one field in the structure array for each variable that was originally saved in the file. You saved (only) the variable 'net' in the file, so the structure array will have a field ".net" that contains the saved information. When you assign that structure array to handles.neural_net you are getting out the structure handles.neural_net.net containing the saved information rather than handles.neural_net itself containing the saved information.
Harold
Harold 2013년 4월 30일
Ok, thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by