Error using importKerasLayers() for Squeezenet using ".json" file.

3 次查看(过去 30 天)
Hello,
I am trying to use the new Neural Network Toolbox function named "importKerasLayers" to import Squeezenet model. But it gives me below error:
*Error using importKerasLayers
Invalid layer name 'fire2/squeeze1x1'. Layer names must not contain the character '/'.*
Please, let me know about it.
I have also tried importing ".h5" file for Squeezenet. But it gives me below error:
*Error using importKerasLayers
Unable to import layers from file 'squeezenet_weights.h5' because it contains no 'model_config' attribute.*
Can you provide a ".json" or ".h5" file for Squeezenet which supports MATLAB.
Looking forward to solve this problem as soon as possible.
Thank you.

采纳的回答

Mickaël Tits
Mickaël Tits 2017-11-14
Hi,
I had the same problem, so I modified a python script to change layer names (tu use "_" instead of "/"). You can find the corrected model here : https://github.com/titsitits/Squeezenet-Matlab-Keras You can use this line of code to import it :
squeezenet = importKerasNetwork('squeezenet.json','WeightFile','squeezenet.h5','OutputLayerType','classification');
Best regards, Mickaël Tits
  3 个评论
Mickaël Tits
Mickaël Tits 2017-11-19
Hello,
It is actually the version v1.1, which apparently has similar results than v1.0, with much less computations: https://github.com/DeepScale/SqueezeNet/tree/master/SqueezeNet_v1.1
I don't have the v1.0 version unfortunately. If you really need the version 1.0, you can try to modify the python script and use the weights of the v1.0.
Regards, Mickaël Tits
Marco Francini
Marco Francini 2017-11-30
Hello, it is working also for me.
Now that I uploaded the Squeezenet to Matlab I used it with transfer learning techninque so it can handle just 3 classes. It is working fine.
Now that I have my network trained, how can I export it to .h5 and .json file? I see that an "exportKerasNetwork" function does not exists...

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by