keras-team / keras-cv

Industry-strength Computer Vision workflows with Keras
Other
1.01k stars 331 forks source link

Hausdorff Distance / Loss function #330

Closed innat closed 1 year ago

innat commented 2 years ago

From wiki

In mathematics, the Hausdorff distance, or Hausdorff metric, also called Pompeiu–Hausdorff distance, measures how far two subsets of a metric space are from each other. It turns the set of non-empty compact subsets of a metric space into a metric space in its own right.

It can be used for point cloud similarity metrics, keypoint detection, segmentation task, etc. For example, in an ongoing kaggle comp UW-Madison GI Tract Image Segmentation, a 3D version of Hausdorff distance is used as one of the metrics to evaluate.

Hausdorff distance is a method for calculating the distance between segmentation objects A and B, by calculating the furthest point on object A from the nearest point on object B.

I think it's a useful loss function to have. Here are some references implementation:

blackhat-coder commented 2 years ago

Hi @innat, I'm interested in implementing this

innat commented 2 years ago

@qlzh727 @LukeWood WDYT?

bhack commented 2 years ago

It is not in the Keras loss API format but we could be inspired also by other TF ecosystem official implementations:

https://github.com/tensorflow/graphics/blob/master/tensorflow_graphics/nn/loss/hausdorff_distance.py

blackhat-coder commented 2 years ago

Hi @innat Currently there's no Losses Folder in keras-cv to house loss functions Do I have to create that ?

113 @LukeWood stated to implement IoU Loss to set an example for loss functions

innat commented 2 years ago

Yes, I think so. You need to create a loss folder.

blackhat-coder commented 2 years ago

Hi, sorry I haven't made a PR on this issue, I've worked on it but currently waiting for Dice loss PR to get merged to avoid conflicts from me creating losses folder I'm also writing test cases (noob ✌)

innat commented 2 years ago

Don't worry about that. You can safely do your own. No conflict will happen on this.

LukeWood commented 2 years ago

The KerasCV team is attempting to narrow the package scope in order to more efficiently use our limited resources. As such, we are only accepting contributions directly related to items on the 6 month roadmap for the package.

Feel free to read more on the roadmap: https://github.com/keras-team/keras-cv/blob/master/.github/ROADMAP.md

bhack commented 1 year ago

The KerasCV team is attempting to narrow the package scope in order to more efficiently use our limited resources. As such, we are only accepting contributions directly related to items on the 6 month roadmap for the package.

Feel free to read more on the roadmap: https://github.com/keras-team/keras-cv/blob/master/.github/ROADMAP.md

I think that we need to check related PR when we close tickets https://github.com/keras-team/keras-cv/pull/414