labelling retrived images, precision, recall, average precision, Mean average precision for image retrival

4 views (last 30 days)
I want to labell the retrieved images as their folder names , find precision & recall for image retrieved. I need to find some way to find the average precision & Mean average precisioon for tthe images retrieved and plot raph for precision recall. Is there some simple way ? I saw some methods for classification but I don't think if I can use them.
[file, path] = uigetfile('*.jpg');
full_file = fullfile(path, file);
output_Folder = fullfile('Train');
root_Folder = fullfile(output_Folder);
images_query = imageDatastore(root_Folder, 'IncludeSubfolders',true, 'LabelSource','foldernames');
Read_file = imread(full_file); % Read image
Input_Layer_Size_q = net.Layers(1).InputSize(1:2);
Resized_Test_image_q = augmentedImageDatastore(Input_Layer_Size_q, Read_file, 'ColorPreprocessing','gray2rgb');
%Extract feature
t_feature = activations(net, Resized_Training_image, 'conv3', 'OutputAs', 'Rows');
q_feature = activations(net, Resized_Test_image_q, 'conv3', 'OutputAs', 'Rows');
Training_Labels = Training_image.Labels; % label training
[Query_Label] = classify(net, Resized_Test_image_q);
label = Query_Label;
%%% No. retrievels
num = 20;
[Idx,Cb] = knnsearch(t_feature,q_feature,'K',num, 'Distance','cityblock');
files = cell(1, num);
for h =1:num
files{h} = Training_image.Files{Idx(h)};
end
%query image
figure;
imshow(Read_file);
title( "query: " + string(label));
% retrived image
figure;
montage(files);
title( "retrieved: " );

Answers (0)

Community Treasure Hunt

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

Start Hunting!