How do I create a standalone executable of a pre-trained neural network imported from Keras?
7 views (last 30 days)
Show older comments
I am trying to create an executable of a pre-trained NN model, imported from Keras, based on the example here https://www.mathworks.com/help/nnet/ref/importkerasnetwork.html#mw_0934d1d0-9b5b-463c-b4a4-100ee7ca3067
I used the application compiler to create the .exe. However, when I run the the file, I get an error at the classify function call, saying dot indexing is not supported for variables of this type (see attached image). Could you please suggest possible solutions to successfully create an executable? Thanks.
1 Comment
Julie Sturgeon
on 20 Sep 2018
I got the same error:
Error using importKerasNetwork (line 93)
Dot indexing is not supported for variables of this type.
Debugging the errored line of code, I got another error
K>> nnet.internal.cnn.keras.importKerasNetwork(ModelFile, varargin{:});
Dot indexing is not supported for variables of this type.
Error in nnet.internal.cnn.keras.ParsedKerasModel (line 18)
this.ClassName = KerasModelConfig.class_name;
Error in nnet.internal.cnn.keras.importKerasNetwork (line 24)
KM = nnet.internal.cnn.keras.ParsedKerasModel(ModelConfig, TrainingConfig);
And it appears that the issue is that ParsedKerasModel is receiving a string instead of a struct as expected
K>> class(KerasModelConfig)
ans =
'char'
and further tracked the problem down to the readModelAndTrainingConfigs.m file, line 27. I am trying to read in a json file, and jsondecode is returning a string from reading my file, instead of a struct as in the documentation for that function.
Attached is the value for ModelConfig that was mistakenly converted to a character. Perhaps it would be nice to know what about this config is not parsing correctly.
Answers (1)
See Also
Categories
Find more on Containers 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!