File Exchange

image thumbnail

Deep Learning Toolbox Model for ResNet-50 Network

Pretrained Resnet-50 network model for image classification

96 Downloads

Updated 20 Mar 2019

ResNet-50 is a pretrained model that has been trained on a subset of the ImageNet database and that won the ImageNet Large-Scale Visual Recognition Challenge (ILSVRC) competition in 2015. The model is trained on more than a million images, has 177 layers in total, corresponding to a 50 layer residual network, and can classify images into 1000 object categories (e.g. keyboard, mouse, pencil, and many animals).
Opening the resnet50.mlpkginstall file from your operating system or from within MATLAB will initiate the installation process for the release you have.
This mlpkginstall file is functional for R2017b and beyond.
Usage Example:
% Access the trained model
net = resnet50();
% See details of the architecture
net.Layers
% Read the image to classify
I = imread('peppers.png');
% Adjust size of the image
sz = net.Layers(1).InputSize
I = I(1:sz(1),1:sz(2),1:sz(3));
% Classify the image using Resnet-50
label = classify(net, I)
% Show the image and the classification results
figure
imshow(I)
text(10,20,char(label),'Color','white')

Comments and Ratings (16)

Azhar Imran

Azhar Imran

I need this Resnet-50 network for Matlab 2016-b.
Can you please suggest me any solution.

azharimran63@gmail.com

can to please tell me that how i can obtain its layer by layer code?

software

zhangshaungqing Thanks

I used the following code to successfully train the resnet network without the problems mentioned above.
numClasses = numel(categories(imdsTrain.Labels));
lgraph = removeLayers(lgraph, {'fc1000','fc1000_softmax','ClassificationLayer_fc1000'});
newLayers = [
fullyConnectedLayer(numClasses,'Name','fc','WeightLearnRateFactor',10,'BiasLearnRateFactor',10)
softmaxLayer('Name','softmax')
classificationLayer('Name','classoutput')];
lgraph = addLayers(lgraph,newLayers);
lgraph = connectLayers(lgraph,'avg_pool','fc');

gong bangming

Huawei Tian

"I have the problem with the output of layer 12 is incompatible with the input expected by layer 13."

yes. I also have this problem

layersTransfer = net.Layers(1:end-3);
numClasses = numel(categories(trainingImages.Labels))
layers = [
layersTransfer
fullyConnectedLayer(numClasses,'WeightLearnRateFactor',20,'BiasLearnRateFactor',20)
softmaxLayer
classificationLayer];
netTransfer = trainNetwork(trainingImages,layers,options);

von carlos

dont work, ResNet-50 and i had the same problem of layer 12 is incompatible with layer 13

caesar

caesar (view profile)

I had used ResNet-50 and i had the same problem of layer 12 is incompatible with layer 13 when trying o resume training from a saved checked point

Hanbin Zhang

"I have the problem with the output of layer 12 is incompatible with the input expected by layer 13."

yes. I also have this problem

Hello,
I am trying to test the resnet 50 on Dataset consist of 1560 images. I have problem with the output of layer 12 is incompatible with the input expected by layer 13.

Any advice on how could I solve this problem is greatly appreciated

Dayou Jiang

NICE JOB!

cui

cui (view profile)

good!

adel adel

MATLAB Release Compatibility
Created with R2017b
Compatible with R2017b to R2019a
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor