Signed distance transform computation of predicted segmentation

Hey!
I try to implement a new loss function, in which the calculation of the signed distance transform (https://en.wikipedia.org/wiki/Signed_distance_function) of the predicted segmentation label is required. The SDT can be computed using the euclidean distance transform. A comparable function is available in the scipy package (https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.morphology.distance_transform_edt.html). Does anyone know how to compute the SDT of the predicted segmentation label to perform the backward operation afterwards?

1 Like

@tkepp: Interesting! Have you find any solution. I used regression to do it and MSE loss but the performance is very poor. The output also has negative value. I did not find the way to force them to positive. Any idea

Hey,
I used the L1 loss for the regression of the SDTs. Unfortunately I haven’t found a better solution yet.

1 Like

So, SDTs used ndimage to compute. Am I right? I am looking at the idea https://arxiv.org/abs/1901.01238 but it does not show any improvement in my case

Have you addressed this problem? We also want to implement the distance transform with the pytorch. It would be great if you could share your implementation.

1 Like

A derivable SDT was recently presented: A Differentiable Convolutional Distance Transform Layer for Improved Image Segmentation

1 Like