Closed ehennestad closed 1 year ago
There is no specific support package for Keras, just https://www.mathworks.com/matlabcentral/fileexchange/64649-deep-learning-toolbox-converter-for-tensorflow-models which is a requirement to run the importKerasLayers function. Do you maybe have different versions of MATLAB installed on your machine? Are you on MATLAB R2023a? Also please note that the Deep Learning Toolbox is required.
I tried to run the same code on MATLAB Online, and then I got a different error:
This is the section that fails:
importednet = importKerasLayers('2019_09_11_23_32_unet_single_1024_mean_absolute_error_Ai93-0450.h5','ImportWeights',true);
This is the error message:
Error using nnet.internal.cnn.keras.readModelAndTrainingConfigs
Unable to read HDF5 file '2019_09_11_23_32_unet_single_1024_mean_absolute_error_Ai93-0450.h5'. The error message was: 'Unable to open the file because of HDF5 Library error. Reason:
H5Fget_obj_count not a file id''
Error in nnet.internal.cnn.keras.importKerasLayers (line 9)
[ModelConfig, TrainingConfig, ~] = nnet.internal.cnn.keras.readModelAndTrainingConfigs(ConfigFile, Format);
Error in importKerasLayers (line 76)
Layers = nnet.internal.cnn.keras.importKerasLayers(modelfile, varargin{:});
I can reproduce this. The network, that is referred to in the demo, does not exist in the repository. Try running this in MATLAB-Online before you execute lines 3ff of the livescript:
websave("./sample_data/2019_09_11_23_32_unet_single_1024_mean_absolute_error_Ai93-0450.h5","https://www.dropbox.com/sh/vwxf1uq2j60uj9o/AAC0sZWahCJFBRARoYsw8Nnra/2019_09_11_23_32_unet_single_1024_mean_absolute_error_Ai93-0450.h5?dl=1")
Note the ?dl=1 in the end (as compared to ?dl=0 in the markdown file, is necessary for me to save files from dropbox with websave.
Thanks!
I am using MATLAB R2022a, and Deep Learning Toolbox is installed. I did not immediately see a version requirement for MATLAB, but I'll try on R2023a!
I had removed the URL parameter, but it appears necessary. I added it and now it works on MATLAB Online!
@ehennestad I think, but don't quote me on that, you need at least 22b for the import of the Keras networks. My feeling is, whenever deeplearning is involved it is good advice to use the very latest version of MATLAB you have available, as development is super rapid in that area.
@ehennestad does this mean this issue can be closed now?
FYI: we have added an automatic download step, which means your issue should no longer appear.
Hi,
I am trying to run the
tiny_ophys_inference.mlx
, but I get the following error:I have installed the requirement listed on the main README (https://nl.mathworks.com/matlabcentral/fileexchange/64649-deep-learning-toolbox-converter-for-tensorflow-models), but I do not find any adding named "Deep Learning Toolbox Importer for Keras Models" when I search in either the Addon Explorer or on FileExchange.