Skip to content

gogoymh/Pytorch-Hausdorff-Distance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 

Repository files navigation

Pytorch-Hausdorff-Distance

This is pytorch implementation of Hausdorff Distance for 2D image binary segmentation.
The implementation is made for batch-wise inference.

Notice: Input and Target dimension

Both dimensions should be like (Batch, Width, Height) or (Batch, Height, Width).
Notice that there is no Channel dimesion.
Input and Target should be same dimension.

Output Dimension

Output Dimension is (Batch).
You can use it by sum or mean after getting result.

How to use

from hausdorff_distance import torch2D_Hausdorff_distance as HD

u = torch.Tensor([[[1.0, 0.0],
                   [0.0, 1.0],
                   [-1.0, 0.0],
                   [0.0, -1.0]]])
v = torch.Tensor([[[2.0, 0.0],
                   [0.0, 2.0],
                   [-2.0, 0.0],
                   [0.0, -4.0]]])
                   
Hausdorff_distance = HD(u,v)
print(Hausdorff_distance.mean())

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages