Error when loading neural network (only when using "dbstop if error")

6 views (last 30 days)
I'm trying to load a neural network that I save after training using:
save netTwoStreamNW7
I'm loading the network using:
netstruct = load('netTwoStreamNW7');
net = netstruct.netTwoStreamNW7;
This loads the network as a struct with the DAGNetwork as a field. This works fine and the network does well. However, when debugging the rest of the code, I decided to use
dbstop if error
in order to be able to look at some variables when an error was caused. The problem is that this causes my code to error when using the previously working load-function, saying:
Error using matlab.io.datastore.ImageDatastore/set.Labels (line 310)
Argument 'numel' must be followed by a nonnegative real scalar integer.
Error in sortbyprediction (line 42)
netstruct = load('netTwoStreamNW7');
This error does not make any sense to me, since I'm not using an ImageDatastore at all in my code (only during training). How do I solve this problem? Is there an alternative way to load the network without getting this error?
  1 Comment
Julius Å
Julius Å on 31 Jul 2019
I solved this problem by using the code below.
%Import network for prediction
netstruct = load('/mnt/storage/julius/Networks/Saved Properly Trained Networks/netTwoStreamNW7', 'netTwoStreamNW7');
net = netstruct.netTwoStreamNW7;
By adding this extra parameter to load, the problem disappeared.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!