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

조회 수: 1 (최근 30일)
Julius Å
Julius Å 2019년 7월 31일
댓글: Julius Å 2019년 7월 31일
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
Julius Å
Julius Å 2019년 7월 31일
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.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by