Transfer Learning Using AlexNet

10 ビュー (過去 30 日間)
Peter Mayhew
Peter Mayhew 2017 年 9 月 27 日
回答済み: Mark Sherstan 2018 年 12 月 17 日
I have followed the Transfer Learning Using AlexNet tutorial and sucessfully classified a new collection of images. https://uk.mathworks.com/help/nnet/examples/transfer-learning-using-alexnet.html
I would now like to apply the transfer learning so my webcam can recognise the new images, as shown in this tutorial. https://uk.mathworks.com/matlabcentral/fileexchange/60659-deep-learning-in-11-lines-of-matlab-code
How can I combine my classification of images with AlexNet?
Peter

採用された回答

Mark Sherstan
Mark Sherstan 2018 年 12 月 17 日
A really simple example is as follows:
vid = videoinput('winvideo', 1);
set(vid, 'ReturnedColorSpace', 'RGB');
img = getsnapshot(vid);
labelMachine(img,net,classifier) % net and classifier are from your transfer learning on alexnet
function label = labelMachine(img,net,classifier)
featureLayer = 'fc7';
% Pre-process the image as required for the CNN
img = imresize(img, [227 227]);
% Extract image features using the CNN
imageFeatures = activations(net, img, featureLayer);
% Make a prediction using the classifier
label = char(predict(classifier, imageFeatures));
end
I did a project that used a webcam and alex net transfer learning which can be found here if you need further referances.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by