我在这个online code中添加了一个函数,并想知道我是否正确计算每个标签的dsc
!如果专家看一下,我会很感激,如果我做错了,请告诉我。
#cl= list of class labels for exmple [0,1,2]
for i, c in enumerate(cl):
curr_eval_mask = eval_mask[i, :, :]
curr_gt_mask = gt_mask[i, :, :]
if (np.sum(curr_eval_mask) == 0) or (np.sum(curr_gt_mask) == 0):
continue
n_ii = np.sum(np.logical_and(curr_eval_mask, curr_gt_mask))
t_i = np.sum(curr_gt_mask)
n_ij = np.sum(curr_eval_mask)
DSC[i] =(2*n_ii) / (t_i + n_ij )
mean_DSC_ = np.sum(DSC) / n_cl_gt
#n_cl_gt=number of classes in ground truth
where: n_cl : number of classes included in ground truth segmentation
n_ij : number of pixels of class i predicted to belong to class j
t_i : total number of pixels of class i in ground truth segmentation
我的另一个问题是:mean intersection over union (IoU)
是否与平均值Jaccard
相同,骰子也可以计算dice=(2*Jacc)/(1+Jacc)
?
我通过一个图像的代码计算了平均值dsc,并且是0.01958
,但是,对于同一个图像,我的意思是0.0101
,我想我在某个地方犯了一些错误。资源提到通常Jacc
总是大于DSC
。通过根据公式计算,我获得了骰子相似性的0.01999
。我做错了吗?
由于