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

27 ビュー (過去 30 日間)
Med Future
Med Future 2022 年 12 月 21 日
回答済み: Milan Bansal 2024 年 9 月 11 日
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

回答 (1 件)

Milan Bansal
Milan Bansal 2024 年 9 月 11 日
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!

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by