Extracting features with CNN VGG16 and KNN classification
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!