How to change the input size in first layer of Resnet?
20 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have sequential data (Signal dataset) which shape is 1024x1, and I want to train that on resnet by changing the input in first layer.
I have tried below link but its not editable.
1 commentaire
Réponses (2)
Chunru
le 22 Juil 2022
Change input layer may requires new training (not transfer learning):
nresnet = resnet50;
n = [imageInputLayer([112 112 3]); nresnet.Layers(2:end)]; % specify new size
n
2 commentaires
Fernando Perez
le 22 Juil 2022
Thanks,
However, my code is full of bugs. I'm trying to use my own data with one of the resnet examples but I'm facing all sorts of issues with functions I dont understant. For instance the the countEachLabel function gives only 0's, my label images look black and deeplabv3plusLayers still produces a wrong size error.
Is there any example with generic data sizes and number of classes? The tutorial in matlab does not takes you through what to do if your data is monochrome and you only have two classes.
Chunru
le 22 Juil 2022
If you want to use resnet without retraining or transfer learning, the best approach is to resize your input image to be the same size of resnet input layer. You can change the final layers for transfer learning.
Harsh
le 3 Mai 2024
Modifié(e) : Harsh
le 3 Mai 2024
Hi,
From what I can gather, you are trying to change the first layer of the resnet50 model in MATLAB.
"replaceLayer" method can also be used here, here's an example on how to use the "replaceLayer" function:
net = resnet50;
lgraph = layerGraph(net)
firstLayer = lgraph.Layers(1);
inputLayer = imageInputLayer([28 28 1]);
lgraph = replaceLayer(lgraph,firstLayer.Name,inputLayer)
Please refer to the following link for more information on "replaceLayer":
I hope this helps, thanks!
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!