che85
(Christian)
March 21, 2019, 7:33pm
1
Hi there,
does anyone of you know an open source implementation of the Average Hausdorff distance? I would like to try using it for some 3D volumetric data but don’t quite know how to get started with writing a loss function in pytorch.
I am helpful for any kind of input.
Thanks a lot.
Christian
1 Like
yyifan
January 15, 2020, 10:45am
2
Hi Christian,
The open source code of a CVPR 2019 paper (Locating Objects Without Bounding Boxes) may be helpful. Here is the url .
Not sure whether this is still helpful you right now.
che85
(Christian)
January 23, 2020, 6:15pm
3
Thanks for this reference. It seem that it’s not applied to 3D. Am I correct?
5 years late, but here is a more generic implementation
X1.shape == (B, N, D)
X2.shape == (M, D)
X2 = X2.unsqueeze(0).expand(B, M, D) # (B, M, D)
dist = torch.cdist(X1, X2_exp) # B, N, M
dh_x_y = dist.min(1)[0].mean(-1) # B, M --> B
dh_y_x = dist.min(2)[0].mean(-1) # B, N --> B
dist = dh_x_y + dh_y_x