# How can I calculate the iou and dice for each slices in a CT volume to obtain the mean for all the volume?

조회 수: 4 (최근 30일)
Wan Faiz 2022년 5월 29일
댓글: Image Analyst 2022년 5월 29일
This is my code:
Unable to find file or directory '25_1_50epochs.mat'.
destinationSkullTest11 = "C:\Users\User\Documents\SEM 7\FYP\Dataset\U-net\Image Test";
destinationPredictionFolder = "C:\Users\User\Documents\SEM 7\Deep Learning\Predicted Test";
pixelLabelID = [1 0];
classNames = ["fracture" "background"];
SkullFiles = dir(destinationSkullTest11);
SkullDirectoryNames = {SkullFiles([SkullFiles.isdir]).name};
SkullDirectoryNames = SkullDirectoryNames(~ismember(SkullDirectoryNames,{'.','..'}));
for z = 1:length(SkullDirectoryNames)
fullfileSkull = fullfile(destinationSkullTest11,SkullDirectoryNames(z));
imdstest11 = imageDatastore(fullfileSkull,"FileExtensions",".png","LabelSource","foldernames");
pxdsResults11 = semanticseg(imdstest11,net,"WriteLocation",targetFolder);
for t = 1:length(pxdsResults11.Files)
confmat = segmentationConfusionMatrix(pr,gt);
% IoU = TP / (TP + FP + FN)
numeiou(t,:) = confmat(1,1);
denoiou(t,:) = confmat(1,1) + confmat(1,2) + confmat(2,1);
numeiouall = sum(numeiou);
denoiouall = sum(denoiou);
% Dice = 2TP / (2TP + FP + FN)
numedice(t,:) = 2*confmat(1,1);
denodice(t,:) = 2*confmat(1,1) + confmat(1,2) + confmat(2,1);
numediceall = sum(numedice);
denodiceall = sum(denodice);
end
miou(z,:) = sum(numeiouall)/sum(denoiouall);
mdice(z,:) = sum(numediceall)/sum(denodiceall);
end
meaniou = mean(miou);
meandice = mean(mdice);
##### 댓글 수: 3이전 댓글 1개 표시이전 댓글 1개 숨기기
Wan Faiz 2022년 5월 29일
How can I attach the file is larger than 5MB
Image Analyst 2022년 5월 29일

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Semantic Segmentation에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by