Borrar filtros
Borrar filtros

importing a ResNet model of python code in matlab?

3 visualizaciones (últimos 30 días)
Yongwon Jang
Yongwon Jang el 17 de Ag. de 2023
Comentada: Angelo Yeo el 18 de Ag. de 2023
I would like to load a deep network from the attached python code file and use it in the trainNetwork function in matlab.
Attached file: ResNet_simple_model.py, which contains the deep neural network model. (import tensorflow, numpy, sys, etc.)
How can I load and run this in matlab, load it as lgraph or layers, and train it with the trainNetwork(training_data, layers, options) function?
Waiting for help from experts.
  2 comentarios
Constantino Carlos Reyes-Aldasoro
Constantino Carlos Reyes-Aldasoro el 17 de Ag. de 2023
Have you tried using the native ResNet CNNs (https://uk.mathworks.com/help/deeplearning/ref/resnet50.html)?
Yongwon Jang
Yongwon Jang el 18 de Ag. de 2023
Yes. I tried it with matlab toolbox.
But I want to know how to import and use .py file.
Thanks.

Iniciar sesión para comentar.

Respuesta aceptada

Angelo Yeo
Angelo Yeo el 18 de Ag. de 2023
1) Like @Constantino Carlos Reyes-Aldasoro said, you may apply to use the shipped ResNet for your research.
However, your Python model shows that your model is different from known ResNet models but rarther customized ones.
2) If you are using MATLAB R2021a or above, consider using importTensorFlowNetwork function. In order to import TF Network, you can save the model in "pb" format. How to save a TF Network into "pb" can be found in the link below.
https://www.tensorflow.org/guide/saved_model
  3 comentarios
Yongwon Jang
Yongwon Jang el 18 de Ag. de 2023
Editada: Yongwon Jang el 18 de Ag. de 2023
But still I wonder how to import and use .py file, for cowork with python user, not using importTensorFlowNetwork .
for example, the combinations of below...
pyversion
py.importlib.import_module
pyrunfile
:
:
:
Angelo Yeo
Angelo Yeo el 18 de Ag. de 2023
Can you describe your workflow? Why do you want to run "py" files via MATLAB?
In my imagination, I assumed that you might want to import trained network from Python's end. If you want to cowork with Python users you can also export the trained model with exportNetworkToTensorFlow.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by