predict DAGnetwork error in compiled .exe
4 次查看(过去 30 天)
显示 更早的评论
I'm hoping someone can shed light on an error I'm encountering.
I have a trained Keras model that I have imported using:
if true
net = importKerasNetwork(modelfile,'WeightFile',weights)
end
and I can make predictions on image patches with no errors from the command line with:
if true
prediction = predict(net,imagePatch);
end
I can also save and load the network to make predictions.
However, when I try to use these lines a standalone .exe I run into errors that I don't know how to solve.
When I try loading the saved network to make predictions I encounter the following:
if true
Warning: During load:
An invalid default object has been detected while loading a heterogeneous array of class nnet.cnn.layer.Layer.
An empty array of class nnet.cnn.layer.Layer will be returned.
Warning: While loading an object of class 'DAGNetwork':
Subscript indices must either be real positive integers or logicals.
end
I have some error catching in my code and the exception is:
if true
"identifier": "MATLAB:structRefFromNonStruct",
"message": "Struct contents reference from a non-struct array object."
"stack": [
"file": "\\mcrCache9.3\\optoma0\\toolbox\\nnet\\cnn\\DAGNetwork.m",
"name": "DAGNetwork.predict",
"line": 387
end
If I try to use importKerasNetwork instead of loading the saved network I get the following error:
if true
"identifier": "MATLAB:internal:msgcat:msgcatInvalidResourcePath",
"message": "The path \\mcrCache9.3\\optoma1\" is not a valid message catalog
resource path",
"cause": [],
"stack": [
[
{
"file": "\\mcrCache9.3\\optoma1\\toolbox\\nnet\\supportpackages\\keras_importer\\importKerasNetwork.m",
"name": "importKerasNetwork",
"line": 70
end
1 个评论
Don Mathis
2018-3-1
Could you post some lines of code that I can paste into MATLAB that will let me replicate the problem?
回答(3 个)
Raymond Lei
2018-2-23
I've encountered the same problem executing the compiled java library, same error messages for both cases. Please have a look at this problem!
0 个评论
Oleksii Sidorov
2018-7-25
I faced the same issue installing Inception-ResNet-v2,
most probably it is caused by the fact that definition of DAGNetwork contains layers which are NOT default in NN Toolbox. These "new" layers are downloaded and installed together with add-on. So, logically, without them network model has a "reference" on layers which are not exist.
I solved this issue by copying whole add-on's directory and running inceptionresnetv2.m file instead of just loading data from inceptionresnetv2.mat. In this way model is imported together with layers.
1 个评论
Oleksii Sidorov
2018-7-25
You also need to copy that custom layers to your working dir, and add it to matlab path like following:
exampleFolder = genpath(fullfile(pwd));
addpath(exampleFolder)
Tao Cui
2019-11-24
You can do this:
In the compiler interface click that "Settings" logo. In settings, copy and paste the following string to that "Additional parameters passed to MCC".
-a 'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\nnet\supportpackages\keras_importer'
Assuming you are using R2018a.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!