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 CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by