Neural Network in Matlab App Designer
Show older comments
Is it possible to incorporate a Neural Network into an app created from the Matlab App Designer?
6 Comments
Juan Carlos Pozuelos Buezo
on 23 Oct 2019
Edited: Juan Carlos Pozuelos Buezo
on 23 Oct 2019
Hi, i am trying to charge a neuronal network (net.mat) into the app designer. The net is for get a forecast of electricity load. The input is a table with predictors. How i can call de net into de app designer?
For get the result: have i to use function “sim”?
[ypredict]=sim(app.net,input);
I try but i have problem
Thanks fotmr your help, and sorry for my English
Kojiro Saito
on 24 Oct 2019
Which neural network are you using?
For example, in order to forecast numeric values, you can use LSTM networks for regression.
In this case, you can use predict.
YPred = predict(app.net, input);
If you're using Autoencoder, you can also use predict for forecasting.
YPred = predict(app.net, input);
Juan Carlos Pozuelos Buezo
on 26 Oct 2019
Edited: Juan Carlos Pozuelos Buezo
on 26 Oct 2019
Thanks Kojiro. From Deep Neural toolbox i used the “neural network fitting tool” to get a model (pre trained). The model i saved as “net.mat”. When i used the net outside the app designer, i write y_pred = sim(net,input_target) and works, But into the app designer i can’t used that.
I have tried y_pred=Predict(app.net,input_target) but “predict” is not accepted in app designer. I have tried y_pred=net(app.net,input_target), but it wasn’t work too.
Can you help me??
Juan Carlos Pozuelos Buezo
on 7 Nov 2019
Hi.
I wil try use the recomendation.
first, i used starupTcn(app) to load de net model. its call netdia.mat:
properties(Access = private)
net;
Y_predict;
end
function startupFcn(app)
app.net.net = load("C:\Predictor Demanda S.N.I\net\netdia.mat");
app.net = app.net.net;
end
then, into de code i tried to call de net with "YPred = predict(app.net, input);", like that:
Y_predict = predict(app.net,Xp_prediccion);
but, i got this error:
Undefined function 'predict' for input arguments of type
'struct'.
Error in
Predictor_Demanda_SNI_Corto_Plazo3/ProcesaDIASIGUIENTEButtonValueChanged
(line 336)
Y_predict =
predict(app.net,Xp_prediccion) % el
modelo previamente entrenado
únicamente generará la salida
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 378)
Error while evaluating StateButton PrivateValueChangedFcn.
what is my error?
thanks
Kojiro Saito
on 8 Nov 2019
Edited: Kojiro Saito
on 9 Nov 2019
The structure to be input in predict might be different.
How about changing as the follows?
function startupFcn(app)
app.net = load("C:\Predictor Demanda S.N.I\net\netdia.mat");
app.net = app.net.net;
end
If the above does not work, add a breakpoint in the line of
Y_predict = predict(app.net,Xp_prediccion);
and pause at this line. Then, what is a variable type of app.net? You can konw the variable type by whos command.
Juan Carlos Pozuelos Buezo
on 8 Nov 2019
Thanks a lot. It works ok ?
Accepted Answer
More Answers (1)
Pablo Salaverria
on 10 Jun 2019
1 vote
Dear all,
while creating an app using app designer I am not able to compeltelly deploy my trainned CNN. My main issue is wiht the function classify which should be valid with:
[YPred]= classify(app.net,app.imds1);
Where app.net is the trainned CNN, app.imds1 is the imageDatastore where all the images that I want to classify are stored.
The error message that I got is:
Error using classify (line 123)
Requires at least three arguments.
Meaning that the function classify is using a 2nd options instead of the one that I want it to use. Is there a way to make it work?
1 Comment
Kojiro Saito
on 11 Jun 2019
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!