%% Classify Image Using SqueezeNet
% Read, resize, and classify an image using SqueezeNet.
% First, load a pretrained SqueezeNet model.

net = squeezenet;

% Read the image using imread.

I = imread('peppers.png');
figure
imshow(I)

% The pretrained model requires the image size to be the same as the input size of the network. Determine the input size of the network using the InputSize property of the first layer of the network.

sz = net.Layers(1).InputSize

% Resize the image to the input size of the network.

I = imresize(I,sz(1:2));
figure
imshow(I)

% Classify the image using classify.

label = classify(net,I)

% Show the image and classification result together.

figure
imshow(I)
title(label)

%
% Copyright 2019 The MathWorks, Inc.