HuXiaoling / TopoLoss

Code for the NeurIPS 2019 paper: Topology-Preserving Deep Image Segmentation
MIT License
155 stars 24 forks source link

A problem of constructing topo_cp_weight_map #14

Closed wlsdzyzl closed 2 years ago

wlsdzyzl commented 2 years ago

In https://github.com/HuXiaoling/TopoLoss/blob/5cb98177de50a3694f5886137ff7c6f55fd51493/topoloss.py#L161, I wonder why the index is y + int(bcp_lh[hole_indx][0]), x + int(bcp_lh[hole_indx][1])? It seems that the topo_cp_weight_map has the same shape as likehood, and bcp_lh is the list of the global indices instead of local indices in current patch. x and y is the starting global index of current patch. Will this (x + int(bcp_lh[hole_indx][1]) lead to some "segmentation fault" problem?

HuXiaoling commented 2 years ago

bcp_lh is the local index as it is computed based on the current local patch as shown in https://github.com/HuXiaoling/TopoLoss/blob/5cb98177de50a3694f5886137ff7c6f55fd51493/topoloss.py#L150

wlsdzyzl commented 2 years ago

Ok, I see. Then in boundary check: https://github.com/HuXiaoling/TopoLoss/blob/5cb98177de50a3694f5886137ff7c6f55fd51493/topoloss.py#L159, should it be compared with topo_size if the patch is square? Perhaps the boundary check is not necessary.

HuXiaoling commented 2 years ago

Yes, you are right.

wlsdzyzl commented 2 years ago

Thanks for your quick reply.