AlexNet Output change using transfer learning
5 views (last 30 days)
Show older comments
I am currently using AlexNet for training my data, but I want to give trained images as output. Any suggestions?
Conventional AlexNet predicts images as its output, but return the name of the label. In my case I want images as output. In short I want to assign images as labels.
0 Comments
Answers (1)
Image Analyst
on 10 Apr 2020
Just look at the classification label, and decide how many output images you want to display, and display them with imshow. For example, let's say you want to train with your personal set of 2000 cat images. So you do that and now you have a trained network. Now you put in a picture of my cat, and your AlexNet network says it's a cat. So now you need to decide how many, and which ones, of your 2000 cat images do you want to display.
if contains(predictedLabel, 'cat')
% If the predicted label is 'cat', then display some number of cat training images in a new figure.
fileList = dir('/Cat Images/*.png');
fileList = fileList(1:49); % For example, only display the first 49 cat images.
hFig = figure; % Create new figure.
hFig.WindowState = 'maximized' % Maximize figure window.
for k = 1 : length(fileList)
fullFileName = fullfile(fileList(k).folder, fileList(k).name)
thisCatImage = imread(fullFileName) % Read in image of cat.
% Now display the image of this cat:
subplot(7, 7, k)
imshow(thisCatImage);
title(fileList(k).name, 'Interpreter', 'none');
end
end
Or maybe you just have one reference cat image and you display only that one image.
if contains(predictedLabel, 'cat')
myReferenceCatImage = imread('Fluffy.png') % Read in image of Fluffy, our reference cat.
% Now display the image of Fluffy:
imshow(myReferenceCatImage);
end
0 Comments
See Also
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!