open-solution-mapping-challenge icon indicating copy to clipboard operation
open-solution-mapping-challenge copied to clipboard

How do you compute the second nearest distance?

Open windson87 opened this issue 6 years ago • 4 comments

Hi, I have some issue understanding your code. I saw you use the scipy.morphology transform_distance_edt to calculate the nearest distance but where do you calculate the second nearest one ? since the weights will depending on the second nearest and the first nearest distance, if I understand it correctly.

In the code, the second nearest one is directly taken from the distance matrix dim 1 by calling image

Could anyone help me out with this? Thanks in advance

windson87 avatar Feb 04 '19 12:02 windson87

Hi, I was looking into the the same part now. My opinion is that they used the second closest object distances to see if these pixels count into the predefined border width of the buildings. This was probably done because, at first, they tried eroding the ground truth masks and this was probably a reconstruction method for small chunks separated from the gt masks after erosion.

crop

like this code snippet. In the winning configuration, they didn't use it as quoted under what didn't work in their poster:

× What didn't Work

  • Ground truth masks are prepared by first eroding them per mask creating non overlapping masks and only after that the distances are calculated.

I have no idea why they didnt use the closest distance or total distance though:) Did you figure this part out?

lunaalvarez avatar May 13 '20 16:05 lunaalvarez

Hi @lunaalvarez, in reality, we wanted to be close to what people did in the original U-Net paper. And then as we were experimenting added new things.

I think an alternative simple distance calculation was used and worked really well (and was easier/faster) here https://spark-in.me/post/a-small-case-for-search-of-structure-within-your-data.

I hope this helps.

jakubczakon avatar May 13 '20 16:05 jakubczakon

Hi, Thank you for your quick reply. The gitter discussion was actually very helpful all around. Thanks again!

lunaalvarez avatar May 14 '20 10:05 lunaalvarez

You are welcome, for some reason I was unwatched from this repo for many months and because of that I was silent, sorry @windson87 :(

jakubczakon avatar May 14 '20 11:05 jakubczakon