neptune-ai / open-solution-mapping-challenge

Open solution to the Mapping Challenge :earth_americas:
https://www.crowdai.org/challenges/mapping-challenge
MIT License
380 stars 96 forks source link

How do you compute the second nearest distance? #200

Open windson87 opened 5 years ago

windson87 commented 5 years ago

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

lunaalvarez commented 4 years ago

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?

jakubczakon commented 4 years ago

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.

lunaalvarez commented 4 years ago

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

jakubczakon commented 4 years ago

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