HuXiaoling / TopoLoss

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

Not clear how to use #1

Closed jgamper closed 2 years ago

jgamper commented 4 years ago

Hi,

I assume this is the code for "Topology-Preserving Deep Image Segmentation" published at NeurIPS last week. This code only includes specific function and includes python functions rather than pytorch or tensorflow implementations? Would appreciate if you could point on how one is supposed to get started with this code.

HuXiaoling commented 4 years ago

Yes, you are right.

At present, we are still working on this project and the repository is under reconstruction and sorry for the inconvenience caused. Actually theoretically speaking, the loss function can be incorporated into any suitable framework.

The function is used in PyTorch. And there are two ways to incorporate this loss function into your framework:

1) Update the total gradient (e.g. cross entropy gradient + lambda * topo gradient) when backpropagation;

2) Our loss function is actually defined on critical pixels, and you can conduct your total loss (e.g. cross entropy loss + lambda * topo loss) based on the repository. And do the else as usual.

jgamper commented 4 years ago

I see, thank you. Could you please elaborate on your answer? Or provide an example? Even option #2 would not give a gradient in relation to neural network parameters, therefore not be able to update. #1 is also not clear to me, as it again would not capture the relation between parameters at predictions at different pixel locations as it simply scales the loss.

o0t1ng0o commented 4 years ago

I have the same question as @jgamper. Could you please provide any example? @HuXiaoling Many thanks!

whikwon commented 4 years ago

I'm also interested in this field. Could you provide any example?

HuXiaoling commented 4 years ago

Here is an example: https://github.com/HuXiaoling/imageSeg-2.5D_topo. The original paper only deals with 2D images, while this repository contains both 2D and 2.5D implementations (backbone may be slightly different). And we also plan to release the code for true 3D implementations (the paper is in preparation).

I apologize for the possible confusion. But stay tuned. All of the related repositories are under construction. You can definitely adopt existing repositories regarding your own data. If there are any questions, please feel easy to post them here:)

rorondre commented 3 years ago

Hi, could you please provide documentation on how to get started with the code and an example? I would like to be able to reproduce your results. Thank you!

HuXiaoling commented 3 years ago

@rorondre Here is an example: https://github.com/HuXiaoling/imageSeg-2.5D_topo. Please also refer to the README file of both these two repositories to get started. If you still have any questions, please feel free to post them.