필터 지우기
필터 지우기

How can i calculate precision and recall in a Siamese network

조회 수: 1 (최근 30일)
Nagwa megahed
Nagwa megahed 2022년 3월 23일
답변: yanqi liu 2022년 3월 24일
i need help,
my reseach is about building a siamese network like this example Train a Siamese Network to Compare Images
in the attached example the accurcy of the model is calculated by this code, i ask how i can calculate the precision and recall of that model
accuracy = zeros(1,5);
accuracyBatchSize = 150;
for i = 1:5
% Extract mini-batch of image pairs and pair labels
[X1,X2,pairLabelsAcc] = getSiameseBatch(imdsTest,accuracyBatchSize);
% Convert mini-batch of data to dlarray. Specify the dimension labels
% "SSCB" (spatial, spatial, channel, batch) for image data.
X1 = dlarray(X1,"SSCB");
X2 = dlarray(X2,"SSCB");
% If using a GPU, then convert data to gpuArray.
if (executionEnvironment == "auto" && canUseGPU) || executionEnvironment == "gpu"
X1 = gpuArray(X1);
X2 = gpuArray(X2);
end
% Evaluate predictions using trained network
Y = predictSiamese(net,fcParams,X1,X2);
% Convert predictions to binary 0 or 1
Y = gather(extractdata(Y));
Y = round(Y);
% Compute average accuracy for the minibatch
accuracy(i) = sum(Y == pairLabelsAcc)/accuracyBatchSize;
end

답변 (1개)

yanqi liu
yanqi liu 2022년 3월 24일
yes,sir,may be use model to test data output,and use
[tpr,fpr,thresholds] = roc(targets,outputs)
to get roc

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by