Closed cuicathy closed 3 years ago
Hi @cuicathy ,
Sorry for my late reply.
The goal of for c in range(1, out_shape[1]):
is to separately compute the distance transform map for each class, and we do not consider the background class.
Oh, I see. Thanks for your reply @JunMa11.
Hi,
Thanks for the great work of the surface losses.
May I ask why "for c in range(1, out_shape[1])" is necessary in the def compute_sdf1_1(img_gt, out_shape)? Based on my understanding, the sdf is the distmap of each sample with the shape(x,y,z), so there is no need to for loop the c and "normalized_sdf[b] = sdf" will be enough (b is the number of samples in a batch).
If I misunderstand anything, please let me know. Thank you very much!
Regards, Cathy
The following is the function I mentioned.
def compute_sdf1_1(img_gt, out_shape): """ compute the normalized signed distance map of binary mask input: segmentation, shape = (batch_size, x, y, z) output: the Signed Distance Map (SDM) sdf(x) = 0; x in segmentation boundary -inf|x-y|; x in segmentation +inf|x-y|; x out of segmentation normalize sdf to [-1, 1] """