%% Import Pretrained Keras Network to Classify Image
% Specify the model file.

modelfile = 'digitsDAGnet.h5';

% Specify class names.

classNames = {'0','1','2','3','4','5','6','7','8','9'};

% Import the Keras network with the class names.

net = importKerasNetwork(modelfile,'Classes',classNames);

% Read the image to classify.

digitDatasetPath = fullfile(toolboxdir('nnet'),'nndemos','nndatasets','DigitDataset');
I = imread(fullfile(digitDatasetPath,'5','image4009.png'));

% Classify the image using the pretrained network.

label = classify(net,I);

% Display the image and the classification result.

imshow(I)
title(['Classification result: ' char(label)])

% Copyright 2018 The MathWorks, Inc.