javiribera / locating-objects-without-bboxes

PyTorch code for "Locating objects without bounding boxes" - Loss function and trained models
Other
249 stars 52 forks source link

Extend WeightedHausdorffDistance to 3D Images #4

Closed sunformoon closed 5 years ago

sunformoon commented 5 years ago

Great work! I would like to apply the WeightedHausdorffDistance on 3D images. I checked the loss function. The current loss only applies to 2D images. Would it be pretty straightforward to modify the loss to calculate the distance in 3D scenario?

Any comments on it would be great appreciate.

javiribera commented 5 years ago

I think it should be pretty straightforward to generalized the WeightedHausdorffDistance to 3D or more dimensions. In the original derivation in the paper, Omega can be set to R^3 and everything else remains the same. In the code of WeightedHausdorffDistance, one would need to replace resized_height and resized_width with a tuple with 2 or more elements, precompute the cartesian coordinates accordingly here, and some other minor changes.

The memory requirements may blow up quickly, though, since we pre-compute all the possible cartesian coordinates, and compute d(x, y) between all coordinates and each point in the ground truth Y. The current implementation does this in parallel here to emphasize speed over memory requirements. If one expects few groundtruth points, I would first extend this implementation to 3D, since it seems like a low hanging fruit.

I'd be happy to accept a pull request about this.