How to save a trained deep learning model in .mat format in Python and load it in MATLAB

25 vues (au cours des 30 derniers jours)
ANUSAYA SWAIN
ANUSAYA SWAIN le 27 Mar 2024
Réponse apportée : Raj le 2 Avr 2024 à 8:30
simParameters.DLNetworkFilename = 'TrainedNetwork.mat'
For example I want to train a deep learning model in python and save it with the name 'TrainedNetwork.mat'.
And the load this network in MATLAB

Réponses (1)

Raj
Raj le 2 Avr 2024 à 8:30
As per my understanding, a better alternative to saving a deep learning model in .mat format in Python and loading it in MATLAB will be importing the model to MATLAB itself and then saving it in .mat format.
MATLAB provides the 'importNetworkFromTensorFlow' function to directly import TensorFlow network as MATLAB network.
Saving the model in .mat format in Python may not be an efficient format for large models or complex architecture. Using the 'scipy.io.savemat' function under the SciPy pyton library, you can save the array objects in the given dictionary to a MATLAB- style .mat file, but that will not be a recommended approach in this scenario
Additionally you can refer to the following documentation link on the 'importNetworkFromTensorFlow' function for better understanding-
I hope this solves your query!

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by