How to calculate the dice similarity coefficient
17 次查看(过去 30 天)
显示 更早的评论
Dear All,
Anyone know how to calculate the dice similarity my image data set as attached.
0 个评论
采纳的回答
Rik
2023-10-12
Let's first see what you have in those mat files:
s1=load('prediction.mat')
s2=load('groundtruth.mat')
So you have two equal-sized binary arrays.
Ten seconds of Googling ('wiki dice coefficient') can give you this formula:
Now you only have to implement this in Matlab.
X = s1.allBW;
Y = s2.allBW;
X = X(:);Y = Y(:); % linearize to make notation clearer
DSC = (2*sum(X&Y))/(sum(X)+sum(Y))
We can check this implementation by using the other notation:
% (for the calculation X and Y can either be the ground truth, the DSC will
% have the same value)
TP = sum( X& Y);
FP = sum( X&~Y);
FN = sum(~X& Y);
DSC = 2*TP/(2*TP+FP+FN)
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!