How to change last layer of Resnet50 in Deep network designer App

25 visualizzazioni (ultimi 30 giorni)
Hello, I hope you are doing well. I want to change the last layer of Resnet50 with my 4 classes, Currently I am using Deep network Desiginer app
How can i do that in MATALAB

Risposte (1)

Milan Bansal
Milan Bansal il 11 Set 2024
Hi Med Future
By default Resnet50 is used for classification of 1000 classes. If you wish to modify the model such that it can be used to classify your four classes, replace the last fully connected layer "fc1000" which has an output size of 1000 with a new fully connect layer with output size 4.
Please refer to the following steps to implement this.
1.) Load the resnet50 model in workspace.
net = resnet50;
2.) Open Deep Network Designer Application and load the net from workspace.
3.) Find the layer with the name "fc1000" which should be the last 3rd layer of the model.
4.) Delete "fc1000" and replace it with a new fully connected layer. Set the outputSize of new layer as 4. Save the model into workspace.
Refer to the following documentation links to learn more:
In R2024a resnetNetwork function is introduced which take numClasses as one of the inputs and return the desired model. Here is documentation: https://www.mathworks.com/help/releases/R2024a/deeplearning/ref/resnetnetwork.html
Hope this helps!

Categorie

Scopri di più su Image Data Workflows in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by