using .json pretraind model in matlab

7 visualizaciones (últimos 30 días)
Amir Azadeh Ranjbar
Amir Azadeh Ranjbar el 4 de Sept. de 2023
Comentada: Amir Azadeh Ranjbar el 12 de Sept. de 2023
and now i have two files: 1)model.json 2)group1-shard1of1.bin
how can i use this pretrined model in matlab
or convert this pretrained model to .h5 model

Respuestas (1)

Shreeya
Shreeya el 5 de Sept. de 2023
Hi Amir
You can import a pretrained JSON/h5 model in matlab as a neural network using the "importKerasNetwork".The argument passed to the function is the file name of the model you wish to import. It returns a pretrained keras neural network which can be used for further prediction tasks.
Hope this helps.
  3 comentarios
Shreeya
Shreeya el 6 de Sept. de 2023
Try passing in the .bin file as the 'WeightFile' argument.
Amir Azadeh Ranjbar
Amir Azadeh Ranjbar el 12 de Sept. de 2023
modelfile = 'model.json';
weights = 'group1-shard1of2.bin';
net = importKerasNetwork(modelfile,'WeightFile',weights, ...
'OutputLayerType','classification')
Error using nnet.internal.cnn.keras.importKerasNetwork
Error reading Keras model_config from file 'model.json'. The error message
was: 'Unrecognized field name "keras_version".''

Iniciar sesión para comentar.

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by