Accuracy of FCM clustering

9 views (last 30 days)
Arathy Das
Arathy Das on 10 May 2017
Sir, Can anyone please help me to write a code for finding the accuracy of FCM clustering algorithm which used for detecting lung cancer from CT scan images. I have tried with the following code but it is showing me constant values for accuracy,sensitivity and specificity for every data. Please help me to get through this.
clc;
clear all;
close all;
%load testmask5.mat % ground truth
%load twoglcm5.mat %segmented image
file = 'ok12grnd.jpg';
initImage = imread(file);
%figure;
%imshow(mask); % ground truth
truth=imread(file);
% truth=im2bw(im);
figure;
f1='ok12out.jpg';
ou=imread(f1);
% ou=im2bw(im);
imshow(ou); %segmented image
adder = truth + ou;
%figure
%imshow(adder)
TP = length(find(adder == 2)); %true positive
TN = length(find(adder == 1)); %true negative
subtr = imsubtract(ou,truth);
figure
imshow(subtr)
FP = length(find(subtr >0)); %false negative
FN = length(find(subtr <0)); %false positive
p1= TP/(TP+FP); %precision
A5=(TP+TN)/(TP+TN+FP+FN); %accuracy
SN5=TP/(TP+FN); %sensitivity
SP5=TN/(TN+FP); %specificity
%plot bar graph
figure;
y = [A5*100 SN5*100 SP5*100];
bar(y,'b')
Labels = {'Accuracy', 'Sensitivity', 'Specificity'};
set(gca, 'XTick', 1:3, 'XTickLabel', Labels);
ylim([0 100]);

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by