- resnet50 : https://www.mathworks.com/help/releases/R2021b/deeplearning/ref/resnet50.html
- Deep Network Designer : https://www.mathworks.com/help/releases/R2021b/deeplearning/ref/deepnetworkdesigner-app.html
How to change last layer of Resnet50 in Deep network designer App
25 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Milan Bansal
on 11 Sep 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!
0 Comments
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!