Effacer les filtres
Effacer les filtres

Extracting features with CNN VGG16 and KNN classification

4 vues (au cours des 30 derniers jours)
Andrea Magni
Andrea Magni le 24 Août 2018
Modifié(e) : Andrea Magni le 24 Août 2018
Hi, I'm new to machine learning and classification. I read a lot of documentation in matlab in order to create a function that calculates the features of a given dataset. This is what I wrote:
tic;
net = vgg16;
layer = 'fc7';
net_size = net.Layers(1).InputSize;
[images, labels] = readlists();
n = numel(images);
f = [];
for i = 1 : n
im = imread(['simplicity/' images{i}]);
im = imresize(im, net_size(1:2));
f = [f; activations(net, im, layer, 'ExecutionEnvironment', 'gpu')];
end
toc;
save('f', 'f');
Is this correct or did I calculated something useless? However I've tested it and the accuracy of training is: 95% and test: 94% using a dataset of 1000 images.
Now I want to know if I'm doing it right. How can I get the corresponding label to an image? I mean, if I want to know the corresponding label, given an image (for example food) of the dataset, how can I do that?
By the way, readList() returns a cell array filled with the name of each image (images) and the corresponding labels (labels).
It takes about ~30 secs to calculate 'f' using gpu.

Réponses (0)

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by