How to onstruct a deep network from Layers and meta variables

2 vues (au cours des 30 derniers jours)
riad didou
riad didou le 13 Sep 2022
Réponse apportée : Ayush Aniket le 2 Sep 2025 à 9:13
I have a pretrained CNN model(*.mat) downloaded from the internet, contains two Matlab variables "layers" and "meta".
May i have ability to construct network(net) from these two variables to pass my dataset without training?

Réponses (1)

Ayush Aniket
Ayush Aniket le 2 Sep 2025 à 9:13
You can use a pretrained CNN model from a .mat file containing layers and meta to process your dataset without retraining but it depends on how the model was saved and structured.
If layers is a valid array of MATLAB deep learning layers (e.g., created using layerGraph or a simple array of layers), you can reconstruct the network using:
net = assembleNetwork(layers);
This creates a SeriesNetwork or DAGNetwork depending on the structure. You can then use functions like classify, predict, or activations to pass data through the network.
Once the network is assembled, you can use it directly:
predictions = classify(net, inputData);
No training is needed if the weights are already embedded in the layers structure.
If the layers variable is not compatible with assembleNetwork, it might be from a different framework (e.g., MatConvNet). In that case, you’ll need to manually convert it or use the original toolbox that created it.

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by