AlexNet Output change using transfer learning

8 ビュー (過去 30 日間)
Siddharth Jain
Siddharth Jain 2020 年 4 月 2 日
回答済み: Image Analyst 2020 年 4 月 10 日
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.

回答 (1 件)

Image Analyst
Image Analyst 2020 年 4 月 10 日
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

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by