Deep Learning Toolbox Model for MobileNet-v2 Network

Pretrained MobileNet-v2 model for image classification
2.6K Downloads
Updated 20 Mar 2024
MobileNetv2 is a pretrained model that has been trained on a subset of the ImageNet database. The model is trained on more than a million images and can classify images into 1000 object categories (e.g. keyboard, mouse, pencil, and many animals).
Opening the mobilenetv2.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 R2019a and beyond. Use mobilenetv2 instead of imagePretrainedNetwork if using a release prior to R2024a.
% Access the trained model
[net, classes] = imagePretrainedNetwork("mobilenetv2");
% 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 MobileNet-v2
scores = predict(net, single(I));
label = scores2label(scores, classes)
% Show the image and the classification results
figure
imshow(I)
text(10,20,char(label),'Color','white')
MATLAB Release Compatibility
Created with R2019a
Compatible with R2019a to R2024a
Platform Compatibility
Windows macOS (Apple silicon) macOS (Intel) Linux
Categories
Find more on Deep Learning Toolbox in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!